An open source design system that's fully customizable and agent ready
TypeScript
fix(vibe-tests): ensure CSS dist files exist before report build (#556)
Cindy Zhangc27509a40b0f
diff --git a/internal/vibe-tests/src/build-report.ts b/internal/vibe-tests/src/build-report.tsindex e9f20159aa..ab99d0f007 100644--- a/internal/vibe-tests/src/build-report.ts+++ b/internal/vibe-tests/src/build-report.ts@@ -20,6 +20,53 @@ import {getResultsDir, readJson, ensureDir} from './utils.js';import type {UniversalAggregate, UniversalComparison} from './types.js';const APP_DIR = path.join(import.meta.dirname, '..', 'app');+const REPO_ROOT = path.join(import.meta.dirname, '../../..');++/**+ * Ensure pre-compiled CSS dist files exist.+ *+ * The report build uses pre-compiled CSS from:+ * - packages/core/dist/xds.css (component styles)+ * - packages/themes/default/dist/theme.css (theme tokens)+ *+ * These are generated by `yarn build` but may not exist if the repo+ * was freshly cloned or only `yarn install` was run.+ */+function ensureCssDist(): void {+ const xdsCss = path.join(REPO_ROOT, 'packages/core/dist/xds.css');+ const themeCss = path.join(+ REPO_ROOT,+ 'packages/themes/default/dist/theme.css',+ );++ const missing: string[] = [];+ if (!fs.existsSync(xdsCss)) missing.push('@xds/core/dist/xds.css');+ if (!fs.existsSync(themeCss))+ missing.push('@xds/theme-default/dist/theme.css');++ if (missing.length > 0) {+ console.log('📦 Building CSS dist files (required for report)...');+ console.log(` Missing: ${missing.join(', ')}`);++ // Build core package (includes xds.css via postbuild)+ if (!fs.existsSync(xdsCss)) {+ execSync('yarn workspace @xds/core build', {+ cwd: REPO_ROOT,+ stdio: 'inherit',+ });+ }++ // Build theme packages+ if (!fs.existsSync(themeCss)) {+ execSync('yarn workspace @xds/theme-default build', {+ cwd: REPO_ROOT,+ stdio: 'inherit',+ });+ }++ console.log(' ✓ CSS dist files ready\n');+ }+}function parseArgs(): {iteration: string;@@ -301,7 +348,10 @@ async function main() {});console.log(` ✓ ${(dataScript.length / 1024).toFixed(0)} KB of report data`);- // Step 5: Dev mode or build+ // Step 5: Ensure CSS dist files exist (needed for report build)+ ensureCssDist();++ // Step 6: Dev mode or buildif (dev) {// For dev mode, write data to a module file so Vite can serve itconst dataDir = path.join(APP_DIR, 'src', 'data');diff --git a/packages/core/package.json b/packages/core/package.jsonindex 0f964c0694..23737da013 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -21,6 +21,7 @@},"./reset.css": "./src/reset.css","./typography.css": "./src/typography.css",+ "./xds.css": "./dist/xds.css","./theme/tokens.stylex": {"source": "./src/theme/tokens.stylex.ts","types": "./dist/theme/tokens.stylex.d.ts",diff --git a/scripts/sync-exports.js b/scripts/sync-exports.jsindex 4fcab7899a..2ac29070ee 100644--- a/scripts/sync-exports.js+++ b/scripts/sync-exports.js@@ -44,6 +44,7 @@ const UTILITY_DIRS = new Set(['hooks', 'theme', 'utils']);const STATIC_EXPORTS = {'./reset.css': './src/reset.css','./typography.css': './src/typography.css',+ './xds.css': './dist/xds.css','./theme/tokens.stylex': {source: './src/theme/tokens.stylex.ts',types: './dist/theme/tokens.stylex.d.ts',