@atlashub/smartstack-cli 4.11.0 → 4.13.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.
@@ -26100,7 +26100,7 @@ var init_types3 = __esm({
26100
26100
  includeLayouts: external_exports.boolean().default(true).describe("Generate layout components"),
26101
26101
  includeGuards: external_exports.boolean().default(true).describe("Include route guards for permissions"),
26102
26102
  generateRegistry: external_exports.boolean().default(true).describe("Generate navRoutes.generated.ts"),
26103
- outputFormat: external_exports.enum(["standalone", "applicationRoutes", "clientRoutes"]).default("standalone").describe('Output format: "standalone" generates createBrowserRouter(), "applicationRoutes" generates exportable RouteObject[] arrays for App.tsx integration (note: "clientRoutes" is a deprecated alias for "applicationRoutes")'),
26103
+ outputFormat: external_exports.enum(["standalone", "applicationRoutes", "clientRoutes"]).default("applicationRoutes").describe('Output format: "standalone" generates createBrowserRouter(), "applicationRoutes" generates exportable RouteObject[] arrays for App.tsx integration (note: "clientRoutes" is a deprecated alias for "applicationRoutes")'),
26104
26104
  dryRun: external_exports.boolean().default(false).describe("Preview without writing files")
26105
26105
  }).optional()
26106
26106
  });
@@ -57807,7 +57807,7 @@ async function scaffoldRoutes(input, config2) {
57807
57807
  }
57808
57808
  result.files.push({ path: registryFile, content: registryContent, type: "created" });
57809
57809
  }
