@akala/pm 5.2.19 → 5.2.20
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/changelog.md +5 -0
- package/dist/cjs/cli.js +0 -0
- package/dist/cjs/commands/$init.js +1 -1
- package/dist/cjs/commands/$init.js.map +1 -1
- package/dist/cjs/fork.js +10 -8
- package/dist/cjs/fork.js.map +1 -1
- package/dist/esm/cli.js +0 -0
- package/dist/esm/commands/$init.js +1 -1
- package/dist/esm/commands/$init.js.map +1 -1
- package/dist/esm/fork.js +10 -8
- package/dist/esm/fork.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/commands/$init.ts +1 -1
- package/src/fork.ts +10 -7
package/src/fork.ts
CHANGED
@@ -11,9 +11,9 @@ import program, { buildCliContextFromProcess, ErrorMessage, NamespaceMiddleware
|
|
11
11
|
import { Stats } from 'fs';
|
12
12
|
import { registerCommands, SelfDefinedCommand, parseMetadata, StructuredParameters } from '@akala/commands';
|
13
13
|
|
14
|
-
import module from 'module'
|
14
|
+
// import module from 'module'
|
15
15
|
|
16
|
-
const require = module.createRequire(import.meta.url.substring('file://'.length));
|
16
|
+
// const require = module.createRequire(import.meta.url.substring('file://'.length));
|
17
17
|
|
18
18
|
var isPm = false;
|
19
19
|
|
@@ -37,8 +37,8 @@ logMiddleware.preAction(async c =>
|
|
37
37
|
let initMiddleware = new NamespaceMiddleware<{ program: string, name: string, tls: boolean }>(null);
|
38
38
|
const controller = new AbortController();
|
39
39
|
|
40
|
-
program.option<string, 'program'>('program', { needsValue: true, normalize: true }).
|
41
|
-
option<string, 'name'>('name', { needsValue: true }).
|
40
|
+
program.option<string, 'program'>('program', { needsValue: true, normalize: true, positional: true, position: 0 }).
|
41
|
+
option<string, 'name'>('name', { needsValue: true, positional: true, position: 1, optional: true }).
|
42
42
|
option<boolean, 'tls'>('tls', { needsValue: false }).
|
43
43
|
options<{
|
44
44
|
port?: number,
|
@@ -71,16 +71,19 @@ program.option<string, 'program'>('program', { needsValue: true, normalize: true
|
|
71
71
|
handle: async c =>
|
72
72
|
{
|
73
73
|
cliContainer.name = c.options.name;
|
74
|
-
isPm = c.options.name === 'pm' && c.options.program ===
|
74
|
+
isPm = c.options.name === 'pm' && 'file://' + c.options.program === new URL('../../commands.json', import.meta.url).toString();
|
75
75
|
const init = cliContainer.resolve('$init');
|
76
76
|
if (init && init.config && init.config.cli && init.config.cli.options)
|
77
77
|
{
|
78
78
|
if (init.config.cli.usage)
|
79
|
+
{
|
79
80
|
initMiddleware = initMiddleware.command(init.config.cli.usage, init.config?.doc?.description)
|
81
|
+
c.args.unshift('$init');
|
82
|
+
}
|
80
83
|
ac.Triggers.addCliOptions(init, initMiddleware);
|
81
84
|
}
|
82
85
|
|
83
|
-
process.on('unhandledRejection', (x) =>
|
86
|
+
process.on('unhandledRejection', (x, p) =>
|
84
87
|
{
|
85
88
|
controller.abort(x)
|
86
89
|
return false;
|
@@ -100,7 +103,7 @@ program.option<string, 'program'>('program', { needsValue: true, normalize: true
|
|
100
103
|
if (!isPm)
|
101
104
|
{
|
102
105
|
//eslint-disable-next-line @typescript-eslint/no-var-requires
|
103
|
-
const pmMeta =
|
106
|
+
const pmMeta = await import(new URL('../../commands.json', import.meta.url).toString());
|
104
107
|
if (process.connected)
|
105
108
|
{
|
106
109
|
pm = new ac.Container('pm', null, new ac.Processors.JsonRpc(ac.Processors.JsonRpc.getConnection(new IpcAdapter(process), cliContainer), true)) as ac.Container<unknown> & pmDef.container;
|