An open source design system that's fully customizable and agent ready
TypeScript
refactor(cli): rename build-theme to theme build (#568) (#570)
Cindy Zhangaf5ceb48883d
diff --git a/.claude/commands/create-theme.md b/.claude/commands/create-theme.mdindex 38e3cbeff1..e29b4d4671 100644--- a/.claude/commands/create-theme.md+++ b/.claude/commands/create-theme.md@@ -144,7 +144,7 @@ Component overrides generate scoped CSS:### Distribution- **Unbuilt**: `XDSTheme` generates CSS and injects `<style>` at runtime-- **Built**: `npx xds build-theme` pre-compiles to a CSS file+- **Built**: `npx xds theme build` pre-compiles to a CSS file## Referencediff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.mdindex 23a505fb8a..b7cbdbec67 100644--- a/packages/cli/CHANGELOG.md+++ b/packages/cli/CHANGELOG.md@@ -40,7 +40,7 @@});```- Build theme CSS with: `npx xds build-theme`+ Build theme CSS with: `npx xds theme build`### New: `className` and `style` props on all componentsdiff --git a/packages/cli/src/commands/build-theme.mjs b/packages/cli/src/commands/build-theme.mjsindex a9d952db8d..74741a6506 100644--- a/packages/cli/src/commands/build-theme.mjs+++ b/packages/cli/src/commands/build-theme.mjs@@ -1,13 +1,13 @@/**- * @file build-theme command — Compile a defineTheme file to CSS+ * @file theme build command — Compile a defineTheme file to CSS** Takes a theme file that uses defineTheme() and outputs:* - A CSS file with token overrides and component styles* - An updated JS module that references the built className** Usage:- * npx xds build-theme ./src/themes/ocean.ts- * npx xds build-theme ./src/themes/ocean.ts --out ./dist/ocean.css+ * npx xds theme build ./src/themes/ocean.ts+ * npx xds theme build ./src/themes/ocean.ts --out ./dist/ocean.css*/import * as fs from 'node:fs';@@ -321,7 +321,7 @@ function generateTailwindPreset(themeDef) {return `/*** XDS Tailwind Preset — ${themeDef.name} theme- * Generated by \`npx xds build-theme --tailwind\`+ * Generated by \`npx xds theme build --tailwind\`** Usage in tailwind.config.js:* import { xdsPreset } from './${themeDef.name}.tailwind';@@ -444,7 +444,7 @@ function generateBuiltModule(themeDef, iconImportPath) {.join('\n');return `${iconImport}/**- * ${themeDef.name} theme — built by \`npx xds build-theme\`+ * ${themeDef.name} theme — built by \`npx xds theme build\`* Import the CSS file alongside this module:** import { ${toIdentifier(themeDef.name)}Theme } from './${themeDef.name}';@@ -593,10 +593,14 @@ function validateComponentOverrides(themeDef) {return warnings;}-export function registerBuildTheme(program) {- program- .command('build-theme <file>')- .description('Compile a defineTheme file to CSS')+export function registerTheme(program) {+ const theme = program+ .command('theme')+ .description('Theme tools — build, export, and manage XDS themes');++ theme+ .command('build <file>')+ .description('Compile a defineTheme file to CSS + JS').option('-o, --out <path>', 'Output CSS file path').option('--no-prose', 'Skip prose mappings (h1, p, code, hr, etc.)').option('--tailwind', 'Generate a Tailwind CSS preset file')diff --git a/packages/cli/src/index.mjs b/packages/cli/src/index.mjsindex f0b485e755..e4a7480bff 100644--- a/packages/cli/src/index.mjs+++ b/packages/cli/src/index.mjs@@ -13,7 +13,7 @@ import {registerDocs} from './commands/docs.mjs';import {registerTemplate} from './commands/template.mjs';import {registerGapReport} from './commands/gap-report.mjs';import {registerUpgrade} from './commands/upgrade.mjs';-import {registerBuildTheme} from './commands/build-theme.mjs';+import {registerTheme} from './commands/build-theme.mjs';export const program = new Command();@@ -34,7 +34,7 @@ registerAgentDocs(program);registerTemplate(program);registerGapReport(program);registerUpgrade(program);-registerBuildTheme(program);+registerTheme(program);// Hidden command used by package.json postinstall scriptsprogramdiff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.mdindex db47c44cdd..f014de1e92 100644--- a/packages/core/CHANGELOG.md+++ b/packages/core/CHANGELOG.md@@ -40,7 +40,7 @@});```- Build theme CSS with: `npx xds build-theme`+ Build theme CSS with: `npx xds theme build`### New: `className` and `style` props on all componentsdiff --git a/packages/core/src/theme/XDSTheme.tsx b/packages/core/src/theme/XDSTheme.tsxindex ce17fe66b9..0c58344de6 100644--- a/packages/core/src/theme/XDSTheme.tsx+++ b/packages/core/src/theme/XDSTheme.tsx@@ -73,7 +73,7 @@ const injectedThemes = new Set<string>();/*** Hook to inject theme CSS into the document.- * Built themes (from `xds build-theme`) skip injection — their CSS+ * Built themes (from `xds theme build`) skip injection — their CSS* is in a separate file imported by the consumer.*/function useThemeStyleInjection(theme: XDSDefinedTheme): void {diff --git a/packages/core/src/theme/defineTheme.ts b/packages/core/src/theme/defineTheme.tsindex 5c3513e636..5852eb8c52 100644--- a/packages/core/src/theme/defineTheme.ts+++ b/packages/core/src/theme/defineTheme.ts@@ -3,7 +3,7 @@** Two distribution modes:* - Unbuilt: XDSTheme generates CSS and injects a <style> tag at runtime- * - Built: `npx xds build-theme` pre-compiles to a CSS file; XDSTheme just+ * - Built: `npx xds theme build` pre-compiles to a CSS file; XDSTheme just* sets the data-xds-theme attribute** Token values can be:@@ -145,7 +145,7 @@ export interface XDSDefinedTheme {components?: XDSComponentStyleMap;/** Icon registry */icons?: Partial<XDSIconRegistry>;- /** Whether this theme has been pre-compiled by build-theme CLI */+ /** Whether this theme has been pre-compiled by theme build CLI */__built?: true;}diff --git a/packages/themes/brutalist/package.json b/packages/themes/brutalist/package.jsonindex 76a462896c..921d826d98 100644--- a/packages/themes/brutalist/package.json+++ b/packages/themes/brutalist/package.json@@ -21,7 +21,7 @@"src"],"scripts": {- "build": "xds build-theme src/index.ts -o dist/theme.css && tsup && rm -f dist/brutalist.js dist/brutalist.d.ts"+ "build": "xds theme build src/index.ts -o dist/theme.css && tsup && rm -f dist/brutalist.js dist/brutalist.d.ts"},"peerDependencies": {"@xds/core": "*"diff --git a/packages/themes/default/CHANGELOG.md b/packages/themes/default/CHANGELOG.mdindex 4f20b6ece8..dceb5548aa 100644--- a/packages/themes/default/CHANGELOG.md+++ b/packages/themes/default/CHANGELOG.md@@ -40,7 +40,7 @@});```- Build theme CSS with: `npx xds build-theme`+ Build theme CSS with: `npx xds theme build`### New: `className` and `style` props on all componentsdiff --git a/packages/themes/default/package.json b/packages/themes/default/package.jsonindex dd087419f8..697a172845 100644--- a/packages/themes/default/package.json+++ b/packages/themes/default/package.json@@ -20,7 +20,7 @@"src"],"scripts": {- "build": "xds build-theme src/defaultTheme.ts -o dist/theme.css && tsup && rm -f dist/default.js dist/default.d.ts"+ "build": "xds theme build src/defaultTheme.ts -o dist/theme.css && tsup && rm -f dist/default.js dist/default.d.ts"},"dependencies": {"@heroicons/react": "^2.2.0"diff --git a/packages/themes/neutral/CHANGELOG.md b/packages/themes/neutral/CHANGELOG.mdindex 45305b9869..aaa88acc61 100644--- a/packages/themes/neutral/CHANGELOG.md+++ b/packages/themes/neutral/CHANGELOG.md@@ -40,7 +40,7 @@});```- Build theme CSS with: `npx xds build-theme`+ Build theme CSS with: `npx xds theme build`### New: `className` and `style` props on all componentsdiff --git a/packages/themes/neutral/package.json b/packages/themes/neutral/package.jsonindex baadc12209..11a233ac14 100644--- a/packages/themes/neutral/package.json+++ b/packages/themes/neutral/package.json@@ -20,7 +20,7 @@"src"],"scripts": {- "build": "xds build-theme src/neutralTheme.ts -o dist/theme.css && tsup && rm -f dist/neutral.js dist/neutral.d.ts"+ "build": "xds theme build src/neutralTheme.ts -o dist/theme.css && tsup && rm -f dist/neutral.js dist/neutral.d.ts"},"dependencies": {"lucide-react": "^0.575.0"