feat: stamp component source with docs-page signature#77
Merged
Conversation
Add a one-line provenance comment to component source on copy and on registry install so the origin travels with the code. - lib/signature.ts: withSignature inserts `// <domain>/components/<cat>/<slug>` after any use client/use server directive; picks // or /* */ by extension; no-ops non-code files - lib/site.ts: SITE_URL from NEXT_PUBLIC_SITE_URL with beui.dev fallback; reused across registry-server, robots, sitemap and layout metadataBase - registry-server: signs the component's own files only (not shared deps) - component page: signs the source tab so copied code matches installs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a one-line provenance comment to component source — both when copied from the docs and when installed via the registry — so the origin travels with the code:
Plus centralizes the site domain behind an env var.
Signature
lib/signature.tswithSignature(content, path, pageUrl)— inserts the banner after anyuse client/use serverdirective, else at the top. Picks//vs/* */by extension. No-ops non-code files (json, etc.).pageUrlFor(category, slug)— the docs page URL.buildEntry+buildShadcnIteminlib/registry-server.tsExampleBlock+DefaultTabs). Usage/preview tabs unchanged, matching what installs ship.Domain from env
lib/site.ts—SITE_URL = NEXT_PUBLIC_SITE_URL ?? "https://beui.dev"(trailing slash stripped).registry-server,robots,sitemap, and layoutmetadataBase(previously hardcodedhttps://beui.devin each).NEXT_PUBLIC_SITE_URLis optional; the fallback keeps prod working. Set it for non-prod envs to self-reference.Verification
bun run typecheckcleanbun run check:registryvalidates 35 componentsbun run lintclean (one pre-existing warning ininstall-command.tsx, unrelated)