viza 1.9.2 → 1.9.4
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/src/cli/options.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getGlobalOptions() {
|
|
2
2
|
return [
|
|
3
3
|
{ flags: "--status", description: "Show status only (no execution)" },
|
|
4
|
-
{ flags: "--remove-log", description: "Remove execution logs after completion" },
|
|
4
|
+
{ flags: "--remove-log", description: "Remove execution logs after completion", defaultValue: true },
|
|
5
5
|
{ flags: "--self-hosted", description: "Use self-hosted runner (viza-builder)" }
|
|
6
6
|
];
|
|
7
7
|
}
|
package/dist/src/cli/program.js
CHANGED
|
@@ -52,6 +52,7 @@ export async function createProgram() {
|
|
|
52
52
|
}
|
|
53
53
|
process.exit(1);
|
|
54
54
|
});
|
|
55
|
+
const argRegistry = new WeakMap();
|
|
55
56
|
const walk = (nodes, parent) => {
|
|
56
57
|
for (const node of nodes) {
|
|
57
58
|
const name = node.command.split(" ").pop(); // chỉ lấy tên cuối
|
|
@@ -62,15 +63,19 @@ export async function createProgram() {
|
|
|
62
63
|
sub.description(node.description || "");
|
|
63
64
|
parent.addCommand(sub);
|
|
64
65
|
}
|
|
66
|
+
if (!argRegistry.has(sub)) {
|
|
67
|
+
argRegistry.set(sub, new Set());
|
|
68
|
+
}
|
|
65
69
|
// Bind positional arguments from descriptor (must run even if sub already exists)
|
|
66
70
|
if (node.args?.length) {
|
|
67
71
|
for (const arg of node.args) {
|
|
68
72
|
const syntax = arg.required
|
|
69
73
|
? `<${arg.name}>`
|
|
70
74
|
: `[${arg.name}]`;
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
75
|
+
const registry = argRegistry.get(sub);
|
|
76
|
+
if (!registry.has(arg.name)) {
|
|
73
77
|
sub.argument(syntax, arg.description);
|
|
78
|
+
registry.add(arg.name);
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
}
|
|
@@ -29,7 +29,13 @@ function maybeRenderLog(result, policy, currentUser) {
|
|
|
29
29
|
const conclusion = result.conclusion;
|
|
30
30
|
const logOptions = {
|
|
31
31
|
conclusion,
|
|
32
|
-
...(currentUser !== undefined ? { currentUser } : {})
|
|
32
|
+
...(currentUser !== undefined ? { currentUser } : {}),
|
|
33
|
+
...(result.triggeredAt !== undefined ? { triggeredAt: result.triggeredAt } : {}),
|
|
34
|
+
...(result.startedAt !== undefined ? { startedAt: result.startedAt } : {}),
|
|
35
|
+
...(result.completedAt !== undefined ? { completedAt: result.completedAt } : {}),
|
|
36
|
+
...(result.queueDuration !== undefined ? { queueDuration: result.queueDuration } : {}),
|
|
37
|
+
...(result.runDuration !== undefined ? { runDuration: result.runDuration } : {}),
|
|
38
|
+
...(result.duration !== undefined ? { duration: result.duration } : {})
|
|
33
39
|
};
|
|
34
40
|
renderLog(result.logBuffer, logOptions);
|
|
35
41
|
return;
|
package/dist/src/ui/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// public exports (optional)
|
|
2
2
|
import { showBanner } from "./banner.js";
|
|
3
3
|
import { startSpinner, stopSpinner } from "./spinner.js";
|
|
4
|
-
import { renderLog } from "./infraLogRenderer.js";
|
|
5
4
|
export function beginUi(opts) {
|
|
6
5
|
if (opts.banner) {
|
|
7
6
|
showBanner(opts.banner);
|
|
@@ -17,6 +16,3 @@ export function endUi(session, opts) {
|
|
|
17
16
|
stopSpinner(session.spinner, opts?.finalMessage);
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
export function renderArtifactLog(buffer, conclusion) {
|
|
21
|
-
renderLog(buffer, { conclusion });
|
|
22
|
-
}
|
|
@@ -51,6 +51,38 @@ export function renderLog(zipBuffer, options) {
|
|
|
51
51
|
catch {
|
|
52
52
|
// ignore parsing errors
|
|
53
53
|
}
|
|
54
|
+
console.log(JSON.stringify(options, null, 2));
|
|
55
|
+
// Render timeline summary (if available)
|
|
56
|
+
if (options.startedAt || options.duration) {
|
|
57
|
+
const started = options.startedAt
|
|
58
|
+
? (() => {
|
|
59
|
+
try {
|
|
60
|
+
const d = new Date(options.startedAt);
|
|
61
|
+
const formatted = d.toLocaleString(undefined, {
|
|
62
|
+
weekday: "short",
|
|
63
|
+
year: "numeric",
|
|
64
|
+
month: "short",
|
|
65
|
+
day: "2-digit",
|
|
66
|
+
hour: "2-digit",
|
|
67
|
+
minute: "2-digit",
|
|
68
|
+
hour12: false
|
|
69
|
+
});
|
|
70
|
+
return chalk.yellow(formatted);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return chalk.yellow(options.startedAt);
|
|
74
|
+
}
|
|
75
|
+
})()
|
|
76
|
+
: chalk.gray("unknown");
|
|
77
|
+
const duration = options.duration
|
|
78
|
+
? chalk.yellow(options.duration)
|
|
79
|
+
: chalk.gray("unknown");
|
|
80
|
+
console.log(chalk.gray("\n\n────── ") +
|
|
81
|
+
chalk.gray("started:") + " " + started +
|
|
82
|
+
chalk.gray(" ────── ") +
|
|
83
|
+
chalk.gray("duration:") + " " + duration +
|
|
84
|
+
chalk.gray(" ─────────────────────────────────────────────────────────────"));
|
|
85
|
+
}
|
|
54
86
|
// Print final status banner
|
|
55
87
|
// Chuyển về lowercase ngay từ đầu, mặc định là "unknown" nếu undefined
|
|
56
88
|
const conclusion = (options.conclusion?.toString() || "unknown").toLowerCase();
|
|
@@ -61,7 +93,7 @@ export function renderLog(zipBuffer, options) {
|
|
|
61
93
|
color = chalk.redBright;
|
|
62
94
|
else
|
|
63
95
|
color = chalk.yellowBright;
|
|
64
|
-
console.log(color(`\n────── DEPLOY STATUS: ${String(conclusion).toUpperCase()}
|
|
96
|
+
console.log(color(`\n────── DEPLOY STATUS: ${String(conclusion).toUpperCase()} ────────────────────────────────────────────────────────────────────────────────────────────────\n`));
|
|
65
97
|
// Warn if the run was dispatched by someone else
|
|
66
98
|
if (detectedDispatcher &&
|
|
67
99
|
options.currentUser &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viza",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Viza unified command line interface",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"release:full": "rm -rf dist && npx npm-check-updates -u && npm install && git add package.json package-lock.json && git commit -m 'chore(deps): auto update dependencies before release' || echo 'No changes' && node versioning.js && npm login && npm publish --tag latest --access public && git push"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@vizamodo/viza-dispatcher": "^1.5.
|
|
25
|
+
"@vizamodo/viza-dispatcher": "^1.5.43",
|
|
26
26
|
"adm-zip": "^0.5.16",
|
|
27
27
|
"chalk": "^5.6.2",
|
|
28
28
|
"clipboardy": "^5.3.1",
|