@akala/pm 2.3.0 → 2.4.1
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 +1 -1
- package/commands.json +109 -148
- package/dist/cli.js +19 -11
- package/dist/cli.js.map +1 -1
- package/dist/commands/$init.js +31 -7
- package/dist/commands/$init.js.map +1 -1
- package/dist/commands/connect.js +1 -1
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/discover.js +13 -13
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/install.js +1 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/link.js +1 -1
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/log.d.ts +1 -1
- package/dist/commands/log.js +9 -2
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/map.js +2 -2
- package/dist/commands/map.js.map +1 -1
- package/dist/commands/start.js +11 -7
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/version.js +2 -2
- package/dist/commands/version.js.map +1 -1
- package/dist/fork.js +9 -11
- package/dist/fork.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/npm-helper.js +4 -4
- package/dist/npm-helper.js.map +1 -1
- package/dist/test/pwet.js +1 -1
- package/dist/test/pwet.js.map +1 -1
- package/dist/yarn-helper.js +5 -5
- package/dist/yarn-helper.js.map +1 -1
- package/package.json +6 -7
- package/src/cli.ts +21 -9
- package/src/commands/$init.json +0 -6
- package/src/commands/$init.ts +34 -6
- package/src/commands/discover.json +6 -5
- package/src/commands/discover.ts +1 -1
- package/src/commands/log.ts +10 -2
- package/src/commands/start.ts +9 -4
- package/src/fork.ts +7 -9
- package/src/index.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/yarn-error.log +0 -11177
package/dist/yarn-helper.js
CHANGED
@@ -10,21 +10,21 @@ const path_1 = require("path");
|
|
10
10
|
// {
|
11
11
|
// }
|
12
12
|
function hasYarn(path) {
|
13
|
-
return util_1.promisify(fs_1.stat)(path_1.join(path || process.cwd(), './yarn.lock')).then(f => f.isFile());
|
13
|
+
return (0, util_1.promisify)(fs_1.stat)((0, path_1.join)(path || process.cwd(), './yarn.lock')).then(f => f.isFile());
|
14
14
|
}
|
15
15
|
exports.hasYarn = hasYarn;
|
16
16
|
let npm = 'yarn';
|
17
|
-
if (os_1.platform() == 'win32')
|
17
|
+
if ((0, os_1.platform)() == 'win32')
|
18
18
|
npm = 'yarn.cmd';
|
19
19
|
exports.default = {
|
20
20
|
async install(packageName, path) {
|
21
|
-
await cli_helper_1.spawnAsync(npm, { cwd: path }, 'add', packageName, '--production');
|
21
|
+
await (0, cli_helper_1.spawnAsync)(npm, { cwd: path }, 'add', packageName, '--production');
|
22
22
|
},
|
23
23
|
async update(packageName, path) {
|
24
|
-
await cli_helper_1.spawnAsync(npm, { cwd: path }, 'upgrade', packageName, '--production');
|
24
|
+
await (0, cli_helper_1.spawnAsync)(npm, { cwd: path }, 'upgrade', packageName, '--production');
|
25
25
|
},
|
26
26
|
async link(packageName, path) {
|
27
|
-
await cli_helper_1.spawnAsync(npm, { cwd: path }, 'link', packageName, '--production');
|
27
|
+
await (0, cli_helper_1.spawnAsync)(npm, { cwd: path }, 'link', packageName, '--production');
|
28
28
|
}
|
29
29
|
};
|
30
30
|
//# sourceMappingURL=yarn-helper.js.map
|
package/dist/yarn-helper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"yarn-helper.js","sourceRoot":"","sources":["../src/yarn-helper.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAC9B,2BAA0B;AAC1B,+BAAiC;AACjC,6CAA0C;AAC1C,+BAA4B;AAG5B,oDAAoD;AACpD,IAAI;AAEJ,IAAI;AAEJ,SAAgB,OAAO,CAAC,IAAa;IAEjC,OAAO,gBAAS,
|
1
|
+
{"version":3,"file":"yarn-helper.js","sourceRoot":"","sources":["../src/yarn-helper.ts"],"names":[],"mappings":";;;AAAA,2BAA8B;AAC9B,2BAA0B;AAC1B,+BAAiC;AACjC,6CAA0C;AAC1C,+BAA4B;AAG5B,oDAAoD;AACpD,IAAI;AAEJ,IAAI;AAEJ,SAAgB,OAAO,CAAC,IAAa;IAEjC,OAAO,IAAA,gBAAS,EAAC,SAAI,CAAC,CAAC,IAAA,WAAI,EAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;AAC5F,CAAC;AAHD,0BAGC;AAED,IAAI,GAAG,GAAG,MAAM,CAAC;AACjB,IAAI,IAAA,aAAQ,GAAE,IAAI,OAAO;IACrB,GAAG,GAAG,UAAU,CAAC;AAErB,kBACI;IACI,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,IAAa;QAE5C,MAAM,IAAA,uBAAU,EAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;IAC5E,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,IAAa;QAE3C,MAAM,IAAA,uBAAU,EAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;IAChF,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,WAAmB,EAAE,IAAa;QAEzC,MAAM,IAAA,uBAAU,EAAC,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;IAC7E,CAAC;CACJ,CAAA"}
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"pm": "dist/cli.js",
|
5
5
|
"pm-fork": "dist/fork.js"
|
6
6
|
},
|
7
|
-
"version": "2.
|
7
|
+
"version": "2.4.1",
|
8
8
|
"scripts": {
|
9
9
|
"test": "echo 1",
|
10
10
|
"ac": "ac generate dist/commands commands.json",
|
@@ -18,12 +18,11 @@
|
|
18
18
|
},
|
19
19
|
"homepage": "https://akala.js.org/pm",
|
20
20
|
"dependencies": {
|
21
|
-
"@akala/cli": "1.
|
22
|
-
"@akala/commands": "2.
|
23
|
-
"@akala/core": "7.
|
24
|
-
"@akala/json-rpc-ws": "9.
|
21
|
+
"@akala/cli": "1.5.4",
|
22
|
+
"@akala/commands": "2.5.5",
|
23
|
+
"@akala/core": "7.5.9",
|
24
|
+
"@akala/json-rpc-ws": "9.3.1",
|
25
25
|
"debug": "^4.1.1",
|
26
|
-
"mock-require": "^3.0.3",
|
27
26
|
"reflect-metadata": "^0.1.13",
|
28
27
|
"source-map-support": "^0.5.19"
|
29
28
|
},
|
@@ -33,7 +32,7 @@
|
|
33
32
|
"@types/node": "^14.14.31",
|
34
33
|
"@types/source-map-support": "^0.5.4",
|
35
34
|
"@types/ws": "^7.4.6",
|
36
|
-
"typescript": "^4.
|
35
|
+
"typescript": "^4.4.0"
|
37
36
|
},
|
38
37
|
"gitHead": "d92f6693ed8cca439c8e92d2045bb15c0a7dae43"
|
39
38
|
}
|
package/src/cli.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
import * as path from 'path'
|
3
|
-
import { Processors, NetSocketAdapter, Metadata, Container,
|
3
|
+
import { Processors, NetSocketAdapter, Metadata, Container, ICommandProcessor, proxy, Triggers, Cli } from '@akala/commands';
|
4
4
|
import { Socket } from 'net';
|
5
5
|
import { TLSSocket } from 'tls';
|
6
6
|
import { platform, homedir } from 'os';
|
@@ -10,7 +10,7 @@ import { Readable } from 'stream';
|
|
10
10
|
import { spawnAsync } from './cli-helper';
|
11
11
|
import State from './state';
|
12
12
|
import program, { buildCliContextFromProcess, CliContext, NamespaceMiddleware, unparse } from '@akala/cli';
|
13
|
-
import { InteractError } from '.';
|
13
|
+
import { InteractError, pm } from '.';
|
14
14
|
|
15
15
|
const tableChars = {
|
16
16
|
'top': '─'
|
@@ -126,11 +126,15 @@ cli.command(null).preAction(async c =>
|
|
126
126
|
if (!processor)
|
127
127
|
processor = new Processors.JsonRpc(Processors.JsonRpc.getConnection(new NetSocketAdapter(socket)));
|
128
128
|
if (!metaContainer)
|
129
|
-
metaContainer =
|
129
|
+
metaContainer = require('../commands.json');
|
130
130
|
if (!container)
|
131
131
|
{
|
132
132
|
container = proxy(metaContainer, processor);
|
133
|
-
|
133
|
+
|
134
|
+
container.unregister(Cli.Metadata.name);
|
135
|
+
container.register(Metadata.extractCommandMetadata(Cli.Metadata));
|
136
|
+
|
137
|
+
await container.attach(Triggers.cli, handle);
|
134
138
|
}
|
135
139
|
}).
|
136
140
|
useMiddleware(handle).
|
@@ -146,7 +150,7 @@ cli.command(null).preAction(async c =>
|
|
146
150
|
args.args.push(value);
|
147
151
|
return await cli.process(args);
|
148
152
|
}
|
149
|
-
throw
|
153
|
+
throw undefined;
|
150
154
|
})
|
151
155
|
|
152
156
|
// handle.action(async args =>
|
@@ -191,8 +195,13 @@ program.useError((err: Error, context) =>
|
|
191
195
|
console.error('Error: ' + err.message);
|
192
196
|
return Promise.reject(err);
|
193
197
|
})
|
194
|
-
program.process(buildCliContextFromProcess()).then(
|
198
|
+
program.process(buildCliContextFromProcess()).then(result =>
|
195
199
|
{
|
200
|
+
if(result instanceof Readable)
|
201
|
+
{
|
202
|
+
result.pipe(process.stdout);
|
203
|
+
return;
|
204
|
+
}
|
196
205
|
if (socket)
|
197
206
|
socket.end();
|
198
207
|
}, err =>
|
@@ -206,6 +215,10 @@ function formatResult(result: unknown, outputFormat: string)
|
|
206
215
|
{
|
207
216
|
if (typeof result == 'undefined')
|
208
217
|
return;
|
218
|
+
if(result instanceof Readable)
|
219
|
+
{
|
220
|
+
return result;
|
221
|
+
}
|
209
222
|
switch (outputFormat)
|
210
223
|
{
|
211
224
|
case 'table':
|
@@ -381,7 +394,7 @@ function prepareParam(cmd: Metadata.Command, args: CliContext, standalone?: bool
|
|
381
394
|
return { options: args.options, param: args.args.slice(1), _trigger: 'cli', cwd: args.currentWorkingDirectory, context: args };
|
382
395
|
}
|
383
396
|
|
384
|
-
async function tryRun(processor:
|
397
|
+
async function tryRun(processor: ICommandProcessor, cmd: Metadata.Command, args: CliContext, localProcessing: boolean)
|
385
398
|
{
|
386
399
|
const params = prepareParam(cmd, args, localProcessing);
|
387
400
|
if (!params)
|
@@ -389,8 +402,7 @@ async function tryRun(processor: Processor, cmd: Metadata.Command, args: CliCont
|
|
389
402
|
|
390
403
|
try
|
391
404
|
{
|
392
|
-
|
393
|
-
const result = await processor.handle(cmd, params).then(err => { throw err }, res => res);
|
405
|
+
const result = await processor.handle(null, cmd, params).then(err => { throw err }, res => res);
|
394
406
|
if (result instanceof Readable)
|
395
407
|
result.pipe(process.stdout);
|
396
408
|
else
|
package/src/commands/$init.json
CHANGED
package/src/commands/$init.ts
CHANGED
@@ -3,8 +3,10 @@ import { homedir } from 'os';
|
|
3
3
|
import fs from 'fs/promises';
|
4
4
|
import { join } from 'path';
|
5
5
|
import pmContainer from '../container';
|
6
|
-
import { Container,
|
6
|
+
import { Container, Metadata, ignoredCommands, configure, ServeOptions, SelfDefinedCommand } from '@akala/commands';
|
7
7
|
import { eachAsync } from '@akala/core';
|
8
|
+
import { PassThrough, Readable } from 'stream';
|
9
|
+
import { EventEmitter } from 'events';
|
8
10
|
|
9
11
|
export async function metadata(container: Container<unknown>, deep?: boolean): Promise<Metadata.Container>
|
10
12
|
{
|
@@ -13,11 +15,10 @@ export async function metadata(container: Container<unknown>, deep?: boolean): P
|
|
13
15
|
{
|
14
16
|
if (key === '$injector' || key === '$state' || key === '$container' || ignoredCommands.indexOf(key) > -1 || key == '$init' || key == '$stop')
|
15
17
|
return;
|
16
|
-
const cmd = container.resolve<Command | Container<unknown>>(key);
|
17
|
-
if (cmd && cmd.name && cmd
|
18
|
+
const cmd = container.resolve<Metadata.Command | Container<unknown>>(key);
|
19
|
+
if (cmd && cmd.name && Metadata.isCommand(cmd) && ignoredCommands.indexOf(cmd.name) == -1)
|
18
20
|
metacontainer.commands.push({ name: cmd.name, inject: cmd.inject || [], config: cmd.config });
|
19
|
-
|
20
|
-
if (cmd instanceof Container && deep)
|
21
|
+
else if (cmd instanceof Container && deep)
|
21
22
|
{
|
22
23
|
if (isRunningContainer(cmd) && !cmd.running)
|
23
24
|
return;
|
@@ -43,6 +44,33 @@ export default async function (this: State, container: RunningContainer & pmCont
|
|
43
44
|
{
|
44
45
|
this.isDaemon = true;
|
45
46
|
this.processes = [];
|
47
|
+
const stderr=process.stderr.write;
|
48
|
+
const stderrPT=new PassThrough();
|
49
|
+
process.stderr.write=function(...args)
|
50
|
+
{
|
51
|
+
stderr.call(process.stderr, ...args);
|
52
|
+
return stderrPT.write(...args as [any, BufferEncoding]);
|
53
|
+
} as any;
|
54
|
+
|
55
|
+
const stdout=process.stdout.write;
|
56
|
+
const stdoutPT=new PassThrough();
|
57
|
+
process.stdout.write=function(...args)
|
58
|
+
{
|
59
|
+
stdout.call(process.stdout, ...args);
|
60
|
+
return stdoutPT.write(...args as [any, BufferEncoding]);
|
61
|
+
} as any;
|
62
|
+
container.process= Object.assign(new EventEmitter(), {stdout:stdoutPT, stderr:stderrPT, stdio:null, stdin:process.stdin,pid:process.pid, connected:false
|
63
|
+
,exitCode:undefined
|
64
|
+
,signalCode:undefined
|
65
|
+
,spawnargs:process.argv
|
66
|
+
,spawnfile: null
|
67
|
+
,kill:process.exit.bind(process)
|
68
|
+
,send:null
|
69
|
+
,disconnect:null
|
70
|
+
,unref:null
|
71
|
+
,ref:null
|
72
|
+
,killed:false });
|
73
|
+
|
46
74
|
const configPath = join(homedir(), './.pm.config.json');
|
47
75
|
try
|
48
76
|
{
|
@@ -84,7 +112,7 @@ export default async function (this: State, container: RunningContainer & pmCont
|
|
84
112
|
container.name = 'pm';
|
85
113
|
const config = container.resolve<Metadata.Configurations>('$metadata.config');
|
86
114
|
container.unregister('$metadata');
|
87
|
-
container.register(configure(config)(new
|
115
|
+
container.register(configure(config)(new SelfDefinedCommand(metadata, '$metadata', ['$container', 'param.0'])));
|
88
116
|
|
89
117
|
|
90
118
|
this.processes.push(container);
|
@@ -8,14 +8,15 @@
|
|
8
8
|
]
|
9
9
|
},
|
10
10
|
"cli": {
|
11
|
+
"usage": "discover <name> <folder>",
|
11
12
|
"options": {
|
12
|
-
"
|
13
|
-
"
|
14
|
-
|
13
|
+
"folder": {
|
14
|
+
"normalize": true
|
15
|
+
}
|
15
16
|
},
|
16
17
|
"inject": [
|
17
|
-
"
|
18
|
-
"
|
18
|
+
"options.name",
|
19
|
+
"options.folder",
|
19
20
|
"$container"
|
20
21
|
]
|
21
22
|
}
|
package/src/commands/discover.ts
CHANGED
@@ -61,7 +61,7 @@ export default async function discover(this: State, packageName: string, folder:
|
|
61
61
|
const moduleRequire = tmpRequire;
|
62
62
|
|
63
63
|
const packageConfig = moduleRequire('./package.json');
|
64
|
-
delete moduleRequire.cache['./package.json'];
|
64
|
+
delete moduleRequire.cache[moduleRequire.resolve('./package.json')];
|
65
65
|
|
66
66
|
if (packageConfig.commands)
|
67
67
|
{
|
package/src/commands/log.ts
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
+
import { PassThrough } from "stream";
|
1
2
|
import { Readable } from "stream";
|
2
3
|
import State from '../state';
|
3
4
|
|
4
|
-
export default function
|
5
|
+
export default function log(this: State, name: string): Readable
|
5
6
|
{
|
6
|
-
|
7
|
+
if(name=='pm')
|
8
|
+
{
|
9
|
+
const pt=new PassThrough();
|
10
|
+
process.stderr.pipe(pt);
|
11
|
+
process.stdout.pipe(pt);
|
12
|
+
return pt;
|
13
|
+
}
|
14
|
+
const p = this.processes.find(p => p.name == name)?.process;
|
7
15
|
return p?.stderr;
|
8
16
|
}
|
package/src/commands/start.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Container, Processors, Metadata, registerCommands,
|
1
|
+
import { Container, Processors, Metadata, registerCommands, Cli } from "@akala/commands";
|
2
2
|
import State, { RunningContainer } from '../state';
|
3
3
|
import { spawn, ChildProcess, StdioOptions } from "child_process";
|
4
4
|
import pmContainer from '../container';
|
@@ -74,7 +74,7 @@ export default async function start(this: State, pm: pmContainer.container & Con
|
|
74
74
|
{
|
75
75
|
console.log(message);
|
76
76
|
cp.disconnect();
|
77
|
-
})
|
77
|
+
});
|
78
78
|
return new Promise<void>((resolve) =>
|
79
79
|
{
|
80
80
|
cp.on('disconnect', function ()
|
@@ -142,12 +142,17 @@ export default async function start(this: State, pm: pmContainer.container & Con
|
|
142
142
|
container.path = name;
|
143
143
|
container.commandable = this.config.mapping[name].commandable;
|
144
144
|
container.ready = new jsonrpc.Deferred();
|
145
|
+
if (container.commandable)
|
146
|
+
{
|
147
|
+
container.unregister(Cli.Metadata.name);
|
148
|
+
container.register(Metadata.extractCommandMetadata(Cli.Metadata));
|
149
|
+
}
|
145
150
|
container.ready.then(() =>
|
146
151
|
{
|
147
|
-
container.dispatch('$metadata').then((metaContainer: Metadata.Container) =>
|
152
|
+
return container.dispatch('$metadata').then((metaContainer: Metadata.Container) =>
|
148
153
|
{
|
149
154
|
// console.log(metaContainer);
|
150
|
-
registerCommands(metaContainer.commands,
|
155
|
+
registerCommands(metaContainer.commands, null, container);
|
151
156
|
pm.register(name, container, true);
|
152
157
|
});
|
153
158
|
|
package/src/fork.ts
CHANGED
@@ -6,17 +6,12 @@ import * as ac from '@akala/commands';
|
|
6
6
|
import { lstat } from 'fs/promises';
|
7
7
|
import { IpcAdapter } from './commands/start';
|
8
8
|
import debug from 'debug';
|
9
|
-
import mock from 'mock-require'
|
10
9
|
import { Socket } from 'net';
|
11
10
|
import { module as coreModule } from '@akala/core';
|
12
11
|
import program, { buildCliContextFromProcess, NamespaceMiddleware } from '@akala/cli';
|
13
12
|
import { Stats } from 'fs';
|
14
13
|
import { registerCommands } from '@akala/commands';
|
15
14
|
|
16
|
-
mock('@akala/commands', ac);
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
18
|
-
mock('@akala/pm', require('..'));
|
19
|
-
|
20
15
|
var isPm = false;
|
21
16
|
|
22
17
|
program.useMiddleware({
|
@@ -29,7 +24,7 @@ program.useMiddleware({
|
|
29
24
|
});
|
30
25
|
let folderOrFile: Stats;
|
31
26
|
let cliContainer: ac.Container<unknown>;
|
32
|
-
let processor: ac.
|
27
|
+
let processor: ac.CommandProcessor;
|
33
28
|
let log: debug.Debugger;
|
34
29
|
const logMiddleware = new NamespaceMiddleware<{ program: string, name: string }>(null).option<string, 'verbose'>('verbose', { aliases: ['v',] });
|
35
30
|
logMiddleware.preAction(async c =>
|
@@ -64,9 +59,9 @@ program.option<string, 'program'>('program', { needsValue: true }).option<string
|
|
64
59
|
cliContainer = new ac.Container(c.options.name, {});
|
65
60
|
|
66
61
|
if (folderOrFile.isFile())
|
67
|
-
processor = new ac.Processors.FileSystem(
|
62
|
+
processor = new ac.Processors.FileSystem(path.dirname(c.options.program));
|
68
63
|
else
|
69
|
-
processor = new ac.Processors.FileSystem(
|
64
|
+
processor = new ac.Processors.FileSystem(c.options.program);
|
70
65
|
}
|
71
66
|
}).
|
72
67
|
useMiddleware(logMiddleware).
|
@@ -97,7 +92,10 @@ program.option<string, 'program'>('program', { needsValue: true }).option<string
|
|
97
92
|
pm = new ac.Container('pm', null, new ac.Processors.JsonRpc(ac.Processors.JsonRpc.getConnection(new ac.NetSocketAdapter(pmSocket), cliContainer), true));
|
98
93
|
}
|
99
94
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
100
|
-
registerCommands(require('../commands.json').commands,
|
95
|
+
registerCommands(require('../commands.json').commands.map(ac.Metadata.extractCommandMetadata), null, pm);
|
96
|
+
pm.unregister(ac.Cli.Metadata.name);
|
97
|
+
pm.register(ac.Metadata.extractCommandMetadata(ac.Cli.Metadata));
|
98
|
+
|
101
99
|
}
|
102
100
|
else
|
103
101
|
pm = cliContainer;
|
package/src/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { connectByPreference, Container, Metadata, NetSocketAdapter, Processors, registerCommands, ServeMetadata, ConnectionPreference } from "@akala/commands";
|
1
|
+
import { connectByPreference, Container, Metadata, NetSocketAdapter, Processors, registerCommands, ServeMetadata, ConnectionPreference, Cli } from "@akala/commands";
|
2
2
|
import { Socket } from "net";
|
3
3
|
import { module } from "@akala/core";
|
4
4
|
|
@@ -34,8 +34,8 @@ export async function pm(socketPath?: string): Promise<Container<unknown>>
|
|
34
34
|
const pmSocket = new Socket();
|
35
35
|
const pm = new Container('pm', null, new Processors.JsonRpc(Processors.JsonRpc.getConnection(new NetSocketAdapter(pmSocket)), true));
|
36
36
|
pmSocket.connect(socketPath);
|
37
|
-
const metaContainer: Metadata.Container = await pm.
|
38
|
-
registerCommands(metaContainer.commands,
|
37
|
+
const metaContainer: Metadata.Container = await pm.handle(pm, Cli.Metadata, { param: [] }).then(err => { throw err }, res => res);
|
38
|
+
registerCommands(metaContainer.commands, null, pm);
|
39
39
|
return pm;
|
40
40
|
}
|
41
41
|
return new Container('pm', {});
|