Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add example for how to dynamically generate registries #459

Open
1 task done
svelte0 opened this issue Feb 25, 2025 · 4 comments · Fixed by #460
Open
1 task done

docs: Add example for how to dynamically generate registries #459

svelte0 opened this issue Feb 25, 2025 · 4 comments · Fixed by #460
Labels

Comments

@svelte0
Copy link

svelte0 commented Feb 25, 2025

Describe the feature

Can you please add an example how i can create a dynamic registry, example i want to allow users to add svelte0.dev blocks but the content is going to be generated when user send request to the api endpoint.

npx jsrepo add svelte0.dev/api/add/[projectID]

What scheme must be returned in order for jsrepo to work.

Validations

  • I have checked other issues to see if my feature was already requested or added
@ieedan
Copy link
Owner

ieedan commented Feb 25, 2025

You just need to generate a manifest file in the root of the registry.

So if your registry is at: https://svelte0.dev/r

Your manifest file needs to be at: https://svelte0.dev/r/jsrepo-manifest.json

jsrepo now exports types from the package:

import { Manifest } from 'jsrepo';   

I would be happy to help with implementation of this.

The more complicated part is that you also need to serve every file. So your manifest file might want https://svelte0.dev/r/src/ui/button/button.svelte so you have to serve that file from an endpoint.

This might be worth making a template for actually.

@ieedan
Copy link
Owner

ieedan commented Feb 25, 2025

I just threw together https://github.com/ieedan/jsrepo-dynamic.

It is super super basic but I think it gives you an idea of what it requires. I will probably refine this to make it more of an actual template for anyone actually looking to do this.

Right now you still have to manage where things go and their dependencies on your own.

@ieedan ieedan changed the title feat: Dynamic generated docs: Add example for how to dynamically generate registries Feb 25, 2025
@ieedan
Copy link
Owner

ieedan commented Feb 25, 2025

For more detailed instructions you can check out the preview on #460

@ieedan ieedan reopened this Feb 25, 2025
@ieedan
Copy link
Owner

ieedan commented Feb 25, 2025

I merged the docs for now. Let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants