Create your own registry to share your code.
To create a registry start by creating a new github repository.
jsrepo looks at the directories in your project to determine which blocks to add the the jsrepo-manifest.json file. Because of this you need to follow a specific file structure.
You will need to create a folder that will have the block categories (`blocks` above).
Inside this folder you add your categories ex: (utils, components, etc.).
Inside your categories folders you add the code for your blocks. You can either add the block code as a single file directly inside the category or you can create a folder that contains the files for the block.
When adding blocks users will access your blocks by specifying <category>/<name>.
When you are done your file structure might look something like this:
Once you have setup all you files run you'll want to setup a build script to build your blocks into a jsrepo-manifest.json.
The easiest way to do this is to use the CLI:
This sets up a build script for you based on your answers to the prompts.
However you can also just run it manually like so:
After running build the output jsrepo-manifest.json should look something like this.
Commit the output jsrepo-manifest.json to a public repository and you should now be able to access your blocks by running:
Your blocks can depend on other blocks under the same directory of your project and they will also be added when users add that block.
blocks/utils/math/add.ts
Your blocks can also depend on npm packages and they will be installed when users add your block.
If you now add utils/math you will get the following output:
By default in *.svelte and *.vue files importing from 'svelte' or 'vue' will not result in the respective frameworks being added as a dependency.
This is because it's pretty easy to assume anyone adding either of those file types to their project will already have Svelte or Vue installed.
However if you are using a *.jsx based framework we don't assume anything for you. There are a lot of different library's that use *.jsx so we'd be making an ass of ourselves.
Instead when running the build command you can provide the --exclude-deps flag:
By providing that flag it tells jsrepo to ignore those dependencies and skip adding them to the manifest file.