@flowscripter/dynamic-cli-framework 5.1.7 → 5.2.0
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/dist/src/service/plugin/SpawnInterfaceAdapter.d.ts +1 -0
- package/dist/src/service/plugin/SpawnInterfaceAdapter.d.ts.map +1 -1
- package/dist/src/service/plugin/SpawnInterfaceAdapter.js +2 -1
- package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -1
- package/dist/src/service/plugin/command/PluginAddSubCommand.js +11 -1
- package/package.json +2 -2
- package/src/service/plugin/SpawnInterfaceAdapter.ts +3 -2
- package/src/service/plugin/command/PluginAddSubCommand.ts +16 -1
|
@@ -16,6 +16,7 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
|
16
16
|
constructor(spawnService: SpawnService, printerService: PrinterService, options?: SpawnInterfaceAdapterOptions);
|
|
17
17
|
spawn(command: ReadonlyArray<string>, options: {
|
|
18
18
|
cwd: string;
|
|
19
|
+
timeoutMs?: number;
|
|
19
20
|
}): Promise<SpawnResult>;
|
|
20
21
|
}
|
|
21
22
|
//# sourceMappingURL=SpawnInterfaceAdapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpawnInterfaceAdapter.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/SpawnInterfaceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1F,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;gBAOhE,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,4BAAiC;IAQ/B,KAAK,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,
|
|
1
|
+
{"version":3,"file":"SpawnInterfaceAdapter.d.ts","sourceRoot":"","sources":["../../../../src/service/plugin/SpawnInterfaceAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAE1F,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,YAAW,cAAc;;gBAOhE,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,4BAAiC;IAQ/B,KAAK,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3C,OAAO,CAAC,WAAW,CAAC;CAuCxB"}
|
|
@@ -30,6 +30,7 @@ export default class SpawnInterfaceAdapter {
|
|
|
30
30
|
cwd: options.cwd,
|
|
31
31
|
mode: "wrapped",
|
|
32
32
|
onOutput,
|
|
33
|
+
timeoutMs: options.timeoutMs,
|
|
33
34
|
});
|
|
34
35
|
await writeQueue;
|
|
35
36
|
this.#printerService.endQuote();
|
|
@@ -47,7 +48,7 @@ export default class SpawnInterfaceAdapter {
|
|
|
47
48
|
return { ok: true, exitCode: result.exitCode };
|
|
48
49
|
}
|
|
49
50
|
return "timedOut" in result
|
|
50
|
-
? { ok: false,
|
|
51
|
+
? { ok: false, timedOut: true }
|
|
51
52
|
: { ok: false, exitCode: result.exitCode, error: result.error };
|
|
52
53
|
}
|
|
53
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginAddSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/plugin/command/PluginAddSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AASxE,qBAAa,mBAAoB,YAAW,UAAU;IACpD,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,WAAW,6BAA6B;IACjD,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,OAAO,UAAM;IACtB,QAAQ,CAAC,WAAW;;;;QAMlB;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginAddSubCommand.d.ts","sourceRoot":"","sources":["../../../../../src/service/plugin/command/PluginAddSubCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AASxE,qBAAa,mBAAoB,YAAW,UAAU;IACpD,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,WAAW,6BAA6B;IACjD,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,OAAO,UAAM;IACtB,QAAQ,CAAC,WAAW;;;;QAMlB;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CA+EvE"}
|
|
@@ -64,6 +64,16 @@ export class PluginAddSubCommand {
|
|
|
64
64
|
}
|
|
65
65
|
await printerService.info(`Installing ${installLabel}...\n`, Icon.INFORMATION);
|
|
66
66
|
await pluginService.install(descriptor);
|
|
67
|
-
|
|
67
|
+
// Look up the actually-installed version rather than trusting `descriptor.version`: when no
|
|
68
|
+
// version was requested and the plugin wasn't found via search (direct-install fallback),
|
|
69
|
+
// `descriptor.version` is still the literal placeholder "latest", not a real version number.
|
|
70
|
+
let installedVersion = descriptor.version;
|
|
71
|
+
for await (const installed of pluginService.listInstalled()) {
|
|
72
|
+
if (installed.pluginId === descriptor.pluginId) {
|
|
73
|
+
installedVersion = installed.version;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
await printerService.print(`Plugin ${descriptor.pluginId}@${installedVersion} installed.\n`, Icon.SUCCESS);
|
|
68
78
|
}
|
|
69
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowscripter/dynamic-cli-framework",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "A framework for developing CLI applications which supports dynamic discovery and installation of new commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@flowscripter/dynamic-cli-framework-api": "^2.3.0",
|
|
52
|
-
"@flowscripter/dynamic-plugin-framework": "^2.2.
|
|
52
|
+
"@flowscripter/dynamic-plugin-framework": "^2.2.2",
|
|
53
53
|
"emphasize": "^7.0.0",
|
|
54
54
|
"fastest-levenshtein": "^1.0.16",
|
|
55
55
|
"figlet": "^1.11.0",
|
|
@@ -32,7 +32,7 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
|
32
32
|
|
|
33
33
|
public async spawn(
|
|
34
34
|
command: ReadonlyArray<string>,
|
|
35
|
-
options: { cwd: string },
|
|
35
|
+
options: { cwd: string; timeoutMs?: number },
|
|
36
36
|
): Promise<SpawnResult> {
|
|
37
37
|
this.#printerService.startQuote(this.#quoteColor);
|
|
38
38
|
this.#printerService.startMark();
|
|
@@ -49,6 +49,7 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
|
49
49
|
cwd: options.cwd,
|
|
50
50
|
mode: "wrapped",
|
|
51
51
|
onOutput,
|
|
52
|
+
timeoutMs: options.timeoutMs,
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
await writeQueue;
|
|
@@ -68,7 +69,7 @@ export default class SpawnInterfaceAdapter implements SpawnInterface {
|
|
|
68
69
|
return { ok: true, exitCode: result.exitCode };
|
|
69
70
|
}
|
|
70
71
|
return "timedOut" in result
|
|
71
|
-
? { ok: false,
|
|
72
|
+
? { ok: false, timedOut: true }
|
|
72
73
|
: { ok: false, exitCode: result.exitCode, error: result.error };
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -85,6 +85,21 @@ export class PluginAddSubCommand implements SubCommand {
|
|
|
85
85
|
|
|
86
86
|
await printerService.info(`Installing ${installLabel}...\n`, Icon.INFORMATION);
|
|
87
87
|
await pluginService.install(descriptor);
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
// Look up the actually-installed version rather than trusting `descriptor.version`: when no
|
|
90
|
+
// version was requested and the plugin wasn't found via search (direct-install fallback),
|
|
91
|
+
// `descriptor.version` is still the literal placeholder "latest", not a real version number.
|
|
92
|
+
let installedVersion = descriptor.version;
|
|
93
|
+
for await (const installed of pluginService.listInstalled()) {
|
|
94
|
+
if (installed.pluginId === descriptor.pluginId) {
|
|
95
|
+
installedVersion = installed.version;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
await printerService.print(
|
|
101
|
+
`Plugin ${descriptor.pluginId}@${installedVersion} installed.\n`,
|
|
102
|
+
Icon.SUCCESS,
|
|
103
|
+
);
|
|
89
104
|
}
|
|
90
105
|
}
|