@vmz/vmz 0.1.3 → 0.1.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/cli.js +32 -3
- package/package.json +12 -12
package/dist/cli.js
CHANGED
|
@@ -104,7 +104,7 @@ export function printProjectHelp() {
|
|
|
104
104
|
Usage:
|
|
105
105
|
vmz new|init <dir> Scaffold a minimal app (native CLI)
|
|
106
106
|
vmz check [path] Check project via Workspace
|
|
107
|
-
vmz build [path] [options] Build project via Workspace
|
|
107
|
+
vmz build [path] [options] Build project via Workspace; --target mini-program-wechat packs dist/wechat
|
|
108
108
|
vmz serve [path] [options] Serve dist (optional --build)
|
|
109
109
|
vmz dev [path] [options] Rebuild session; --target mini-program-wechat packs dist/wechat
|
|
110
110
|
vmz format [path] [--check] Format .vmz via N-API (oxc formatter + EditorConfig)
|
|
@@ -124,7 +124,7 @@ Options:
|
|
|
124
124
|
--out-dir, -o <dir> Output directory (default: dist)
|
|
125
125
|
--release Release build (omit serve-host; pack minify slot; proof)
|
|
126
126
|
--profile <name> Delivery profile (default from config; builtins: web-ssr|web-static|web-client|web-hybrid)
|
|
127
|
-
--target <id>
|
|
127
|
+
--target <id> browser (default) | mini-program-wechat (pack dist/wechat for WeChat DevTools; build+dev)
|
|
128
128
|
--origin <url> Site origin for static-cdn canonical/sitemap
|
|
129
129
|
--host <host> Listen host (default: 127.0.0.1)
|
|
130
130
|
--port <port> Listen port (dev: omit = auto from 5173; set = lock)
|
|
@@ -333,11 +333,17 @@ async function runWithPlugins(ws, project, outDir, fn) {
|
|
|
333
333
|
*/
|
|
334
334
|
async function cmdBuild(args) {
|
|
335
335
|
const pathArg = args._[0] ?? '.';
|
|
336
|
+
const targetRaw = typeof args.target === 'string' ? args.target : 'browser';
|
|
337
|
+
if (targetRaw !== 'browser' && targetRaw !== 'mini-program-wechat') {
|
|
338
|
+
log.error(`unknown --target ${targetRaw} (browser | mini-program-wechat)`);
|
|
339
|
+
return 1;
|
|
340
|
+
}
|
|
341
|
+
const wechatPack = targetRaw === 'mini-program-wechat';
|
|
336
342
|
const { project, outDir } = resolveWorkspaceDirs({
|
|
337
343
|
path: pathArg,
|
|
338
344
|
outDir: typeof args['out-dir'] === 'string' ? args['out-dir'] : undefined,
|
|
339
345
|
});
|
|
340
|
-
log.info(`build ${project} → ${outDir}`);
|
|
346
|
+
log.info(`build ${project} → ${outDir}${wechatPack ? ' (target=mini-program-wechat)' : ''}`);
|
|
341
347
|
const ws = createWorkspace({ root: project, outDir });
|
|
342
348
|
try {
|
|
343
349
|
const cfg = await loadVmzConfig(project);
|
|
@@ -395,6 +401,29 @@ async function cmdBuild(args) {
|
|
|
395
401
|
if (!docs.ok)
|
|
396
402
|
return 1;
|
|
397
403
|
}
|
|
404
|
+
if (wechatPack) {
|
|
405
|
+
if (typeof ws.lowerMiniprogramWechatPackaging !== 'function') {
|
|
406
|
+
log.error('wechat pack: workspace missing lowerMiniprogramWechatPackaging');
|
|
407
|
+
return 1;
|
|
408
|
+
}
|
|
409
|
+
let report;
|
|
410
|
+
try {
|
|
411
|
+
const raw = ws.lowerMiniprogramWechatPackaging();
|
|
412
|
+
report = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
413
|
+
}
|
|
414
|
+
catch (err) {
|
|
415
|
+
log.error(`wechat pack failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
416
|
+
return 1;
|
|
417
|
+
}
|
|
418
|
+
log.diagnostics(report.diagnostics ?? []);
|
|
419
|
+
if (report.status !== 'ready') {
|
|
420
|
+
log.error(`wechat pack ${report.status || 'failed'}`);
|
|
421
|
+
return 1;
|
|
422
|
+
}
|
|
423
|
+
const packRoot = report.packRoot || 'dist/wechat';
|
|
424
|
+
log.info(`wechat pack ok → ${path.join(project, packRoot)} (open in WeChat DevTools)`);
|
|
425
|
+
return 0;
|
|
426
|
+
}
|
|
398
427
|
let pack = null;
|
|
399
428
|
try {
|
|
400
429
|
pack = packFromDeploymentIr(outDir, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/vmz",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ Node toolchain — N-API workspace session + CLI (publish name @vmz/vmz)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@vmz/core": "0.1.
|
|
52
|
-
"@vmz/plugin": "0.1.
|
|
53
|
-
"@vmz/protocol": "0.1.
|
|
51
|
+
"@vmz/core": "0.1.4",
|
|
52
|
+
"@vmz/plugin": "0.1.4",
|
|
53
|
+
"@vmz/protocol": "0.1.4",
|
|
54
54
|
"jiti": "^2.6.1",
|
|
55
55
|
"json5": "^2.2.3"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@vmz/plugin-markdown-it": "0.1.
|
|
59
|
-
"@vmz/test": "0.1.
|
|
58
|
+
"@vmz/plugin-markdown-it": "0.1.4",
|
|
59
|
+
"@vmz/test": "0.1.4",
|
|
60
60
|
"typescript": "^5.8.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
"cli"
|
|
91
91
|
],
|
|
92
92
|
"optionalDependencies": {
|
|
93
|
-
"@vmz/vmz-win32-x64": "0.1.
|
|
94
|
-
"@vmz/vmz-win32-arm64": "0.1.
|
|
95
|
-
"@vmz/vmz-darwin-x64": "0.1.
|
|
96
|
-
"@vmz/vmz-darwin-arm64": "0.1.
|
|
97
|
-
"@vmz/vmz-linux-x64": "0.1.
|
|
98
|
-
"@vmz/vmz-linux-arm64": "0.1.
|
|
93
|
+
"@vmz/vmz-win32-x64": "0.1.4",
|
|
94
|
+
"@vmz/vmz-win32-arm64": "0.1.4",
|
|
95
|
+
"@vmz/vmz-darwin-x64": "0.1.4",
|
|
96
|
+
"@vmz/vmz-darwin-arm64": "0.1.4",
|
|
97
|
+
"@vmz/vmz-linux-x64": "0.1.4",
|
|
98
|
+
"@vmz/vmz-linux-arm64": "0.1.4"
|
|
99
99
|
},
|
|
100
100
|
"publishConfig": {
|
|
101
101
|
"access": "public"
|