@devstroupe/devkit-cli 1.2.0-beta.1 → 1.2.0-beta.3
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.
|
@@ -205,7 +205,9 @@ function assertCompiles(projectRoot) {
|
|
|
205
205
|
(0, node_test_1.default)('local package copies preserve runtime dependencies in Docker builds', () => {
|
|
206
206
|
const root = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'devkit-local-packages-'));
|
|
207
207
|
const backend = node_path_1.default.join(root, 'backend');
|
|
208
|
+
const frontend = node_path_1.default.join(root, 'frontend');
|
|
208
209
|
node_fs_1.default.mkdirSync(backend, { recursive: true });
|
|
210
|
+
node_fs_1.default.mkdirSync(frontend, { recursive: true });
|
|
209
211
|
node_fs_1.default.writeFileSync(node_path_1.default.join(backend, 'package.json'), JSON.stringify({
|
|
210
212
|
dependencies: {
|
|
211
213
|
'@devstroupe/devkit-core': 'workspace:*',
|
|
@@ -219,11 +221,28 @@ function assertCompiles(projectRoot) {
|
|
|
219
221
|
'RUN npm install --only=production && rm -rf local_packages/*/node_modules',
|
|
220
222
|
].join('\n'));
|
|
221
223
|
node_fs_1.default.writeFileSync(node_path_1.default.join(backend, 'tsconfig.json'), JSON.stringify({ compilerOptions: {} }));
|
|
222
|
-
|
|
223
|
-
|
|
224
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(frontend, 'package.json'), JSON.stringify({
|
|
225
|
+
dependencies: {
|
|
226
|
+
'@devstroupe/devkit-angular': 'workspace:*',
|
|
227
|
+
'@devstroupe/devkit-core': 'workspace:*',
|
|
228
|
+
},
|
|
229
|
+
}));
|
|
230
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(frontend, 'Dockerfile'), [
|
|
231
|
+
'FROM node:20-alpine',
|
|
232
|
+
'COPY package*.json ./',
|
|
233
|
+
'RUN npm install && rm -rf local_packages/*/node_modules',
|
|
234
|
+
].join('\n'));
|
|
235
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(frontend, 'tsconfig.json'), JSON.stringify({ compilerOptions: {} }));
|
|
236
|
+
(0, index_1.patchLocalDependencies)(backend, frontend, node_path_1.default.join(repositoryRoot, 'packages/devkit-cli/dist/boilerplates'));
|
|
237
|
+
(0, index_1.patchLocalDependencies)(backend, frontend, node_path_1.default.join(repositoryRoot, 'packages/devkit-cli/dist/boilerplates'));
|
|
224
238
|
const localNestPackage = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(backend, 'local_packages/devkit-nest/package.json'), 'utf8'));
|
|
225
239
|
const dockerfile = node_fs_1.default.readFileSync(node_path_1.default.join(backend, 'Dockerfile'), 'utf8');
|
|
240
|
+
const localRealtimeService = node_fs_1.default.readFileSync(node_path_1.default.join(frontend, 'local_packages/devkit-angular/dist/services/realtime.service.js'), 'utf8');
|
|
241
|
+
const localAngularPackage = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(frontend, 'local_packages/devkit-angular/package.json'), 'utf8'));
|
|
226
242
|
strict_1.default.equal(localNestPackage.dependencies['@devstroupe/devkit-core'], 'file:../devkit-core');
|
|
243
|
+
strict_1.default.equal(localAngularPackage.dependencies['@devstroupe/devkit-core'], 'file:../devkit-core');
|
|
244
|
+
strict_1.default.match(localRealtimeService, /ɵɵngDeclareInjectable|ɵɵdefineInjectable/);
|
|
245
|
+
strict_1.default.doesNotMatch(localRealtimeService, /__decorate/);
|
|
227
246
|
strict_1.default.ok(localNestPackage.dependencies['@aws-sdk/client-s3']);
|
|
228
247
|
strict_1.default.ok(localNestPackage.peerDependencies['@nestjs/core']);
|
|
229
248
|
strict_1.default.match(dockerfile, /COPY local_packages\/ \.\/local_packages\//);
|
package/dist/index.js
CHANGED
|
@@ -1347,6 +1347,23 @@ program
|
|
|
1347
1347
|
console.log(`\n\x1b[32m[SUCESSO] Scaffolding de CRUD completo para "${entitiesToGenerate[0].name}" finalizado!\x1b[0m`);
|
|
1348
1348
|
}
|
|
1349
1349
|
});
|
|
1350
|
+
function hasAngularPartialCompilation(packageRoot) {
|
|
1351
|
+
const realtimeOutput = path.join(packageRoot, 'dist', 'services', 'realtime.service.js');
|
|
1352
|
+
if (!fs.existsSync(realtimeOutput))
|
|
1353
|
+
return false;
|
|
1354
|
+
const content = fs.readFileSync(realtimeOutput, 'utf-8');
|
|
1355
|
+
return content.includes('ɵɵngDeclareInjectable') || content.includes('ɵɵdefineInjectable');
|
|
1356
|
+
}
|
|
1357
|
+
function ensureLocalAngularPackageBuilt(packageRoot) {
|
|
1358
|
+
if (hasAngularPartialCompilation(packageRoot))
|
|
1359
|
+
return;
|
|
1360
|
+
console.log('[DevConfig] Build Angular local ausente ou inválido; recompilando com ngc...');
|
|
1361
|
+
(0, child_process_1.execSync)('npm run build', { cwd: packageRoot, stdio: 'inherit' });
|
|
1362
|
+
if (!hasAngularPartialCompilation(packageRoot)) {
|
|
1363
|
+
throw new Error('O build local de @devstroupe/devkit-angular não contém metadados AOT/partial do Angular. '
|
|
1364
|
+
+ 'Execute o build com ngc antes de gerar o projeto.');
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1350
1367
|
// Helper para linkar dependências locais se estiver rodando no monorepo de desenvolvimento
|
|
1351
1368
|
function patchLocalDependencies(backendDest, frontendDest, boilerplatesDir) {
|
|
1352
1369
|
const packagesDir = path.resolve(boilerplatesDir, '../../..');
|
|
@@ -1403,6 +1420,9 @@ function patchLocalDependencies(backendDest, frontendDest, boilerplatesDir) {
|
|
|
1403
1420
|
const coreSrc = path.join(packagesDir, 'devkit-core');
|
|
1404
1421
|
const nestSrc = path.join(packagesDir, 'devkit-nest');
|
|
1405
1422
|
const angularSrc = path.join(packagesDir, 'devkit-angular');
|
|
1423
|
+
if (frontendDest && fs.existsSync(frontendDest) && fs.existsSync(angularSrc)) {
|
|
1424
|
+
ensureLocalAngularPackageBuilt(angularSrc);
|
|
1425
|
+
}
|
|
1406
1426
|
const stripDevelopmentDependencies = (packageDir) => {
|
|
1407
1427
|
const packagePath = path.join(packageDir, 'package.json');
|
|
1408
1428
|
if (!fs.existsSync(packagePath))
|
|
@@ -1414,7 +1434,7 @@ function patchLocalDependencies(backendDest, frontendDest, boilerplatesDir) {
|
|
|
1414
1434
|
};
|
|
1415
1435
|
const copyFilter = (src) => {
|
|
1416
1436
|
const relativePath = path.relative(packagesDir, src);
|
|
1417
|
-
const ignoreList = ['node_modules', '.git', '.angular', 'tsconfig.json', 'tsconfig.build.json', 'src', 'tests', 'test'];
|
|
1437
|
+
const ignoreList = ['node_modules', '.git', '.angular', 'dist-test', 'tsconfig.json', 'tsconfig.build.json', 'src', 'tests', 'test'];
|
|
1418
1438
|
const parts = relativePath.split(path.sep);
|
|
1419
1439
|
if (parts.length > 1) {
|
|
1420
1440
|
const subParts = parts.slice(1);
|
|
@@ -1433,13 +1453,13 @@ function patchLocalDependencies(backendDest, frontendDest, boilerplatesDir) {
|
|
|
1433
1453
|
const backendLocalPackages = path.join(backendDest, 'local_packages');
|
|
1434
1454
|
if (fs.existsSync(coreSrc)) {
|
|
1435
1455
|
const coreDest = path.join(backendLocalPackages, 'devkit-core');
|
|
1436
|
-
fs.
|
|
1456
|
+
fs.emptyDirSync(coreDest);
|
|
1437
1457
|
fs.copySync(coreSrc, coreDest, { filter: copyFilter });
|
|
1438
1458
|
stripDevelopmentDependencies(coreDest);
|
|
1439
1459
|
}
|
|
1440
1460
|
if (fs.existsSync(nestSrc)) {
|
|
1441
1461
|
const nestDest = path.join(backendLocalPackages, 'devkit-nest');
|
|
1442
|
-
fs.
|
|
1462
|
+
fs.emptyDirSync(nestDest);
|
|
1443
1463
|
fs.copySync(nestSrc, nestDest, { filter: copyFilter });
|
|
1444
1464
|
stripDevelopmentDependencies(nestDest);
|
|
1445
1465
|
// Correção de workspace:* para file:../devkit-core
|
|
@@ -1523,13 +1543,13 @@ function patchLocalDependencies(backendDest, frontendDest, boilerplatesDir) {
|
|
|
1523
1543
|
const frontendLocalPackages = path.join(frontendDest, 'local_packages');
|
|
1524
1544
|
if (fs.existsSync(coreSrc)) {
|
|
1525
1545
|
const coreDest = path.join(frontendLocalPackages, 'devkit-core');
|
|
1526
|
-
fs.
|
|
1546
|
+
fs.emptyDirSync(coreDest);
|
|
1527
1547
|
fs.copySync(coreSrc, coreDest, { filter: copyFilter });
|
|
1528
1548
|
stripDevelopmentDependencies(coreDest);
|
|
1529
1549
|
}
|
|
1530
1550
|
if (fs.existsSync(angularSrc)) {
|
|
1531
1551
|
const angularDest = path.join(frontendLocalPackages, 'devkit-angular');
|
|
1532
|
-
fs.
|
|
1552
|
+
fs.emptyDirSync(angularDest);
|
|
1533
1553
|
fs.copySync(angularSrc, angularDest, { filter: copyFilter });
|
|
1534
1554
|
stripDevelopmentDependencies(angularDest);
|
|
1535
1555
|
// Correção de workspace:* para file:../devkit-core
|
|
@@ -7,6 +7,7 @@ const strict_1 = __importDefault(require("node:assert/strict"));
|
|
|
7
7
|
const node_test_1 = require("node:test");
|
|
8
8
|
const nest_1 = require("./nest");
|
|
9
9
|
const functional_module_templates_1 = require("./nest/functional-module.templates");
|
|
10
|
+
const playground_template_1 = require("./ui/playground.template");
|
|
10
11
|
(0, node_test_1.describe)('backend generator characterization', () => {
|
|
11
12
|
(0, node_test_1.it)('keeps the monolith HTTP and Nest module contracts explicit', () => {
|
|
12
13
|
const controller = (0, nest_1.nestControllerTemplate)('order-item');
|
|
@@ -39,4 +40,9 @@ const functional_module_templates_1 = require("./nest/functional-module.template
|
|
|
39
40
|
strict_1.default.doesNotMatch(repository, /x-tenant-id/);
|
|
40
41
|
strict_1.default.doesNotMatch(repository, /REQUEST/);
|
|
41
42
|
});
|
|
43
|
+
(0, node_test_1.it)('creates playground dialogs through Spartan portals', () => {
|
|
44
|
+
const playground = (0, playground_template_1.devkitPlaygroundComponentTemplate)();
|
|
45
|
+
strict_1.default.match(playground.html, /<hlm-dialog-content \*hlmDialogPortal>/);
|
|
46
|
+
strict_1.default.match(playground.html, /<hlm-alert-dialog-content \*hlmAlertDialogPortal>/);
|
|
47
|
+
});
|
|
42
48
|
});
|
|
@@ -499,7 +499,7 @@ export class PlaygroundComponent implements OnInit {
|
|
|
499
499
|
<div class="rounded-xl border border-border bg-card p-6 flex flex-wrap gap-4">
|
|
500
500
|
<hlm-dialog>
|
|
501
501
|
<button hlmBtn hlmDialogTrigger>Abrir Dialog Padrão</button>
|
|
502
|
-
<hlm-dialog-content>
|
|
502
|
+
<hlm-dialog-content *hlmDialogPortal>
|
|
503
503
|
<hlm-dialog-header>
|
|
504
504
|
<h3 hlmDialogTitle>Editar Perfil</h3>
|
|
505
505
|
<p hlmDialogDescription>Faça alterações nas informações do seu perfil. Clique em salvar quando terminar.</p>
|
|
@@ -517,7 +517,7 @@ export class PlaygroundComponent implements OnInit {
|
|
|
517
517
|
|
|
518
518
|
<hlm-alert-dialog>
|
|
519
519
|
<button hlmBtn variant="secondary" hlmAlertDialogTrigger>Abrir Alert Dialog Crítico</button>
|
|
520
|
-
<hlm-alert-dialog-content>
|
|
520
|
+
<hlm-alert-dialog-content *hlmAlertDialogPortal>
|
|
521
521
|
<hlm-alert-dialog-header>
|
|
522
522
|
<h3 hlmAlertDialogTitle>Você tem certeza absoluta?</h3>
|
|
523
523
|
<p hlmAlertDialogDescription>Esta ação não pode ser desfeita. Isso excluirá permanentemente sua conta e removerá seus dados de nossos servidores.</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devstroupe/devkit-cli",
|
|
3
|
-
"version": "1.2.0-beta.
|
|
3
|
+
"version": "1.2.0-beta.3",
|
|
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.2.0-beta.
|
|
39
|
+
"@devstroupe/devkit-core": "1.2.0-beta.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/fs-extra": "^11.0.4",
|