@nuvler/cli 0.4.1 → 0.4.2
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/README.md +25 -2
- package/dist/commands/theme/create.js +1 -1
- package/dist/commands/theme/validate.js +21 -0
- package/dist/commands/theme/validate.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/nuvler.js +156 -4
- package/dist/nuvler.js.map +1 -1
- package/dist/templates/nuvler-atelier/package.json +1 -1
- package/dist/templates/nuvler-default/README.md +50 -4
- package/dist/templates/nuvler-default/package.json +34 -2
- package/dist/templates/nuvler-default/src/banner-carousel.tsx +42 -12
- package/dist/templates/nuvler-default/src/carousel-frame.tsx +58 -0
- package/dist/templates/nuvler-default/src/definition.ts +9 -59
- package/dist/templates/nuvler-default/src/footer.tsx +7 -2
- package/dist/templates/nuvler-default/src/header-interactions.tsx +1 -1
- package/dist/templates/nuvler-default/src/header.tsx +3 -3
- package/dist/templates/nuvler-default/src/home.tsx +41 -17
- package/dist/templates/nuvler-default/src/index.ts +1 -0
- package/dist/templates/nuvler-default/src/product-carousel.tsx +13 -7
- package/dist/templates/nuvler-default/src/product-detail-interactive.tsx +230 -0
- package/dist/templates/nuvler-default/src/product-detail.tsx +80 -55
- package/dist/templates/nuvler-default/src/products.tsx +6 -5
- package/dist/templates/nuvler-default/src/server-shell.tsx +88 -0
- package/dist/templates/nuvler-default/src/shared.tsx +25 -9
- package/dist/templates/nuvler-default/src/theme-config.ts +63 -0
- package/dist/templates/nuvler-default/src/theme.css +21 -1
- package/dist/templates/starter/package.json +1 -1
- package/dist/theme/performance.js +126 -0
- package/dist/theme/performance.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -190,12 +190,34 @@ ao preview host nem às requisições públicas.
|
|
|
190
190
|
### `nuvler theme validate`
|
|
191
191
|
|
|
192
192
|
Valida `nuvler.theme.json`, compatibilidade do SDK/runtime, entrada e estilos.
|
|
193
|
+
Também exibe um performance budget informativo para CSS, JavaScript client,
|
|
194
|
+
imagens, fontes e módulos marcados com `"use client"`.
|
|
193
195
|
|
|
194
196
|
```bash
|
|
195
197
|
nuvler theme validate
|
|
196
198
|
nuvler theme validate --theme ./meu-tema
|
|
197
199
|
```
|
|
198
200
|
|
|
201
|
+
Limites iniciais:
|
|
202
|
+
|
|
203
|
+
| Métrica | Budget |
|
|
204
|
+
| --- | ---: |
|
|
205
|
+
| CSS compactado com gzip | 50 KiB |
|
|
206
|
+
| `dist/theme.js` compactado com gzip | 120 KiB |
|
|
207
|
+
| Imagens do projeto, total | 5 MiB |
|
|
208
|
+
| Maior imagem individual | 512 KiB |
|
|
209
|
+
| Fontes do projeto, total | 400 KiB |
|
|
210
|
+
| Arquivos de fonte | 4 |
|
|
211
|
+
| Módulos `"use client"` | 8 |
|
|
212
|
+
|
|
213
|
+
O JavaScript só é medido quando `dist/theme.js` existe; execute
|
|
214
|
+
`nuvler theme build` antes de `validate` para obter essa métrica. Diretórios de
|
|
215
|
+
build, dependências e artefatos são ignorados ao contar os arquivos-fonte.
|
|
216
|
+
|
|
217
|
+
Nesta versão, exceder o budget gera `⚠`, mas não muda o exit code e não bloqueia
|
|
218
|
+
a publicação. Erros de manifesto, SDK, runtime ou arquivos obrigatórios
|
|
219
|
+
continuam bloqueantes.
|
|
220
|
+
|
|
199
221
|
### `nuvler theme build`
|
|
200
222
|
|
|
201
223
|
Valida e compila o tema para produção em `dist/`.
|
|
@@ -286,5 +308,6 @@ Um tema criado pela CLI recebe estes atalhos:
|
|
|
286
308
|
| `npm run pack` | `nuvler theme pack --theme .` |
|
|
287
309
|
| `npm run publish` | `nuvler theme publish --theme .` |
|
|
288
310
|
|
|
289
|
-
|
|
290
|
-
|
|
311
|
+
Temas externos são publicados no Theme Registry como `.nuvler-theme.tgz`. O
|
|
312
|
+
tema oficial `@nuvler/theme-default` também possui uma distribuição npm,
|
|
313
|
+
instalada no build do Store para o fallback renderizado no servidor.
|
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
const THEME_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
6
6
|
const NEW_THEME_VERSION = "0.1.0";
|
|
7
|
-
const CLI_VERSION_RANGE = "^0.4.
|
|
7
|
+
const CLI_VERSION_RANGE = "^0.4.2";
|
|
8
8
|
const SDK_VERSION_RANGE = "^1.2.0";
|
|
9
9
|
export const THEME_TEMPLATES = [
|
|
10
10
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { THEME_API_VERSION } from "@nuvler/theme-sdk";
|
|
2
2
|
import { loadThemeProject } from "../../theme/project.js";
|
|
3
|
+
import { analyzeThemePerformance, formatPerformanceValue, } from "../../theme/performance.js";
|
|
3
4
|
export async function themeValidate(options) {
|
|
4
5
|
const project = await loadThemeProject(options.themeDirectory);
|
|
6
|
+
const performance = await analyzeThemePerformance(project);
|
|
5
7
|
console.log("");
|
|
6
8
|
console.log("✓ Manifesto válido");
|
|
7
9
|
console.log(`✓ Tema: ${project.manifest.name} (${project.manifest.id})`);
|
|
@@ -11,5 +13,24 @@ export async function themeValidate(options) {
|
|
|
11
13
|
console.log(`✓ Entrada: ${project.manifest.entry}`);
|
|
12
14
|
console.log(`✓ Estilos: ${project.stylePaths.length}`);
|
|
13
15
|
console.log("");
|
|
16
|
+
console.log("Performance (informativo)");
|
|
17
|
+
for (const metric of performance.metrics) {
|
|
18
|
+
if (!metric.available) {
|
|
19
|
+
console.log(`○ ${metric.label}: não medido (${metric.detail})`);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const marker = metric.value > metric.limit ? "⚠" : "✓";
|
|
23
|
+
const details = metric.detail ? ` · ${metric.detail}` : "";
|
|
24
|
+
const limit = formatPerformanceValue({ ...metric, value: metric.limit });
|
|
25
|
+
console.log(`${marker} ${metric.label}: ${formatPerformanceValue(metric)} / ${limit}${details}`);
|
|
26
|
+
}
|
|
27
|
+
if (performance.warnings.length) {
|
|
28
|
+
console.log(`⚠ ${performance.warnings.length} limite(s) excedido(s); publicação ainda não é bloqueada.`);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.log("✓ Performance dentro do budget medido.");
|
|
32
|
+
}
|
|
33
|
+
console.log("");
|
|
34
|
+
return performance;
|
|
14
35
|
}
|
|
15
36
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/theme/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/commands/theme/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAmC;IAEnC,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAE3D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,QAAQ,CAAC,UAAU,SAAS,iBAAiB,GAAG,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK,iBAAiB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YAChE,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAG,sBAAsB,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,sBAAsB,CAAC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IACD,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,QAAQ,CAAC,MAAM,2DAA2D,CAAC,CAAC;IAC3G,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/nuvler.js
CHANGED
|
@@ -14,6 +14,7 @@ import os, { tmpdir } from "node:os";
|
|
|
14
14
|
import { spawn } from "node:child_process";
|
|
15
15
|
import { create } from "tar";
|
|
16
16
|
import ts from "typescript";
|
|
17
|
+
import { gzipSync } from "node:zlib";
|
|
17
18
|
//#region \0rolldown/runtime.js
|
|
18
19
|
var __defProp = Object.defineProperty;
|
|
19
20
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -29,7 +30,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
29
30
|
//#region src/commands/theme/create.ts
|
|
30
31
|
var THEME_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
31
32
|
var NEW_THEME_VERSION = "0.1.0";
|
|
32
|
-
var CLI_VERSION_RANGE = "^0.4.
|
|
33
|
+
var CLI_VERSION_RANGE = "^0.4.2";
|
|
33
34
|
var SDK_VERSION_RANGE = "^1.2.0";
|
|
34
35
|
var THEME_TEMPLATES = [
|
|
35
36
|
{
|
|
@@ -7901,7 +7902,7 @@ async function themePublish(options) {
|
|
|
7901
7902
|
}
|
|
7902
7903
|
//#endregion
|
|
7903
7904
|
//#region src/migrate/analyzer.ts
|
|
7904
|
-
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
7905
|
+
var IGNORED_DIRECTORIES$1 = /* @__PURE__ */ new Set([
|
|
7905
7906
|
".git",
|
|
7906
7907
|
".next",
|
|
7907
7908
|
".nuxt",
|
|
@@ -7954,7 +7955,7 @@ async function walk(directory) {
|
|
|
7954
7955
|
const entries = await readdir(current, { withFileTypes: true });
|
|
7955
7956
|
for (const entry of entries) {
|
|
7956
7957
|
if (entry.isSymbolicLink()) continue;
|
|
7957
|
-
if (entry.isDirectory() && IGNORED_DIRECTORIES.has(entry.name)) continue;
|
|
7958
|
+
if (entry.isDirectory() && IGNORED_DIRECTORIES$1.has(entry.name)) continue;
|
|
7958
7959
|
const absolute = path.join(current, entry.name);
|
|
7959
7960
|
if (entry.isDirectory()) await visit(absolute);
|
|
7960
7961
|
else if (entry.isFile()) files.push(absolute);
|
|
@@ -9430,9 +9431,142 @@ async function themeMigrate(options) {
|
|
|
9430
9431
|
}
|
|
9431
9432
|
}
|
|
9432
9433
|
//#endregion
|
|
9434
|
+
//#region src/theme/performance.ts
|
|
9435
|
+
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
9436
|
+
".js",
|
|
9437
|
+
".jsx",
|
|
9438
|
+
".mjs",
|
|
9439
|
+
".cjs",
|
|
9440
|
+
".ts",
|
|
9441
|
+
".tsx"
|
|
9442
|
+
]);
|
|
9443
|
+
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
9444
|
+
".avif",
|
|
9445
|
+
".gif",
|
|
9446
|
+
".jpeg",
|
|
9447
|
+
".jpg",
|
|
9448
|
+
".png",
|
|
9449
|
+
".svg",
|
|
9450
|
+
".webp"
|
|
9451
|
+
]);
|
|
9452
|
+
var FONT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
9453
|
+
".eot",
|
|
9454
|
+
".otf",
|
|
9455
|
+
".ttf",
|
|
9456
|
+
".woff",
|
|
9457
|
+
".woff2"
|
|
9458
|
+
]);
|
|
9459
|
+
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
9460
|
+
".git",
|
|
9461
|
+
".nuvler",
|
|
9462
|
+
".next",
|
|
9463
|
+
".vite",
|
|
9464
|
+
"artifacts",
|
|
9465
|
+
"dist",
|
|
9466
|
+
"node_modules"
|
|
9467
|
+
]);
|
|
9468
|
+
var DEFAULT_THEME_PERFORMANCE_BUDGET = {
|
|
9469
|
+
cssGzipBytes: 51200,
|
|
9470
|
+
clientJavaScriptGzipBytes: 122880,
|
|
9471
|
+
imageTotalBytes: 5242880,
|
|
9472
|
+
imageMaxBytes: 524288,
|
|
9473
|
+
fontTotalBytes: 409600,
|
|
9474
|
+
fontFiles: 4,
|
|
9475
|
+
clientComponents: 8
|
|
9476
|
+
};
|
|
9477
|
+
async function listProjectFiles(directory) {
|
|
9478
|
+
const files = [];
|
|
9479
|
+
async function visit(currentDirectory) {
|
|
9480
|
+
const entries = await readdir(currentDirectory, { withFileTypes: true });
|
|
9481
|
+
await Promise.all(entries.map(async (entry) => {
|
|
9482
|
+
if (entry.isSymbolicLink()) return;
|
|
9483
|
+
const absolutePath = path.join(currentDirectory, entry.name);
|
|
9484
|
+
if (entry.isDirectory()) {
|
|
9485
|
+
if (!IGNORED_DIRECTORIES.has(entry.name)) await visit(absolutePath);
|
|
9486
|
+
return;
|
|
9487
|
+
}
|
|
9488
|
+
if (entry.isFile()) files.push(absolutePath);
|
|
9489
|
+
}));
|
|
9490
|
+
}
|
|
9491
|
+
await visit(directory);
|
|
9492
|
+
return files.sort();
|
|
9493
|
+
}
|
|
9494
|
+
function hasUseClientDirective(source, filePath) {
|
|
9495
|
+
const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, false, filePath.endsWith("x") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
9496
|
+
for (const statement of sourceFile.statements) {
|
|
9497
|
+
if (ts.isExpressionStatement(statement) && ts.isStringLiteral(statement.expression)) {
|
|
9498
|
+
if (statement.expression.text === "use client") return true;
|
|
9499
|
+
continue;
|
|
9500
|
+
}
|
|
9501
|
+
break;
|
|
9502
|
+
}
|
|
9503
|
+
return false;
|
|
9504
|
+
}
|
|
9505
|
+
async function totalSize(files) {
|
|
9506
|
+
return (await Promise.all(files.map(async (file) => (await stat(file)).size))).reduce((total, size) => total + size, 0);
|
|
9507
|
+
}
|
|
9508
|
+
async function gzipFiles(files) {
|
|
9509
|
+
if (!files.length) return 0;
|
|
9510
|
+
const contents = await Promise.all(files.map((file) => readFile(file)));
|
|
9511
|
+
return gzipSync(Buffer.concat(contents), { level: 9 }).byteLength;
|
|
9512
|
+
}
|
|
9513
|
+
function metric(key, label, value, unit, available = true, detail) {
|
|
9514
|
+
return {
|
|
9515
|
+
key,
|
|
9516
|
+
label,
|
|
9517
|
+
value,
|
|
9518
|
+
limit: DEFAULT_THEME_PERFORMANCE_BUDGET[key],
|
|
9519
|
+
unit,
|
|
9520
|
+
available,
|
|
9521
|
+
detail
|
|
9522
|
+
};
|
|
9523
|
+
}
|
|
9524
|
+
async function analyzeThemePerformance(project) {
|
|
9525
|
+
const projectFiles = await listProjectFiles(project.directory);
|
|
9526
|
+
const css = projectFiles.filter((file) => path.extname(file).toLowerCase() === ".css");
|
|
9527
|
+
const images = projectFiles.filter((file) => IMAGE_EXTENSIONS.has(path.extname(file).toLowerCase()));
|
|
9528
|
+
const fonts = projectFiles.filter((file) => FONT_EXTENSIONS.has(path.extname(file).toLowerCase()));
|
|
9529
|
+
const sourceFiles = projectFiles.filter((file) => SOURCE_EXTENSIONS.has(path.extname(file).toLowerCase()));
|
|
9530
|
+
const clientComponents = (await Promise.all(sourceFiles.map(async (file) => ({
|
|
9531
|
+
file,
|
|
9532
|
+
client: hasUseClientDirective(await readFile(file, "utf8"), file)
|
|
9533
|
+
})))).filter(({ client }) => client).map(({ file }) => file);
|
|
9534
|
+
const imageSizes = await Promise.all(images.map(async (file) => (await stat(file)).size));
|
|
9535
|
+
const clientBundle = path.join(project.directory, "dist", "theme.js");
|
|
9536
|
+
const hasClientBundle = await stat(clientBundle).then((details) => details.isFile()).catch(() => false);
|
|
9537
|
+
const clientJavaScriptGzipBytes = hasClientBundle ? gzipSync(await readFile(clientBundle), { level: 9 }).byteLength : 0;
|
|
9538
|
+
const metrics = [
|
|
9539
|
+
metric("cssGzipBytes", "CSS gzip", await gzipFiles(css), "bytes", true, `${css.length} arquivo(s)`),
|
|
9540
|
+
metric("clientJavaScriptGzipBytes", "JS client gzip", clientJavaScriptGzipBytes, "bytes", hasClientBundle, hasClientBundle ? "dist/theme.js" : "execute nuvler theme build para medir"),
|
|
9541
|
+
metric("imageTotalBytes", "Imagens (total)", imageSizes.reduce((total, size) => total + size, 0), "bytes", true, `${images.length} arquivo(s)`),
|
|
9542
|
+
metric("imageMaxBytes", "Maior imagem", Math.max(0, ...imageSizes), "bytes"),
|
|
9543
|
+
metric("fontTotalBytes", "Fontes (total)", await totalSize(fonts), "bytes", true, `${fonts.length} arquivo(s)`),
|
|
9544
|
+
metric("fontFiles", "Arquivos de fonte", fonts.length, "count"),
|
|
9545
|
+
metric("clientComponents", "Client Components", clientComponents.length, "count")
|
|
9546
|
+
];
|
|
9547
|
+
return {
|
|
9548
|
+
metrics,
|
|
9549
|
+
files: {
|
|
9550
|
+
css: css.map((file) => path.relative(project.directory, file)),
|
|
9551
|
+
images: images.map((file) => path.relative(project.directory, file)),
|
|
9552
|
+
fonts: fonts.map((file) => path.relative(project.directory, file)),
|
|
9553
|
+
clientComponents: clientComponents.map((file) => path.relative(project.directory, file)),
|
|
9554
|
+
clientBundle: hasClientBundle ? path.relative(project.directory, clientBundle) : void 0
|
|
9555
|
+
},
|
|
9556
|
+
warnings: metrics.filter(({ available, value, limit }) => available && value > limit)
|
|
9557
|
+
};
|
|
9558
|
+
}
|
|
9559
|
+
function formatPerformanceValue(metric) {
|
|
9560
|
+
if (metric.unit === "count") return String(metric.value);
|
|
9561
|
+
if (metric.value < 1024) return `${metric.value} B`;
|
|
9562
|
+
if (metric.value < 1048576) return `${(metric.value / 1024).toFixed(1)} KiB`;
|
|
9563
|
+
return `${(metric.value / 1024 / 1024).toFixed(2)} MiB`;
|
|
9564
|
+
}
|
|
9565
|
+
//#endregion
|
|
9433
9566
|
//#region src/commands/theme/validate.ts
|
|
9434
9567
|
async function themeValidate(options) {
|
|
9435
9568
|
const project = await loadThemeProject(options.themeDirectory);
|
|
9569
|
+
const performance = await analyzeThemePerformance(project);
|
|
9436
9570
|
console.log("");
|
|
9437
9571
|
console.log("✓ Manifesto válido");
|
|
9438
9572
|
console.log(`✓ Tema: ${project.manifest.name} (${project.manifest.id})`);
|
|
@@ -9442,6 +9576,24 @@ async function themeValidate(options) {
|
|
|
9442
9576
|
console.log(`✓ Entrada: ${project.manifest.entry}`);
|
|
9443
9577
|
console.log(`✓ Estilos: ${project.stylePaths.length}`);
|
|
9444
9578
|
console.log("");
|
|
9579
|
+
console.log("Performance (informativo)");
|
|
9580
|
+
for (const metric of performance.metrics) {
|
|
9581
|
+
if (!metric.available) {
|
|
9582
|
+
console.log(`○ ${metric.label}: não medido (${metric.detail})`);
|
|
9583
|
+
continue;
|
|
9584
|
+
}
|
|
9585
|
+
const marker = metric.value > metric.limit ? "⚠" : "✓";
|
|
9586
|
+
const details = metric.detail ? ` · ${metric.detail}` : "";
|
|
9587
|
+
const limit = formatPerformanceValue({
|
|
9588
|
+
...metric,
|
|
9589
|
+
value: metric.limit
|
|
9590
|
+
});
|
|
9591
|
+
console.log(`${marker} ${metric.label}: ${formatPerformanceValue(metric)} / ${limit}${details}`);
|
|
9592
|
+
}
|
|
9593
|
+
if (performance.warnings.length) console.log(`⚠ ${performance.warnings.length} limite(s) excedido(s); publicação ainda não é bloqueada.`);
|
|
9594
|
+
else console.log("✓ Performance dentro do budget medido.");
|
|
9595
|
+
console.log("");
|
|
9596
|
+
return performance;
|
|
9445
9597
|
}
|
|
9446
9598
|
//#endregion
|
|
9447
9599
|
//#region src/commands/auth.ts
|
|
@@ -9472,7 +9624,7 @@ async function authLogout() {
|
|
|
9472
9624
|
//#endregion
|
|
9473
9625
|
//#region src/index.ts
|
|
9474
9626
|
var program = new Command();
|
|
9475
|
-
program.name("nuvler").description("Nuvler Theme Development CLI").version("0.4.
|
|
9627
|
+
program.name("nuvler").description("Nuvler Theme Development CLI").version("0.4.2");
|
|
9476
9628
|
var theme = program.command("theme").description("Manage Nuvler themes");
|
|
9477
9629
|
var auth = program.command("auth").description("Manage developer authentication");
|
|
9478
9630
|
auth.command("login").requiredOption("--token <token>", "Developer token").option("--api-url <url>", "Nuvler API base URL (or use NUVLER_API_URL)").action(async (options) => {
|