fix(v4): Re-enable remote dependencies#1807
Conversation
|
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
There was a problem hiding this comment.
Pull Request Overview
This PR re-enables support for remote dependencies by updating the functions to utilize URLs instead of names when fetching registry data.
- Updates fetchRegistry calls to expect an array of URL strings instead of a base URL and path segments.
- Modifies helper functions (e.g., getRegistryIndex, getRegistryBaseColor, resolveTree, fetchTree) accordingly.
Comments suppressed due to low confidence (2)
packages/cli/src/utils/registry/index.ts:148
- [nitpick] Consider renaming the parameter 'items' to 'urls' to more clearly indicate that each element is a URL.
async function fetchRegistry(items: string[]) {
packages/cli/src/utils/registry/index.ts:178
- The updated error message no longer includes the base URL, which might make it harder to diagnose which registry URL failed. Consider including additional context if possible.
throw error(`Failed to fetch registry. Error: ${e}`);
Noticed this when reading through https://ui.shadcn.com/docs/registry/examples.
Some of the examples have urls in their registry dependencies. I broke support for this when #1781 got merged.
This PR re-adds support by expecting callers of
fetchRegistryto supply a url instead of a name. It also modifies some of the other functions to conform with that expectation. This also allows you to pass registry items intofetchRegistrythat don't belong to the same registry without both of them using the same base url.