fix(registry): bake democrito.design URLs into registryDependencies#74
Conversation
Prefix build-registry.mjs with REGISTRY_URL so every npm run build and npm run registry writes full .json URLs for custom component deps. shadcn/ui primitives remain as bare names (resolved by shadcn itself). Verified: app-shell.json deps are full URLs; sidebar-nav.json has correct mix of bare (shadcn) + full URLs (custom).
📝 WalkthroughWalkthroughAll ChangesRegistry Dependency URL Migration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 8-11: The build and registry scripts in package.json use
POSIX-style environment variable assignment (REGISTRY_URL=...) which fails on
Windows cmd.exe. Install the cross-env package as a dev dependency and replace
the inline environment variable assignments in both the build script (line 8)
and registry script (line 11) with cross-env to ensure cross-platform
compatibility. For example, replace REGISTRY_URL=https://democrito.design/r node
with cross-env REGISTRY_URL=https://democrito.design/r node for both affected
scripts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 39602817-809c-46d0-92e2-b6c3f9b3478c
📒 Files selected for processing (18)
package.jsonpublic/r/activity-feed.jsonpublic/r/app-shell.jsonpublic/r/auth-form.jsonpublic/r/code-block.jsonpublic/r/dashboard-stats.jsonpublic/r/democrito-atoms.jsonpublic/r/democrito-molecules.jsonpublic/r/democrito-organisms.jsonpublic/r/democrito-templates.jsonpublic/r/field-header.jsonpublic/r/filter-bar.jsonpublic/r/run-history.jsonpublic/r/search-bar.jsonpublic/r/settings-nav.jsonpublic/r/sidebar-nav.jsonpublic/r/token-reference-card.jsonpublic/r/top-bar.json
| "build": "node scripts/generate-counts.mjs && node scripts/generate-tokens.mjs && node scripts/stamp-design-date.mjs && REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest", | ||
| "registry": "node scripts/build-registry.mjs" | ||
| "registry": "REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify whether scripts currently rely on POSIX-only inline env syntax
rg -n '"(build|registry)"\s*:\s*".*REGISTRY_URL=' package.json
# Verify whether cross-env is already available in dependencies
rg -n '"cross-env"\s*:' package.jsonRepository: mmorerasanchez/democrito
Length of output: 361
Use cross-platform env injection for npm scripts (Windows breakage).
Lines 8 and 11 use POSIX-style inline env assignment (REGISTRY_URL=... node ...), which does not work in default Windows cmd.exe, so npm run build and npm run registry will fail for Windows contributors and CI.
Suggested fix
{
"scripts": {
- "build": "node scripts/generate-counts.mjs && node scripts/generate-tokens.mjs && node scripts/stamp-design-date.mjs && REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs",
+ "build": "node scripts/generate-counts.mjs && node scripts/generate-tokens.mjs && node scripts/stamp-design-date.mjs && cross-env REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs",
- "registry": "REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs"
+ "registry": "cross-env REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs"
},
"devDependencies": {
+ "cross-env": "^7.0.3",
...
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "build": "node scripts/generate-counts.mjs && node scripts/generate-tokens.mjs && node scripts/stamp-design-date.mjs && REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs", | |
| "test": "vitest run", | |
| "test:watch": "vitest", | |
| "registry": "node scripts/build-registry.mjs" | |
| "registry": "REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs" | |
| "build": "node scripts/generate-counts.mjs && node scripts/generate-tokens.mjs && node scripts/stamp-design-date.mjs && cross-env REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs", | |
| "test": "vitest run", | |
| "test:watch": "vitest", | |
| "registry": "cross-env REGISTRY_URL=https://democrito.design/r node scripts/build-registry.mjs" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 8 - 11, The build and registry scripts in
package.json use POSIX-style environment variable assignment (REGISTRY_URL=...)
which fails on Windows cmd.exe. Install the cross-env package as a dev
dependency and replace the inline environment variable assignments in both the
build script (line 8) and registry script (line 11) with cross-env to ensure
cross-platform compatibility. For example, replace
REGISTRY_URL=https://democrito.design/r node with cross-env
REGISTRY_URL=https://democrito.design/r node for both affected scripts.
Split the registryDependencies URL-application into two passes: individual components continue using addUrl (only custom non-ui names get URLs, so ui cross-refs like command→dialog stay bare), while all 5 tier bundles use addBundleUrl (unconditional prefix, since every bundle dep is served from the democrito registry). democrito-ui bundle now 48/48 URLs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
REGISTRY_URL=https://democrito.design/rbeforebuild-registry.mjsin bothbuildandregistrynpm scriptsregistryDependenciesnow write as full.jsonURLs (e.g."https://democrito.design/r/sidebar-nav.json")addUrl()function inscripts/build-registry.mjs(line 315) already handled this; it just needed the env varWhy this matters
npx shadcn@latest add https://democrito.design/r/app-shell.jsonfetches the item but then cannot resolve its deps (sidebar-nav,top-bar,theme-toggle) because bare names have no registry context. With full URLs, shadcn chains the installs correctly.Verification
125/125 tests pass.
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes