@openvcs/sdk 0.2.6 → 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/lib/types/vcs.d.ts +14 -2
- package/package.json +1 -1
- package/src/lib/build.ts +12 -1
- package/src/lib/init.ts +11 -1
- package/src/lib/types/vcs.ts +16 -2
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/lib/types/vcs.d.ts
CHANGED
|
@@ -209,6 +209,8 @@ export interface CommitEntry {
|
|
|
209
209
|
author: string;
|
|
210
210
|
/** Stores the formatted metadata string. */
|
|
211
211
|
meta: string;
|
|
212
|
+
/** Stores the first parent commit id when available. */
|
|
213
|
+
parent_oid?: string;
|
|
212
214
|
}
|
|
213
215
|
/** Describes params for `vcs.diff_file`. */
|
|
214
216
|
export interface VcsDiffFileParams extends VcsSessionParams {
|
|
@@ -307,6 +309,16 @@ export interface VcsResetSoftToParams extends VcsSessionParams {
|
|
|
307
309
|
/** Stores the revision to reset to. */
|
|
308
310
|
rev: string;
|
|
309
311
|
}
|
|
312
|
+
/** Describes params for continuing a merge in progress. */
|
|
313
|
+
export interface VcsMergeContinueParams extends VcsSessionParams {
|
|
314
|
+
/** Stores an optional commit message override. */
|
|
315
|
+
message?: string;
|
|
316
|
+
}
|
|
317
|
+
/** Describes params for hard resetting HEAD to a given ref. */
|
|
318
|
+
export interface VcsHardResetHeadParams extends VcsSessionParams {
|
|
319
|
+
/** Stores the ref to reset HEAD to; defaults to HEAD. */
|
|
320
|
+
ref?: string;
|
|
321
|
+
}
|
|
310
322
|
/** Describes one configured author identity. */
|
|
311
323
|
export interface VcsIdentity {
|
|
312
324
|
/** Stores the configured author name. */
|
|
@@ -425,7 +437,7 @@ export interface VcsDelegates<TContext = unknown> {
|
|
|
425
437
|
/** Handles `vcs.merge_abort`. */
|
|
426
438
|
'vcs.merge_abort'?: RpcMethodHandler<VcsSessionParams, null, TContext>;
|
|
427
439
|
/** Handles `vcs.merge_continue`. */
|
|
428
|
-
'vcs.merge_continue'?: RpcMethodHandler<
|
|
440
|
+
'vcs.merge_continue'?: RpcMethodHandler<VcsMergeContinueParams, null, TContext>;
|
|
429
441
|
/** Handles `vcs.is_merge_in_progress`. */
|
|
430
442
|
'vcs.is_merge_in_progress'?: RpcMethodHandler<VcsSessionParams, boolean, TContext>;
|
|
431
443
|
/** Handles `vcs.set_branch_upstream`. */
|
|
@@ -433,7 +445,7 @@ export interface VcsDelegates<TContext = unknown> {
|
|
|
433
445
|
/** Handles `vcs.get_branch_upstream`. */
|
|
434
446
|
'vcs.get_branch_upstream'?: RpcMethodHandler<VcsGetBranchUpstreamParams, string | null, TContext>;
|
|
435
447
|
/** Handles `vcs.hard_reset_head`. */
|
|
436
|
-
'vcs.hard_reset_head'?: RpcMethodHandler<
|
|
448
|
+
'vcs.hard_reset_head'?: RpcMethodHandler<VcsHardResetHeadParams, null, TContext>;
|
|
437
449
|
/** Handles `vcs.reset_soft_to`. */
|
|
438
450
|
'vcs.reset_soft_to'?: RpcMethodHandler<VcsResetSoftToParams, null, TContext>;
|
|
439
451
|
/** Handles `vcs.get_identity`. */
|
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) {
|
package/src/lib/types/vcs.ts
CHANGED
|
@@ -238,6 +238,8 @@ export interface CommitEntry {
|
|
|
238
238
|
author: string;
|
|
239
239
|
/** Stores the formatted metadata string. */
|
|
240
240
|
meta: string;
|
|
241
|
+
/** Stores the first parent commit id when available. */
|
|
242
|
+
parent_oid?: string;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
/** Describes params for `vcs.diff_file`. */
|
|
@@ -352,6 +354,18 @@ export interface VcsResetSoftToParams extends VcsSessionParams {
|
|
|
352
354
|
rev: string;
|
|
353
355
|
}
|
|
354
356
|
|
|
357
|
+
/** Describes params for continuing a merge in progress. */
|
|
358
|
+
export interface VcsMergeContinueParams extends VcsSessionParams {
|
|
359
|
+
/** Stores an optional commit message override. */
|
|
360
|
+
message?: string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Describes params for hard resetting HEAD to a given ref. */
|
|
364
|
+
export interface VcsHardResetHeadParams extends VcsSessionParams {
|
|
365
|
+
/** Stores the ref to reset HEAD to; defaults to HEAD. */
|
|
366
|
+
ref?: string;
|
|
367
|
+
}
|
|
368
|
+
|
|
355
369
|
/** Describes one configured author identity. */
|
|
356
370
|
export interface VcsIdentity {
|
|
357
371
|
/** Stores the configured author name. */
|
|
@@ -525,7 +539,7 @@ export interface VcsDelegates<TContext = unknown> {
|
|
|
525
539
|
/** Handles `vcs.merge_abort`. */
|
|
526
540
|
'vcs.merge_abort'?: RpcMethodHandler<VcsSessionParams, null, TContext>;
|
|
527
541
|
/** Handles `vcs.merge_continue`. */
|
|
528
|
-
'vcs.merge_continue'?: RpcMethodHandler<
|
|
542
|
+
'vcs.merge_continue'?: RpcMethodHandler<VcsMergeContinueParams, null, TContext>;
|
|
529
543
|
/** Handles `vcs.is_merge_in_progress`. */
|
|
530
544
|
'vcs.is_merge_in_progress'?: RpcMethodHandler<
|
|
531
545
|
VcsSessionParams,
|
|
@@ -545,7 +559,7 @@ export interface VcsDelegates<TContext = unknown> {
|
|
|
545
559
|
TContext
|
|
546
560
|
>;
|
|
547
561
|
/** Handles `vcs.hard_reset_head`. */
|
|
548
|
-
'vcs.hard_reset_head'?: RpcMethodHandler<
|
|
562
|
+
'vcs.hard_reset_head'?: RpcMethodHandler<VcsHardResetHeadParams, null, TContext>;
|
|
549
563
|
/** Handles `vcs.reset_soft_to`. */
|
|
550
564
|
'vcs.reset_soft_to'?: RpcMethodHandler<VcsResetSoftToParams, null, TContext>;
|
|
551
565
|
/** Handles `vcs.get_identity`. */
|