@vmz/vmz 0.1.18 → 0.1.19

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.
Files changed (2) hide show
  1. package/dist/test-cmd.js +31 -5
  2. package/package.json +14 -14
package/dist/test-cmd.js CHANGED
@@ -2,8 +2,10 @@
2
2
  * `vmz test` command — discovery / build / filter / TestReport orchestration.
3
3
  * Semantics live in `@vmz/test` (optional peer — not installed with bare `@vmz/vmz`).
4
4
  */
5
+ import fs from 'node:fs';
6
+ import os from 'node:os';
5
7
  import path from 'node:path';
6
- import { createWorkspace } from './index.js';
8
+ import { createWorkspace, loadVmzConfig, normalizeDeliveryAuthoring, resolveProfileArtifactDir, selectBuildProfile } from './index.js';
7
9
  import { log } from './log.js';
8
10
  import { generatePrettyJson } from './pretty-json.js';
9
11
  export function registerTestCommand(cli) {
@@ -37,7 +39,7 @@ export async function cmdTest(args) {
37
39
  log.error(e instanceof Error ? e.message : String(e));
38
40
  return 1;
39
41
  }
40
- const { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, } = test;
42
+ const { discoverTestManifests, buildTestReport, parseModes, buildForCompile, runCompileManifest, runLogicManifest, runSsrManifest, runResumeManifest, runBrowserManifest, runDeploymentManifest, resolveDeliveryServeRoot, } = test;
41
43
  const project = path.resolve(String(args._[0] || '.'));
42
44
  let modes;
43
45
  try {
@@ -170,11 +172,32 @@ export async function cmdTest(args) {
170
172
  let buildOut = null;
171
173
  let buildDiags = [];
172
174
  let buildError = null;
175
+ let deliveryName = null;
173
176
  if (needsBuild) {
174
- const built = buildForCompile(project, outDirArg ? path.resolve(outDirArg) : undefined, {
177
+ // Align with `vmz build` / `vmz serve`: artifacts live under
178
+ // `<out-dir>/<profiles.*.name>` (default name = profile id).
179
+ const outDirRoot = outDirArg ? path.resolve(outDirArg) : fs.mkdtempSync(path.join(os.tmpdir(), 'vmz-test-'));
180
+ let buildTarget = outDirRoot;
181
+ try {
182
+ const cfg = await loadVmzConfig(project);
183
+ const norm = normalizeDeliveryAuthoring(cfg.delivery ?? null);
184
+ if (norm.ok) {
185
+ const selected = selectBuildProfile(norm.table, '');
186
+ if (selected.ok) {
187
+ deliveryName = String(selected.profile.name || selected.selection.profileId || '');
188
+ buildTarget = resolveProfileArtifactDir(outDirRoot, selected.profile);
189
+ }
190
+ }
191
+ }
192
+ catch (e) {
193
+ log.warn(`delivery profile resolve skipped: ${e instanceof Error ? e.message : String(e)}`);
194
+ }
195
+ fs.mkdirSync(buildTarget, { recursive: true });
196
+ const built = buildForCompile(project, buildTarget, {
175
197
  createWorkspace,
198
+ deliveryName,
176
199
  });
177
- buildOut = built.outDir;
200
+ buildOut = resolveDeliveryServeRoot(built.outDir, deliveryName);
178
201
  buildDiags = built.diagnostics || [];
179
202
  if (!built.ok) {
180
203
  buildError = built.error || 'build failed';
@@ -256,7 +279,10 @@ export async function cmdTest(args) {
256
279
  base.planId = result.planId ?? base.planId;
257
280
  }
258
281
  if (doBrowser) {
259
- const result = await runBrowserManifest(m, { outDir: buildOut });
282
+ const result = await runBrowserManifest(m, {
283
+ outDir: buildOut,
284
+ deliveryName,
285
+ });
260
286
  statuses.push(result.status);
261
287
  diags.push(...result.diagnostics);
262
288
  base.programId = result.programId ?? base.programId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vmz/vmz",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "description": "VMZ Node toolchain — N-API workspace session + CLI (publish name @vmz/vmz)",
6
6
  "license": "MIT",
@@ -48,16 +48,16 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@vmz/commander": "0.1.18",
52
- "@vmz/core": "0.1.18",
53
- "@vmz/diagnostic": "0.1.18",
54
- "@vmz/plugin": "0.1.18",
55
- "@vmz/protocol": "0.1.18",
51
+ "@vmz/commander": "0.1.19",
52
+ "@vmz/core": "0.1.19",
53
+ "@vmz/diagnostic": "0.1.19",
54
+ "@vmz/plugin": "0.1.19",
55
+ "@vmz/protocol": "0.1.19",
56
56
  "jiti": "^2.6.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@vmz/plugin-markdown-it": "0.1.18",
60
- "@vmz/test": "0.1.18",
59
+ "@vmz/plugin-markdown-it": "0.1.19",
60
+ "@vmz/test": "0.1.19",
61
61
  "typescript": "^5.8.3"
62
62
  },
63
63
  "peerDependenciesMeta": {
@@ -92,12 +92,12 @@
92
92
  "cli"
93
93
  ],
94
94
  "optionalDependencies": {
95
- "@vmz/vmz-win32-x64": "0.1.18",
96
- "@vmz/vmz-win32-arm64": "0.1.18",
97
- "@vmz/vmz-darwin-x64": "0.1.18",
98
- "@vmz/vmz-darwin-arm64": "0.1.18",
99
- "@vmz/vmz-linux-x64": "0.1.18",
100
- "@vmz/vmz-linux-arm64": "0.1.18"
95
+ "@vmz/vmz-win32-x64": "0.1.19",
96
+ "@vmz/vmz-win32-arm64": "0.1.19",
97
+ "@vmz/vmz-darwin-x64": "0.1.19",
98
+ "@vmz/vmz-darwin-arm64": "0.1.19",
99
+ "@vmz/vmz-linux-x64": "0.1.19",
100
+ "@vmz/vmz-linux-arm64": "0.1.19"
101
101
  },
102
102
  "publishConfig": {
103
103
  "access": "public"