@openvcs/sdk 0.2.7 → 0.2.8
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.d.ts +2 -0
- package/lib/build.js +11 -1
- package/lib/init.js +9 -1
- package/package.json +1 -1
- package/src/lib/build.ts +12 -1
- package/src/lib/init.ts +11 -1
package/lib/build.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface ManifestInfo {
|
|
|
12
12
|
}
|
|
13
13
|
/** Returns the npm executable name for the current platform. */
|
|
14
14
|
export declare function npmExecutable(): string;
|
|
15
|
+
/** Returns whether a command must be launched via the Windows shell. */
|
|
16
|
+
export declare function shouldUseWindowsShell(program: string): boolean;
|
|
15
17
|
/** Formats help text for the build command. */
|
|
16
18
|
export declare function buildUsage(commandName?: string): string;
|
|
17
19
|
/** Parses `openvcs build` arguments. */
|
package/lib/build.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.npmExecutable = npmExecutable;
|
|
6
|
+
exports.shouldUseWindowsShell = shouldUseWindowsShell;
|
|
6
7
|
exports.buildUsage = buildUsage;
|
|
7
8
|
exports.parseBuildArgs = parseBuildArgs;
|
|
8
9
|
exports.readManifest = readManifest;
|
|
@@ -21,7 +22,15 @@ const fs_utils_1 = require("./fs-utils");
|
|
|
21
22
|
const AUTHORED_PLUGIN_MODULE_BASENAME = "plugin.js";
|
|
22
23
|
/** Returns the npm executable name for the current platform. */
|
|
23
24
|
function npmExecutable() {
|
|
24
|
-
return
|
|
25
|
+
return "npm";
|
|
26
|
+
}
|
|
27
|
+
/** Returns whether a command must be launched via the Windows shell. */
|
|
28
|
+
function shouldUseWindowsShell(program) {
|
|
29
|
+
if (process.platform !== "win32") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const normalized = program.toLowerCase();
|
|
33
|
+
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
25
34
|
}
|
|
26
35
|
/** Formats help text for the build command. */
|
|
27
36
|
function buildUsage(commandName = "openvcs") {
|
|
@@ -216,6 +225,7 @@ function runCommand(program, args, cwd, verbose) {
|
|
|
216
225
|
}
|
|
217
226
|
const result = (0, node_child_process_1.spawnSync)(program, args, {
|
|
218
227
|
cwd,
|
|
228
|
+
shell: shouldUseWindowsShell(program),
|
|
219
229
|
stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
|
|
220
230
|
});
|
|
221
231
|
if (result.error) {
|
package/lib/init.js
CHANGED
|
@@ -11,7 +11,14 @@ const node_process_1 = require("node:process");
|
|
|
11
11
|
const node_child_process_1 = require("node:child_process");
|
|
12
12
|
const packageJson = require("../package.json");
|
|
13
13
|
function npmExecutable() {
|
|
14
|
-
return
|
|
14
|
+
return "npm";
|
|
15
|
+
}
|
|
16
|
+
function shouldUseWindowsShell(program) {
|
|
17
|
+
if (process.platform !== "win32") {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const normalized = program.toLowerCase();
|
|
21
|
+
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
15
22
|
}
|
|
16
23
|
function initUsage(commandName = "openvcs") {
|
|
17
24
|
return `Usage: ${commandName} init [--theme] [target-dir]\n\nOptions:\n --theme Start with a theme-only plugin template\n`;
|
|
@@ -165,6 +172,7 @@ async function collectAnswers({ forceTheme, targetHint }, promptDriver = createR
|
|
|
165
172
|
function runNpmInstall(targetDir) {
|
|
166
173
|
const result = (0, node_child_process_1.spawnSync)(npmExecutable(), ["install"], {
|
|
167
174
|
cwd: targetDir,
|
|
175
|
+
shell: shouldUseWindowsShell(npmExecutable()),
|
|
168
176
|
stdio: "inherit",
|
|
169
177
|
});
|
|
170
178
|
if (result.error) {
|
package/package.json
CHANGED
package/src/lib/build.ts
CHANGED
|
@@ -36,7 +36,17 @@ const AUTHORED_PLUGIN_MODULE_BASENAME = "plugin.js";
|
|
|
36
36
|
|
|
37
37
|
/** Returns the npm executable name for the current platform. */
|
|
38
38
|
export function npmExecutable(): string {
|
|
39
|
-
return
|
|
39
|
+
return "npm";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Returns whether a command must be launched via the Windows shell. */
|
|
43
|
+
export function shouldUseWindowsShell(program: string): boolean {
|
|
44
|
+
if (process.platform !== "win32") {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const normalized = program.toLowerCase();
|
|
49
|
+
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
/** Formats help text for the build command. */
|
|
@@ -271,6 +281,7 @@ export function runCommand(program: string, args: string[], cwd: string, verbose
|
|
|
271
281
|
|
|
272
282
|
const result = spawnSync(program, args, {
|
|
273
283
|
cwd,
|
|
284
|
+
shell: shouldUseWindowsShell(program),
|
|
274
285
|
stdio: ["ignore", verbose ? "inherit" : "ignore", "inherit"],
|
|
275
286
|
}) as CommandResult;
|
|
276
287
|
|
package/src/lib/init.ts
CHANGED
|
@@ -34,7 +34,16 @@ interface InitCommandError {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function npmExecutable(): string {
|
|
37
|
-
return
|
|
37
|
+
return "npm";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function shouldUseWindowsShell(program: string): boolean {
|
|
41
|
+
if (process.platform !== "win32") {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const normalized = program.toLowerCase();
|
|
46
|
+
return normalized === "npm" || normalized.endsWith(".cmd") || normalized.endsWith(".bat");
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
export function initUsage(commandName = "openvcs"): string {
|
|
@@ -207,6 +216,7 @@ async function collectAnswers(
|
|
|
207
216
|
function runNpmInstall(targetDir: string): void {
|
|
208
217
|
const result = spawnSync(npmExecutable(), ["install"], {
|
|
209
218
|
cwd: targetDir,
|
|
219
|
+
shell: shouldUseWindowsShell(npmExecutable()),
|
|
210
220
|
stdio: "inherit",
|
|
211
221
|
});
|
|
212
222
|
if (result.error) {
|