@peterxiaoyang/superspec 0.1.28 → 0.1.30

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/cli.js +14 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -134,6 +134,14 @@ function runtimePlatform() {
134
134
  function windowsAwareCommand(name) {
135
135
  return runtimePlatform() === "win32" ? `${name}.cmd` : name;
136
136
  }
137
+ function windowsCommandHost() {
138
+ return testEnv("SUPERSPEC_TEST_CMD_EXE") ?? process.env.ComSpec ?? "cmd.exe";
139
+ }
140
+ function execFileTextSync(command, args, options) {
141
+ if (runtimePlatform() !== "win32")
142
+ return execFileSync(command, args, options);
143
+ return execFileSync(windowsCommandHost(), ["/d", "/s", "/c", command, ...args], options);
144
+ }
137
145
  function npmCommand() {
138
146
  return windowsAwareCommand("npm");
139
147
  }
@@ -221,7 +229,7 @@ function pathOpenSpecVersion() {
221
229
  throw new Error(`无法解析 openspec --version 输出:${mocked}`);
222
230
  return parsed;
223
231
  }
224
- const output = execFileSync(openspecCommand(), ["--version"], {
232
+ const output = execFileTextSync(openspecCommand(), ["--version"], {
225
233
  encoding: "utf8",
226
234
  env: process.env,
227
235
  });
@@ -237,7 +245,7 @@ function installRequiredOpenSpecGlobal(before) {
237
245
  if (testEnv("SUPERSPEC_TEST_SKIP_OPENSPEC_INSTALL") === "1")
238
246
  return;
239
247
  try {
240
- execFileSync(npmCommand(), ["install", "-g", `${OPENSPEC_PACKAGE_NAME}@${OPENSPEC_REQUIRED_VERSION}`], {
248
+ execFileTextSync(npmCommand(), ["install", "-g", `${OPENSPEC_PACKAGE_NAME}@${OPENSPEC_REQUIRED_VERSION}`], {
241
249
  encoding: "utf8",
242
250
  stdio: ["ignore", "pipe", "pipe"],
243
251
  });
@@ -290,7 +298,7 @@ function npmLatestVersion() {
290
298
  if (testLatest)
291
299
  return testLatest;
292
300
  try {
293
- const output = execFileSync(npmCommand(), ["view", PACKAGE_NAME, "version"], { encoding: "utf8" });
301
+ const output = execFileTextSync(npmCommand(), ["view", PACKAGE_NAME, "version"], { encoding: "utf8" });
294
302
  return output.trim().replace(/^"|"$/g, "");
295
303
  }
296
304
  catch (err) {
@@ -304,7 +312,7 @@ function installLatestGlobal() {
304
312
  if (testEnv("SUPERSPEC_TEST_SKIP_GLOBAL_INSTALL") === "1")
305
313
  return;
306
314
  try {
307
- execFileSync(npmCommand(), ["install", "-g", `${PACKAGE_NAME}@latest`], {
315
+ execFileTextSync(npmCommand(), ["install", "-g", `${PACKAGE_NAME}@latest`], {
308
316
  encoding: "utf8",
309
317
  stdio: ["ignore", "pipe", "pipe"],
310
318
  });
@@ -331,7 +339,7 @@ function pathCliVersion() {
331
339
  throw new Error(`无法解析 superspec --version 输出:${testOutput}`);
332
340
  return parsed;
333
341
  }
334
- const output = execFileSync(superspecCommand(), ["--version"], {
342
+ const output = execFileTextSync(superspecCommand(), ["--version"], {
335
343
  encoding: "utf8",
336
344
  env: process.env,
337
345
  });
@@ -360,7 +368,7 @@ function rerunUpdatedCli(projectRoot, args) {
360
368
  if (testOutput)
361
369
  return testOutput;
362
370
  try {
363
- return execFileSync(superspecCommand(), args, {
371
+ return execFileTextSync(superspecCommand(), args, {
364
372
  cwd: projectRoot,
365
373
  encoding: "utf8",
366
374
  env: process.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peterxiaoyang/superspec",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "SuperSpec 流程引擎 — transition engine with lightweight fact-sync",
5
5
  "type": "module",
6
6
  "engines": {