57810
- const outputFormat = options?.outputFormat ?? "standalone";
57810
+ const outputFormat = options?.outputFormat ?? "applicationRoutes";
57811
57811
  if (outputFormat === "applicationRoutes" || outputFormat === "clientRoutes") {
57812
57812
  const pageFiles = await discoverPageFiles(webPath, navRoutes);
57813
57813
  const applicationRoutesContent = generateApplicationRoutesConfig(navRoutes, pageFiles, includeGuards);
@@ -57865,7 +57865,7 @@ async function scaffoldRoutes(input, config2) {
57865
57865
  result.instructions.push("");
57866
57866
  result.instructions.push("const applicationRoutes = {");
57867
57867
  for (const [app, modules] of Object.entries(routeTree)) {
57868
- result.instructions.push(` '${app}': [`);
57868
+ result.instructions.push(` '${toKebabCase(app)}': [`);
57869
57869
  for (const [, moduleRoutes] of Object.entries(modules)) {
57870
57870
  for (const route of moduleRoutes) {
57871
57871
  const modulePath = route.navRoute.split(".").slice(1).map(toKebabCase).join("/");
@@ -57896,7 +57896,7 @@ async function scaffoldRoutes(input, config2) {
57896
57896
  result.instructions.push("");
57897
57897
  for (const [app, modules] of Object.entries(routeTree)) {
57898
57898
  const layoutName = getLayoutName(app);
57899
- result.instructions.push(`#### ${capitalize(app)} application (inside \`<Route path="/${app}" element={<${layoutName} />}>\`):`);
57899
+ result.instructions.push(`#### ${capitalize(app)} application (inside \`<Route path="/${toKebabCase(app)}" element={<${layoutName} />}>\`):`);
57900
57900
  result.instructions.push("");
57901
57901
  result.instructions.push("```tsx");
57902
57902
  for (const [, moduleRoutes] of Object.entries(modules)) {
@@ -58438,13 +58438,15 @@ function generateApplicationRoutesConfig(routes, pageFiles, includeGuards) {
58438
58438
  }
58439
58439
  lines.push("");
58440
58440
  for (const [app, modules] of Object.entries(routeTree)) {
58441
- const appUpper = capitalize(app);
58441
+ const appCamel = toCamelCase2(app);
58442
+ const appKebab = toKebabCase(app);
58443
+ const appUpper = capitalize(appCamel);
58442
58444
  const layoutName = getLayoutName(app);
58443
58445
  lines.push("/**");
58444
58446
  lines.push(` * Routes for ${appUpper} application`);
58445
- lines.push(` * Flat routes for mergeRoutes() \u2014 children of <Route path="/${app}" element={<${layoutName} />}>`);
58447
+ lines.push(` * Flat routes for mergeRoutes() \u2014 children of <Route path="/${appKebab}" element={<${layoutName} />}>`);
58446
58448
  lines.push(" */");
58447
- lines.push(`export const ${app}Routes: RouteObject[] = [`);
58449
+ lines.push(`export const ${appCamel}Routes: RouteObject[] = [`);
58448
58450
  for (const [, moduleRoutes] of Object.entries(modules)) {
58449
58451
  for (const route of moduleRoutes) {
58450
58452
  const modulePath = route.navRoute.split(".").slice(1).map(toKebabCase).join("/");
@@ -58512,9 +58514,11 @@ function generateApplicationRoutesConfig(routes, pageFiles, includeGuards) {
58512
58514
  }
58513
58515
  const appKeys = Object.keys(routeTree);
58514
58516
  lines.push("/** All generated routes grouped by application */");
58515
- lines.push("export const generatedRoutes = {");
58517
+ lines.push("export const generatedRoutes: Record<string, RouteObject[]> = {");
58516
58518
  for (const app of appKeys) {
58517
- lines.push(` ${app}: ${app}Routes,`);
58519
+ const appCamel = toCamelCase2(app);
58520
+ const appKebab = toKebabCase(app);
58521
+ lines.push(` '${appKebab}': ${appCamel}Routes,`);
58518
58522
  }
58519
58523
  lines.push("};");
58520
58524
  lines.push("");
@@ -58532,7 +58536,9 @@ function generateApplicationRoutesConfig(routes, pageFiles, includeGuards) {
58532
58536
  lines.push(" */");
58533
58537
  lines.push("export const applicationRouteExtensions: Record<string, RouteObject[]> = {");
58534
58538
  for (const app of appKeys) {
58535
- lines.push(` ${app}: ${app}Routes,`);
58539
+ const appCamel = toCamelCase2(app);
58540
+ const appKebab = toKebabCase(app);
58541
+ lines.push(` '${appKebab}': ${appCamel}Routes,`);
58536
58542
  }
58537
58543
  lines.push("};");
58538
58544
  lines.push("");
@@ -58544,6 +58550,9 @@ function getLayoutName(_application) {
58544
58550
  function toKebabCase(segment) {
58545
58551
  return segment.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
58546
58552
  }
58553
+ function toCamelCase2(segment) {
58554
+ return segment.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
58555
+ }
58547
58556
  function navRouteToUrlPath(navRoute) {
58548
58557
  return navRoute.split(".").map(toKebabCase).join("/");
58549
58558
  }
@@ -58647,7 +58656,7 @@ and generates corresponding frontend routing infrastructure.`,
58647
58656
  includeLayouts: { type: "boolean", default: true },
58648
58657
  includeGuards: { type: "boolean", default: true },
58649
58658
  generateRegistry: { type: "boolean", default: true },
58650
- outputFormat: { type: "string", enum: ["standalone", "applicationRoutes", "clientRoutes"], default: "standalone", description: "standalone: createBrowserRouter(), applicationRoutes: RouteObject[] arrays for App.tsx (clientRoutes is a deprecated alias)" },
58659
+ outputFormat: { type: "string", enum: ["standalone", "applicationRoutes", "clientRoutes"], default: "applicationRoutes", description: "standalone: createBrowserRouter(), applicationRoutes: RouteObject[] arrays for App.tsx (clientRoutes is a deprecated alias)" },
58651
58660
  dryRun: { type: "boolean", default: false }
58652
58661
  }
58653
58662
  }