@zenithbuild/cli 0.4.11 → 0.5.0-beta.2.15
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 +8 -0
- package/dist/build.js +1521 -0
- package/dist/dev-server.js +278 -0
- package/dist/index.js +175 -0
- package/dist/manifest.js +273 -0
- package/dist/preview.js +866 -0
- package/dist/resolve-components.js +490 -0
- package/dist/server/resolve-request-route.js +169 -0
- package/dist/server-contract.js +278 -0
- package/dist/types/generate-env-dts.js +52 -0
- package/dist/types/generate-routes-dts.js +22 -0
- package/dist/types/index.js +34 -0
- package/dist/ui/env.js +41 -0
- package/dist/ui/format.js +172 -0
- package/dist/ui/logger.js +105 -0
- package/package.json +21 -49
- package/bin/zen-build.ts +0 -2
- package/bin/zen-dev.ts +0 -2
- package/bin/zen-preview.ts +0 -2
- package/bin/zenith.ts +0 -2
- package/dist/zen-build.js +0 -9622
- package/dist/zen-dev.js +0 -9622
- package/dist/zen-preview.js +0 -9622
- package/dist/zenith.js +0 -9622
- package/src/commands/add.ts +0 -37
- package/src/commands/build.ts +0 -36
- package/src/commands/create.ts +0 -702
- package/src/commands/dev.ts +0 -472
- package/src/commands/index.ts +0 -112
- package/src/commands/preview.ts +0 -62
- package/src/commands/remove.ts +0 -33
- package/src/index.ts +0 -10
- package/src/main.ts +0 -101
- package/src/utils/branding.ts +0 -178
- package/src/utils/logger.ts +0 -52
- package/src/utils/plugin-manager.ts +0 -114
- package/src/utils/project.ts +0 -77
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { formatErrorBlock, formatHeading, formatStep, formatSummaryTable } from './format.js';
|
|
2
|
+
import { getUiMode } from './env.js';
|
|
3
|
+
|
|
4
|
+
const SPINNER_FRAMES = ['-', '\\', '|', '/'];
|
|
5
|
+
|
|
6
|
+
function write(out, text) {
|
|
7
|
+
out.write(`${text}\n`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function createSpinner(mode, stderr) {
|
|
11
|
+
if (!mode.spinner) {
|
|
12
|
+
return {
|
|
13
|
+
start() { },
|
|
14
|
+
update() { },
|
|
15
|
+
stop() { },
|
|
16
|
+
succeed() { },
|
|
17
|
+
fail() { }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let interval = null;
|
|
22
|
+
let frame = 0;
|
|
23
|
+
let message = '';
|
|
24
|
+
|
|
25
|
+
const paint = () => {
|
|
26
|
+
const current = SPINNER_FRAMES[frame % SPINNER_FRAMES.length];
|
|
27
|
+
stderr.write(`\r[zenith] ${current} ${message}`);
|
|
28
|
+
frame += 1;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const clear = () => {
|
|
32
|
+
stderr.write('\r');
|
|
33
|
+
stderr.write(' '.repeat(message.length + 12));
|
|
34
|
+
stderr.write('\r');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
start(nextMessage) {
|
|
39
|
+
message = String(nextMessage || '');
|
|
40
|
+
clearInterval(interval);
|
|
41
|
+
frame = 0;
|
|
42
|
+
paint();
|
|
43
|
+
interval = setInterval(paint, 80);
|
|
44
|
+
},
|
|
45
|
+
update(nextMessage) {
|
|
46
|
+
message = String(nextMessage || '');
|
|
47
|
+
},
|
|
48
|
+
stop() {
|
|
49
|
+
clearInterval(interval);
|
|
50
|
+
interval = null;
|
|
51
|
+
clear();
|
|
52
|
+
},
|
|
53
|
+
succeed(nextMessage) {
|
|
54
|
+
this.stop();
|
|
55
|
+
write(stderr, `[zenith] OK: ${nextMessage}`);
|
|
56
|
+
},
|
|
57
|
+
fail(nextMessage) {
|
|
58
|
+
this.stop();
|
|
59
|
+
write(stderr, `[zenith] ERROR: ${nextMessage}`);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {NodeJS.Process} runtime
|
|
66
|
+
*/
|
|
67
|
+
export function createLogger(runtime = process) {
|
|
68
|
+
const mode = getUiMode(runtime);
|
|
69
|
+
const stdout = runtime.stdout;
|
|
70
|
+
const stderr = runtime.stderr;
|
|
71
|
+
const spinner = createSpinner(mode, stderr);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
mode,
|
|
75
|
+
spinner,
|
|
76
|
+
heading(text) {
|
|
77
|
+
write(stdout, formatHeading(mode, text));
|
|
78
|
+
},
|
|
79
|
+
info(text) {
|
|
80
|
+
if (mode.plain) {
|
|
81
|
+
write(stdout, `[zenith] INFO: ${text}`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
write(stdout, formatStep(mode, text));
|
|
85
|
+
},
|
|
86
|
+
success(text) {
|
|
87
|
+
write(stdout, `[zenith] OK: ${text}`);
|
|
88
|
+
},
|
|
89
|
+
warn(text) {
|
|
90
|
+
write(stderr, `[zenith] WARN: ${text}`);
|
|
91
|
+
},
|
|
92
|
+
error(err) {
|
|
93
|
+
write(stderr, formatErrorBlock(err, mode));
|
|
94
|
+
},
|
|
95
|
+
summary(rows) {
|
|
96
|
+
const table = formatSummaryTable(mode, rows);
|
|
97
|
+
if (table) {
|
|
98
|
+
write(stdout, table);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
print(text) {
|
|
102
|
+
write(stdout, String(text));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,63 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.0-beta.2.15",
|
|
4
|
+
"description": "Deterministic project orchestrator for Zenith framework",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"zenith": "./dist/zenith.js",
|
|
8
|
-
"zen-dev": "./dist/zen-dev.js",
|
|
9
|
-
"zen-build": "./dist/zen-build.js",
|
|
10
|
-
"zen-preview": "./dist/zen-preview.js"
|
|
11
|
-
},
|
|
12
|
-
"main": "./src/index.ts",
|
|
13
|
-
"types": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.js",
|
|
14
8
|
"exports": {
|
|
15
|
-
".":
|
|
16
|
-
"types": "./src/index.ts",
|
|
17
|
-
"import": "./src/index.ts"
|
|
18
|
-
}
|
|
9
|
+
".": "./dist/index.js"
|
|
19
10
|
},
|
|
20
11
|
"files": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"build": "bun build bin/zenith.ts bin/zen-dev.ts bin/zen-build.ts bin/zen-preview.ts --outdir dist --target bun --bundle && for f in dist/*.js; do echo '#!/usr/bin/env bun' | cat - \"$f\" > \"$f.tmp\" && mv \"$f.tmp\" \"$f\" && chmod +x \"$f\"; done",
|
|
27
|
-
"start": "bun run build && bun run dev",
|
|
28
|
-
"test": "bun test",
|
|
29
|
-
"release": "bun run scripts/release.ts",
|
|
30
|
-
"release:dry": "bun run scripts/release.ts --dry-run",
|
|
31
|
-
"release:patch": "bun run scripts/release.ts --bump=patch",
|
|
32
|
-
"release:minor": "bun run scripts/release.ts --bump=minor",
|
|
33
|
-
"release:major": "bun run scripts/release.ts --bump=major"
|
|
34
|
-
},
|
|
35
|
-
"keywords": [
|
|
36
|
-
"zenith",
|
|
37
|
-
"cli",
|
|
38
|
-
"framework",
|
|
39
|
-
"ssg",
|
|
40
|
-
"ssr"
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"dist/**",
|
|
16
|
+
"package.json"
|
|
41
17
|
],
|
|
42
|
-
"author": "Zenith Team",
|
|
43
|
-
"license": "MIT",
|
|
44
|
-
"repository": {
|
|
45
|
-
"type": "git",
|
|
46
|
-
"url": "git@github.com:zenithbuild/zenith-cli.git"
|
|
47
|
-
},
|
|
48
18
|
"publishConfig": {
|
|
49
19
|
"access": "public"
|
|
50
20
|
},
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
"
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "mkdir -p dist && cp -a src/* dist/",
|
|
23
|
+
"test": "node --experimental-vm-modules $(node -e \"const path=require('node:path');const pkg=require.resolve('jest/package.json');process.stdout.write(path.join(path.dirname(pkg),'bin/jest.js'))\") --config jest.config.js --forceExit --runInBand",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@zenithbuild/compiler": "0.5.0-beta.2.14"
|
|
54
28
|
},
|
|
55
29
|
"devDependencies": {
|
|
56
|
-
"@
|
|
30
|
+
"@jest/globals": "^30.2.0",
|
|
31
|
+
"jest": "^30.2.0",
|
|
32
|
+
"jest-environment-jsdom": "^30.2.0"
|
|
57
33
|
},
|
|
58
|
-
"
|
|
59
|
-
"@zenithbuild/compiler": "^1.0.16",
|
|
60
|
-
"@zenithbuild/router": "^1.0.8",
|
|
61
|
-
"picocolors": "^1.0.0"
|
|
62
|
-
}
|
|
34
|
+
"private": false
|
|
63
35
|
}
|
package/bin/zen-build.ts
DELETED
package/bin/zen-dev.ts
DELETED
package/bin/zen-preview.ts
DELETED
package/bin/zenith.ts
DELETED