@devstroupe/devkit-cli 1.1.12 → 1.1.14

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -293,9 +293,11 @@ function ensureOfficialSpartanTheme(frontendRoot, theme = 'neutral') {
293
293
  if (/--radius\s*:/.test(currentStyles) && /--sidebar-background|--sidebar\s*:/.test(currentStyles)) {
294
294
  return;
295
295
  }
296
+ const officialThemes = ['gray', 'neutral', 'slate', 'stone', 'zinc'];
297
+ const resolvedTheme = officialThemes.includes(theme) ? theme : 'neutral';
296
298
  const ng = getPackageManagerCommand(frontendRoot);
297
- console.log(`[Spartan] Aplicando tema oficial "${theme}"...`);
298
- (0, child_process_1.execSync)(`${ng} g @spartan-ng/cli:ui-theme --theme=${theme} --defaults`, {
299
+ console.log(`[Spartan] Aplicando tema oficial "${resolvedTheme}" (solicitado: "${theme}")...`);
300
+ (0, child_process_1.execSync)(`${ng} g @spartan-ng/cli:ui-theme --theme=${resolvedTheme} --defaults`, {
299
301
  cwd: frontendRoot,
300
302
  stdio: 'inherit'
301
303
  });
@@ -557,12 +559,38 @@ function initUi(frontendRoot, config) {
557
559
  fs.writeFileSync(path.join(profileDir, 'profile.component.ts'), prf.ts, 'utf-8');
558
560
  fs.writeFileSync(path.join(profileDir, 'profile.component.html'), prf.html, 'utf-8');
559
561
  fs.writeFileSync(path.join(profileDir, 'profile.component.css'), prf.css, 'utf-8');
562
+ // 20. Escrever devkit.css contendo o tema de cores dinâmico
563
+ const themeCss = (0, ui_templates_1.devkitThemeCssTemplate)({
564
+ preset: config.designSystem?.spartanStyle,
565
+ theme: config.designSystem?.spartanTheme === 'custom' ? 'custom' : config.designSystem?.spartanTheme,
566
+ primaryColor: config.designSystem?.primaryColor,
567
+ secondaryColor: config.designSystem?.secondaryColor,
568
+ fontFamily: config.designSystem?.fontFamily
569
+ });
570
+ fs.writeFileSync(path.join(targetDir, 'devkit.css'), themeCss, 'utf-8');
571
+ console.log(`[UI] Tema de cores gerado com sucesso em: ${path.join(targetDir, 'devkit.css')}`);
572
+ // 21. Garantir import do devkit.css no styles.css/styles.scss
573
+ ensureDevkitCssImport(frontendRoot);
560
574
  console.log(`[UI] Componentes DevKit, layout, Playground, ThemeService, ProfileService e ProfileComponent gerados com Spartan style="${spartanStyle}".`);
561
575
  // Configurar tsconfig.json
562
576
  ensureTsconfigPaths(frontendRoot);
563
577
  // Atualizar roteamento para suportar MainLayoutComponent
564
578
  updateAppRoutes(frontendRoot, config);
565
579
  }
580
+ function ensureDevkitCssImport(frontendRoot) {
581
+ const stylesPath = [
582
+ path.join(frontendRoot, 'src', 'styles.css'),
583
+ path.join(frontendRoot, 'src', 'styles.scss')
584
+ ].find((candidate) => fs.existsSync(candidate));
585
+ if (!stylesPath)
586
+ return;
587
+ let content = fs.readFileSync(stylesPath, 'utf-8');
588
+ if (!content.includes('devkit.css')) {
589
+ content += '\n@import "./app/shared/components/devkit/devkit.css";\n';
590
+ fs.writeFileSync(stylesPath, content, 'utf-8');
591
+ console.log('[UI] @import do devkit.css adicionado ao arquivo de estilos principal.');
592
+ }
593
+ }
566
594
  function getEntityRoutePath(entityName, config) {
567
595
  const navigation = config.layout?.navigation;
568
596
  if (!Array.isArray(navigation)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devstroupe/devkit-cli",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "DevsTroupe Development Kit CLI — scaffold NestJS+Angular projects, inject Spartan UI, generate CRUDs and audit architectural governance",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "commander": "^12.0.0",
38
38
  "fs-extra": "^11.2.0",
39
- "@devstroupe/devkit-core": "1.1.12"
39
+ "@devstroupe/devkit-core": "1.1.14"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/fs-extra": "^11.0.4",