@openvcs/sdk 0.4.0-beta.63 → 0.4.0-edge.20260521.75
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/lib/build.js +14 -2
- package/lib/init.js +14 -2
- package/package.json +1 -1
- package/src/lib/build.ts +17 -2
- package/src/lib/init.ts +17 -2
package/lib/build.js
CHANGED
|
@@ -65,6 +65,17 @@ function shouldUseWindowsShell(program) {
|
|
|
65
65
|
const normalized = program.toLowerCase();
|
|
66
66
|
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
67
67
|
}
|
|
68
|
+
function quoteCmdArg(value) {
|
|
69
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
70
|
+
}
|
|
71
|
+
function normalizeSpawnCommand(program, args) {
|
|
72
|
+
if (!shouldUseWindowsShell(program)) {
|
|
73
|
+
return { program, args };
|
|
74
|
+
}
|
|
75
|
+
const shell = process.env.ComSpec || "cmd.exe";
|
|
76
|
+
const commandLine = [program, ...args].map(quoteCmdArg).join(" ");
|
|
77
|
+
return { program: shell, args: ["/d", "/s", "/c", commandLine] };
|
|
78
|
+
}
|
|
68
79
|
/** Formats help text for the build command. */
|
|
69
80
|
function buildUsage(commandName = "openvcs") {
|
|
70
81
|
return `${commandName} build [args]\n\n --plugin-dir <path> Plugin repository root (contains package.json with openvcs metadata)\n -V, --verbose Enable verbose output\n`;
|
|
@@ -260,10 +271,11 @@ function runCommand(program, args, cwd, verbose) {
|
|
|
260
271
|
if (verbose) {
|
|
261
272
|
process.stderr.write(`Running command in ${cwd}: ${program} ${args.join(" ")}\n`);
|
|
262
273
|
}
|
|
263
|
-
const
|
|
274
|
+
const spawn = normalizeSpawnCommand(program, args);
|
|
275
|
+
const result = (0, node_child_process_1.spawnSync)(spawn.program, spawn.args, {
|
|
264
276
|
cwd,
|
|
265
|
-
shell: shouldUseWindowsShell(program),
|
|
266
277
|
stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
|
|
278
|
+
windowsHide: true,
|
|
267
279
|
});
|
|
268
280
|
if (result.error) {
|
|
269
281
|
throw new Error(`failed to spawn '${program}' in ${cwd}: ${result.error.message}`);
|
package/lib/init.js
CHANGED
|
@@ -53,6 +53,17 @@ function shouldUseWindowsShell(program) {
|
|
|
53
53
|
const normalized = program.toLowerCase();
|
|
54
54
|
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
55
55
|
}
|
|
56
|
+
function quoteCmdArg(value) {
|
|
57
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
58
|
+
}
|
|
59
|
+
function normalizeSpawnCommand(program, args) {
|
|
60
|
+
if (!shouldUseWindowsShell(program)) {
|
|
61
|
+
return { program, args };
|
|
62
|
+
}
|
|
63
|
+
const shell = process.env.ComSpec || "cmd.exe";
|
|
64
|
+
const commandLine = [program, ...args].map(quoteCmdArg).join(" ");
|
|
65
|
+
return { program: shell, args: ["/d", "/s", "/c", commandLine] };
|
|
66
|
+
}
|
|
56
67
|
function initUsage(commandName = "openvcs") {
|
|
57
68
|
return `Usage: ${commandName} init [--theme] [target-dir]\n\nOptions:\n --theme Start with a theme-only plugin template\n`;
|
|
58
69
|
}
|
|
@@ -203,10 +214,11 @@ async function collectAnswers({ forceTheme, targetHint }, promptDriver = createR
|
|
|
203
214
|
}
|
|
204
215
|
}
|
|
205
216
|
function runNpmInstall(targetDir) {
|
|
206
|
-
const
|
|
217
|
+
const spawn = normalizeSpawnCommand(npmExecutable(), ["install"]);
|
|
218
|
+
const result = (0, node_child_process_1.spawnSync)(spawn.program, spawn.args, {
|
|
207
219
|
cwd: targetDir,
|
|
208
|
-
shell: shouldUseWindowsShell(npmExecutable()),
|
|
209
220
|
stdio: "inherit",
|
|
221
|
+
windowsHide: true,
|
|
210
222
|
});
|
|
211
223
|
if (result.error) {
|
|
212
224
|
throw new Error(`failed to spawn npm install in ${targetDir}: ${result.error.message}`);
|
package/package.json
CHANGED
package/src/lib/build.ts
CHANGED
|
@@ -49,6 +49,20 @@ export function shouldUseWindowsShell(program: string): boolean {
|
|
|
49
49
|
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function quoteCmdArg(value: string): string {
|
|
53
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function normalizeSpawnCommand(program: string, args: string[]): { program: string; args: string[] } {
|
|
57
|
+
if (!shouldUseWindowsShell(program)) {
|
|
58
|
+
return { program, args };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const shell = process.env.ComSpec || "cmd.exe";
|
|
62
|
+
const commandLine = [program, ...args].map(quoteCmdArg).join(" ");
|
|
63
|
+
return { program: shell, args: ["/d", "/s", "/c", commandLine] };
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
/** Formats help text for the build command. */
|
|
53
67
|
export function buildUsage(commandName = "openvcs"): string {
|
|
54
68
|
return `${commandName} build [args]\n\n --plugin-dir <path> Plugin repository root (contains package.json with openvcs metadata)\n -V, --verbose Enable verbose output\n`;
|
|
@@ -286,10 +300,11 @@ export function runCommand(program: string, args: string[], cwd: string, verbose
|
|
|
286
300
|
process.stderr.write(`Running command in ${cwd}: ${program} ${args.join(" ")}\n`);
|
|
287
301
|
}
|
|
288
302
|
|
|
289
|
-
const
|
|
303
|
+
const spawn = normalizeSpawnCommand(program, args);
|
|
304
|
+
const result = spawnSync(spawn.program, spawn.args, {
|
|
290
305
|
cwd,
|
|
291
|
-
shell: shouldUseWindowsShell(program),
|
|
292
306
|
stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
|
|
307
|
+
windowsHide: true,
|
|
293
308
|
}) as CommandResult;
|
|
294
309
|
|
|
295
310
|
if (result.error) {
|
package/src/lib/init.ts
CHANGED
|
@@ -46,6 +46,20 @@ function shouldUseWindowsShell(program: string): boolean {
|
|
|
46
46
|
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function quoteCmdArg(value: string): string {
|
|
50
|
+
return `"${value.replace(/"/g, '\\"')}"`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function normalizeSpawnCommand(program: string, args: string[]): { program: string; args: string[] } {
|
|
54
|
+
if (!shouldUseWindowsShell(program)) {
|
|
55
|
+
return { program, args };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const shell = process.env.ComSpec || "cmd.exe";
|
|
59
|
+
const commandLine = [program, ...args].map(quoteCmdArg).join(" ");
|
|
60
|
+
return { program: shell, args: ["/d", "/s", "/c", commandLine] };
|
|
61
|
+
}
|
|
62
|
+
|
|
49
63
|
export function initUsage(commandName = "openvcs"): string {
|
|
50
64
|
return `Usage: ${commandName} init [--theme] [target-dir]\n\nOptions:\n --theme Start with a theme-only plugin template\n`;
|
|
51
65
|
}
|
|
@@ -214,10 +228,11 @@ async function collectAnswers(
|
|
|
214
228
|
}
|
|
215
229
|
|
|
216
230
|
function runNpmInstall(targetDir: string): void {
|
|
217
|
-
const
|
|
231
|
+
const spawn = normalizeSpawnCommand(npmExecutable(), ["install"]);
|
|
232
|
+
const result = spawnSync(spawn.program, spawn.args, {
|
|
218
233
|
cwd: targetDir,
|
|
219
|
-
shell: shouldUseWindowsShell(npmExecutable()),
|
|
220
234
|
stdio: "inherit",
|
|
235
|
+
windowsHide: true,
|
|
221
236
|
});
|
|
222
237
|
if (result.error) {
|
|
223
238
|
throw new Error(`failed to spawn npm install in ${targetDir}: ${result.error.message}`);
|