feat: /export-design-system command for publishable component libraries#60
Open
PAMulligan wants to merge 1 commit into
Open
feat: /export-design-system command for publishable component libraries#60PAMulligan wants to merge 1 commit into
PAMulligan wants to merge 1 commit into
Conversation
…raries Adds a standalone command that exports generated components and the design token lockfile as a versioned pnpm workspace, scoped to whatever outputTarget is set in build-spec.json. The workspace contains two packages: - @scope/design-tokens — framework-agnostic (CSS vars, Tailwind preset, typed exports, raw lockfile snapshot), built with Vite library mode. - @scope/<framework>-components — framework-specific component library with ThemeProvider/useTheme, peer-deps, and proper exports map. React/Vue/Svelte use Vite library mode; React Native falls back to tsc since Vite is incompatible with the RN runtime. Includes Changesets versioning scaffold, .npmrc, .gitignore, tsconfig.base.json, and per-package READMEs. Components are copied with tests/stories/types filtered out. Closes #19 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
/export-design-systemslash command, anexport-design-systemskill, and ascripts/export-design-system.{js,sh}exporter that emits a publishable pnpm workspace from generated components anddesign-tokens.lock.json.@scope/design-tokens(framework-agnostic — CSS vars, Tailwind preset, typed exports) plus@scope/<framework>-components(built with Vite library mode for React/Vue/Svelte;tscfor React Native, since Vite is incompatible with the RN runtime).outputTargetis set inbuild-spec.json(with--frameworkflag andpackage.json-based fallback). Includes Changesets versioning scaffold,.npmrc, per-package READMEs, and aThemeProvider+useThemeper framework.Closes #19.
What's in the box
scripts/export-design-system.js— main exporter (~640 LOC, ESM, no extra deps)scripts/export-design-system.sh— wrapper matching thegenerate-stories.shpattern.claude/commands/export-design-system.md— slash command.claude/skills/export-design-system/SKILL.md— skill docsCLAUDE.md— registered new script + skill + command, count bumps (19→20 skills, 29→31 scripts)Test plan
--helprenders correctlyoutputTargetfrombuild-spec.json, scope frompackage.json, copies components +index.ts, excludes*.test.*/*.stories.*/*.d.ts.vuecomponents copied,ThemeProvider.tsusesprovide/inject+h()render.sveltecomponents,ThemeProvider.svelte, vite-plugin-svelte configvite.config.ts,tsc -p tsconfig.jsonbuild, peerDepsreact-native >=0.74, RN note in stdout + README--force(exit 1), overwrites with--force--framework angular): exit 3--dry-run: writes nothing--json: machine-readable summarycpreplaced with a generatedscripts/postbuild.mjsusingfs.cpSync(caught during smoke testing on Windows)pnpm install && pnpm buildagainst a real lockfile from a/build-from-figmarun (not yet exercised — peer-dep ranges and Tailwind preset mapping may need tweaks for non-standard lockfile shapes)Caveats
pnpm installorpnpm build. First real proof-of-life will come from running the workspace against a real lockfile.colors,spacing,radii/borderRadius,typography.fontFamily. Non-standard shapes may require a hand-tweak to the generated preset.tscnot Vite. Documented in stdout, README, and skill docs.🤖 Generated with Claude Code