@atlashub/smartstack-cli 4.79.0 → 4.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -117403,10 +117403,27 @@ VITE_PORT=3000
117403
117403
  const envEx_result = await safeWriteFile((0, import_path7.join)(webDir, ".env.example"), envExampleFile, findKnownHash(state, "frontend", envEx_relPath));
117404
117404
  logSafeWriteResult(envEx_relPath, envEx_result);
117405
117405
  recordFile(state, "frontend", envEx_relPath, envEx_result.hash);
117406
- const viteConfig = `import { defineConfig, loadEnv } from 'vite';
117406
+ const viteConfig = `import { defineConfig, loadEnv, type Plugin } from 'vite';
117407
+ import { readFile } from 'node:fs/promises';
117407
117408
  import react from '@vitejs/plugin-react';
117408
117409
  import tailwindcss from '@tailwindcss/vite';
117409
117410
 
117411
+ // Upstream workaround: @atlashub/smartstack's theme.css contains a comment
117412
+ // with the pattern \`**/*.js\` whose \`*/\` closes the comment early and breaks
117413
+ // Tailwind v4's CSS parser ("Unterminated string: ';'"). Rewrite on load.
117414
+ function fixSmartstackThemeComment(): Plugin {
117415
+ return {
117416
+ name: 'fix-smartstack-theme-comment',
117417
+ enforce: 'pre',
117418
+ async load(id) {
117419
+ const normalized = id.split('?')[0].replace(/\\\\/g, '/');
117420
+ if (!normalized.endsWith('@atlashub/smartstack/dist/theme.css')) return null;
117421
+ const content = await readFile(normalized, 'utf-8');
117422
+ return content.replace(/\\*\\*\\/\\*\\.js/g, '** /*.js');
117423
+ },
117424
+ };
117425
+ }
117426
+
117410
117427
  export default defineConfig(({ mode }) => {
117411
117428
  const env = loadEnv(mode, process.cwd(), '');
117412
117429
 
@@ -117416,7 +117433,7 @@ export default defineConfig(({ mode }) => {
117416
117433
  const port = parseInt(env.VITE_PORT || '3000', 10);
117417
117434
 
117418
117435
  return {
117419
- plugins: [react(), tailwindcss()],
117436
+ plugins: [react(), fixSmartstackThemeComment(), tailwindcss()],
117420
117437
  server: {
117421
117438
  port,
117422
117439
  proxy: {
@@ -117511,7 +117528,6 @@ export default defineConfig(({ mode }) => {
117511
117528
  import { createRoot } from 'react-dom/client';
117512
117529
  import { BrowserRouter } from 'react-router-dom';
117513
117530
  import { SmartStackProvider } from '@atlashub/smartstack';
117514
- import '@atlashub/smartstack/styles.css';
117515
117531
  import './extensions/componentRegistry.generated';
117516
117532
  import App from './App';
117517
117533
  import './index.css';
@@ -117575,9 +117591,10 @@ import { PageRegistry } from '@atlashub/smartstack';
117575
117591
  const registry_result = await safeWriteFile((0, import_path7.join)(webDir, "src", "extensions", "componentRegistry.generated.ts"), componentRegistryTs, findKnownHash(state, "frontend", registry_relPath));
117576
117592
  logSafeWriteResult(registry_relPath, registry_result);
117577
117593
  recordFile(state, "frontend", registry_relPath, registry_result.hash);
117594
+ logger.info(`Stub componentRegistry created. Run ${source_default.cyan("scaffold_routes")} (MCP) in Claude Code to register all built-in + custom pages \u2014 required to avoid MISSING_PAGE errors at runtime.`);
117578
117595
  const indexCss = `@import "tailwindcss";
117596
+ @import "@atlashub/smartstack/theme.css";
117579
117597
  @source "../node_modules/@atlashub/smartstack/dist/**/*.js";
117580
- @custom-variant dark (&:where(.dark, .dark *));
117581
117598
  `;
117582
117599
  const css_relPath = `${webRelPrefix}/src/index.css`;
117583
117600
  const css_result = await safeWriteFile((0, import_path7.join)(webDir, "src", "index.css"), indexCss, findKnownHash(state, "frontend", css_relPath));
@@ -118295,10 +118312,87 @@ var appTsxRetroactiveMigration = {
118295
118312
  ]
118296
118313
  };
118297
118314
 
118315
+ // src/migrations/index-css-tailwind-v4-migration.ts
118316
+ var CANONICAL_INDEX_CSS = `@import "tailwindcss";
118317
+ @import "@atlashub/smartstack/theme.css";
118318
+ @source "../node_modules/@atlashub/smartstack/dist/**/*.js";
118319
+ `;
118320
+ var VITE_PLUGIN_HELPER = `import { readFile } from 'node:fs/promises';
118321
+ import tailwindcss from '@tailwindcss/vite';
118322
+
118323
+ // Upstream workaround: @atlashub/smartstack's theme.css contains a comment
118324
+ // with the pattern \`**/*.js\` whose \`*/\` closes the comment early and breaks
118325
+ // Tailwind v4's CSS parser ("Unterminated string: ';'"). Rewrite on load.
118326
+ function fixSmartstackThemeComment() {
118327
+ return {
118328
+ name: 'fix-smartstack-theme-comment',
118329
+ enforce: 'pre',
118330
+ async load(id) {
118331
+ const normalized = id.split('?')[0].replace(/\\\\/g, '/');
118332
+ if (!normalized.endsWith('@atlashub/smartstack/dist/theme.css')) return null;
118333
+ const content = await readFile(normalized, 'utf-8');
118334
+ return content.replace(/\\*\\*\\/\\*\\.js/g, '** /*.js');
118335
+ },
118336
+ };
118337
+ }`;
118338
+ var indexCssTailwindV4Migration = {
118339
+ fromVersion: "1.0.0",
118340
+ toVersion: "4.81.0",
118341
+ description: "Fix index.css/main.tsx/vite.config.ts for Tailwind v4 + SmartStack theme.css upstream bug",
118342
+ migrations: [
118343
+ {
118344
+ pattern: "**/web/**/src/index.css",
118345
+ description: "Rewrite index.css to canonical 3-line form (imports tailwindcss + theme.css, scans package bundle)",
118346
+ detect: (content) => {
118347
+ const hasTailwind = content.includes('@import "tailwindcss"');
118348
+ if (!hasTailwind) return false;
118349
+ return content.trim() !== CANONICAL_INDEX_CSS.trim();
118350
+ },
118351
+ transform: () => CANONICAL_INDEX_CSS
118352
+ },
118353
+ {
118354
+ pattern: "**/web/**/src/main.tsx",
118355
+ description: "Remove invalid @atlashub/smartstack/styles.css import (export does not exist)",
118356
+ detect: (content) => {
118357
+ return /import\s+['"]@atlashub\/smartstack\/styles\.css['"];?\s*$/m.test(content);
118358
+ },
118359
+ transform: (content) => {
118360
+ return content.replace(/^import\s+['"]@atlashub\/smartstack\/styles\.css['"];?\s*\r?\n/m, "");
118361
+ }
118362
+ },
118363
+ {
118364
+ pattern: "**/web/**/vite.config.ts",
118365
+ description: "Inject fixSmartstackThemeComment plugin to neutralize theme.css upstream comment bug",
118366
+ detect: (content) => {
118367
+ const usesTailwindVite = content.includes("@tailwindcss/vite");
118368
+ const hasFix = content.includes("fixSmartstackThemeComment");
118369
+ return usesTailwindVite && !hasFix;
118370
+ },
118371
+ transform: (content) => {
118372
+ let updated = content;
118373
+ if (!updated.includes("fixSmartstackThemeComment")) {
118374
+ updated = updated.replace(
118375
+ /import\s+tailwindcss\s+from\s+['"]@tailwindcss\/vite['"];?\s*\r?\n/,
118376
+ `${VITE_PLUGIN_HELPER}
118377
+
118378
+ `
118379
+ );
118380
+ }
118381
+ updated = updated.replace(
118382
+ /plugins:\s*\[\s*react\(\)\s*,\s*tailwindcss\(\)\s*\]/,
118383
+ "plugins: [react(), fixSmartstackThemeComment(), tailwindcss()]"
118384
+ );
118385
+ return updated;
118386
+ }
118387
+ }
118388
+ ]
118389
+ };
118390
+
118298
118391
  // src/migrations/registry.ts
118299
118392
  var migrations = [
118300
118393
  appTsxRetroactiveMigration,
118301
- appTsxMigration_v2_0_0_preview_381
118394
+ appTsxMigration_v2_0_0_preview_381,
118395
+ indexCssTailwindV4Migration
118302
118396
  ];
118303
118397
  function compareVersions(a, b) {
118304
118398
  const cleanA = a.replace(/^v/, "");
@@ -125283,16 +125377,24 @@ async function executeMigrations(projectDir, fromVersion, toVersion, dryRun) {
125283
125377
  });
125284
125378
  continue;
125285
125379
  }
125380
+ let actuallyApplied = true;
125286
125381
  if (!dryRun) {
125287
125382
  const transformed = fileMigration.transform(content, file);
125288
- await import_fs_extra7.default.writeFile(file, transformed, "utf-8");
125383
+ if (transformed === content) {
125384
+ actuallyApplied = false;
125385
+ } else {
125386
+ await import_fs_extra7.default.copyFile(file, `${file}.bak`);
125387
+ await import_fs_extra7.default.writeFile(file, transformed, "utf-8");
125388
+ }
125289
125389
  }
125290
125390
  results.push({
125291
125391
  filePath: file.replace(projectDir, "").replace(/^[/\\]/, ""),
125292
- applied: true,
125293
- description: fileMigration.description
125392
+ applied: actuallyApplied,
125393
+ description: actuallyApplied ? fileMigration.description : "No content changes"
125294
125394
  });
125295
- logger.success(`${dryRun ? "[DRY RUN] Would migrate" : "Migrated"}: ${file.replace(projectDir, "").replace(/^[/\\]/, "")}`);
125395
+ if (actuallyApplied) {
125396
+ logger.success(`${dryRun ? "[DRY RUN] Would migrate" : "Migrated"}: ${file.replace(projectDir, "").replace(/^[/\\]/, "")}`);
125397
+ }
125296
125398
  } catch (error) {
125297
125399
  const errorMessage = error instanceof Error ? error.message : String(error);
125298
125400
  results.push({
@@ -125804,6 +125906,12 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125804
125906
  logger.info("No code migrations needed.");
125805
125907
  console.log();
125806
125908
  }
125909
+ if (frontendDir && npmVersion) {
125910
+ logger.warning(
125911
+ `[ACTION REQUIRED] Run ${source_default.cyan("scaffold_routes")} (MCP) in Claude Code to regenerate componentRegistry.generated.ts with all built-in pages from @atlashub/smartstack@${npmVersion}. Skipping this step may cause MISSING_PAGE errors at runtime (e.g. MISSING_PAGE/administration.users).`
125912
+ );
125913
+ console.log();
125914
+ }
125807
125915
  logger.info("Syncing appsettings.json...");
125808
125916
  const addedKeys = await syncAppSettings(projectDir, config.baseNamespace, dryRun);
125809
125917
  result.configSynced = addedKeys.length;