@akala/pm 15.3.2 → 15.3.4
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 +10 -1
- package/cli-commands.json +18 -12
- package/dist/esm/akala.mjs +2 -1
- package/dist/esm/akala.mjs.map +1 -1
- package/dist/esm/cli-commands/$init.d.ts +3 -2
- package/dist/esm/cli-commands/$init.js +3 -1
- package/dist/esm/cli-commands/$init.js.map +1 -1
- package/dist/esm/cli-commands/discover.d.ts +1 -1
- package/dist/esm/cli-commands/discover.js +11 -45
- package/dist/esm/cli-commands/discover.js.map +1 -1
- package/dist/esm/cli-commands/map.d.ts +1 -1
- package/dist/esm/cli-commands/map.js +4 -4
- package/dist/esm/cli-commands/map.js.map +1 -1
- package/dist/esm/cli-commands/run.js +3 -2
- package/dist/esm/cli-commands/run.js.map +1 -1
- package/dist/esm/cli-container.d.ts +27 -27
- package/dist/esm/cli-container.js +1 -1
- package/dist/esm/cli-container.js.map +1 -1
- package/dist/esm/commands/$init.js +1 -1
- package/dist/esm/commands/$init.js.map +1 -1
- package/dist/esm/container.d.ts +41 -41
- package/dist/esm/container.js +1 -1
- package/dist/esm/container.js.map +1 -1
- package/dist/esm/standalone.js +2 -2
- package/dist/esm/standalone.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/akala.mts +2 -1
- package/src/cli-commands/$init.json +2 -1
- package/src/cli-commands/$init.ts +4 -2
- package/src/cli-commands/discover.json +7 -7
- package/src/cli-commands/discover.ts +11 -55
- package/src/cli-commands/map.json +2 -0
- package/src/cli-commands/map.ts +4 -4
- package/src/cli-commands/run.ts +3 -1
- package/src/cli-container.ts +27 -27
- package/src/commands/$init.ts +1 -1
- package/src/container.ts +41 -41
- package/src/standalone.ts +2 -2
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"pm": "dist/esm/cli.js",
|
5
5
|
"pm-fork": "dist/esm/fork.js"
|
6
6
|
},
|
7
|
-
"version": "15.3.
|
7
|
+
"version": "15.3.4",
|
8
8
|
"scripts": {
|
9
9
|
"test": "echo 1",
|
10
10
|
"generate": "akala sdk generate dist/esm/commands commands.json --name pm && akala sdk generate dist/esm/cli-commands cli-commands.json --name pm",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
],
|
31
31
|
"dependencies": {
|
32
32
|
"@akala/cli": "^5.10.1",
|
33
|
-
"@akala/commands": "^
|
34
|
-
"@akala/config": "^6.0.
|
33
|
+
"@akala/commands": "^17.0.0",
|
34
|
+
"@akala/config": "^6.0.79",
|
35
35
|
"@akala/core": "^39.5.1",
|
36
36
|
"@akala/json-rpc-ws": "^12.0.1",
|
37
37
|
"reflect-metadata": "^0.2.2",
|
package/src/akala.mts
CHANGED
@@ -8,6 +8,7 @@ import commands from './container.js';
|
|
8
8
|
import cliCommands from './cli-container.js';
|
9
9
|
import Configuration from '@akala/config';
|
10
10
|
import { IpcAdapter } from './ipc-adapter.js';
|
11
|
+
import { FSFileSystemProvider } from '@akala/fs';
|
11
12
|
|
12
13
|
const log = logger('akala:pm');
|
13
14
|
|
@@ -60,7 +61,7 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
|
|
60
61
|
const pm = new Container('pm-cli', {});
|
61
62
|
|
62
63
|
const root = new URL('../../', import.meta.url);
|
63
|
-
const fs = new Processors.FileSystem(root);
|
64
|
+
const fs = new Processors.FileSystem(new FSFileSystemProvider(root, true));
|
64
65
|
|
65
66
|
registerCommands(cliCommands.meta.commands, fs, pm);
|
66
67
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import program, { CliContext } from "@akala/cli";
|
2
|
-
import { StateConfiguration } from "../state.js";
|
2
|
+
import State, { StateConfiguration } from "../state.js";
|
3
3
|
import { connect, Container } from "@akala/commands";
|
4
4
|
import { platform } from "os";
|
5
5
|
import { Triggers } from "@akala/commands";
|
@@ -9,7 +9,7 @@ import commands from "../container.js";
|
|
9
9
|
|
10
10
|
type CliOptions = { pmSock: string | number, tls: boolean };
|
11
11
|
|
12
|
-
export default async function (c: CliContext<CliOptions, ProxyConfiguration<{ pm?: StateConfiguration }>>)
|
12
|
+
export default async function (c: CliContext<CliOptions, ProxyConfiguration<{ pm?: StateConfiguration }>>, pm: Container<Partial<State>>)
|
13
13
|
{
|
14
14
|
let container: Container<unknown>;
|
15
15
|
|
@@ -51,6 +51,8 @@ export default async function (c: CliContext<CliOptions, ProxyConfiguration<{ pm
|
|
51
51
|
|
52
52
|
if (container)
|
53
53
|
await container.attach(Triggers.cli, program.command('pm'));
|
54
|
+
else
|
55
|
+
pm.state.config = c.state.pm;
|
54
56
|
// throw new ErrorWithStatus(HttpStatusCode.BadGateway, 'no connection option specified');
|
55
57
|
|
56
58
|
}
|
@@ -3,21 +3,21 @@
|
|
3
3
|
"": {
|
4
4
|
"inject": [
|
5
5
|
"params.0",
|
6
|
-
"
|
7
|
-
"
|
6
|
+
"$container",
|
7
|
+
"params.1"
|
8
8
|
]
|
9
9
|
},
|
10
10
|
"cli": {
|
11
|
-
"usage": "discover <
|
11
|
+
"usage": "discover <path> [name]",
|
12
12
|
"options": {
|
13
|
-
"
|
13
|
+
"path": {
|
14
14
|
"normalize": true
|
15
15
|
}
|
16
16
|
},
|
17
17
|
"inject": [
|
18
|
-
"options.
|
19
|
-
"
|
20
|
-
"
|
18
|
+
"options.path",
|
19
|
+
"$container",
|
20
|
+
"options.name"
|
21
21
|
]
|
22
22
|
}
|
23
23
|
}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import { join, isAbsolute, basename, resolve } from "path";
|
2
|
-
import { existsSync, promises as fs } from "fs";
|
3
1
|
import pmContainer from '../container.js';
|
4
2
|
import map from './map.js'
|
5
|
-
import { createRequire } from "module";
|
6
3
|
import { logger } from "@akala/core";
|
4
|
+
import fsHandler, { hasAccess, OpenFlags } from "@akala/fs";
|
7
5
|
|
8
6
|
|
9
7
|
type Unpromise<T> = T extends Promise<infer X> ? X : never;
|
@@ -12,55 +10,14 @@ type mapReturn = Unpromise<ReturnType<typeof map>>;
|
|
12
10
|
const log = logger('discover');
|
13
11
|
|
14
12
|
|
15
|
-
export default async function discover(
|
13
|
+
export default async function discover(path: string | URL, pm: pmContainer.container, name?: string): Promise<mapReturn[] | mapReturn>
|
16
14
|
{
|
17
15
|
// eslint-disable-next-line prefer-rest-params
|
18
16
|
log.debug(arguments);
|
19
17
|
|
20
|
-
|
18
|
+
const moduleFs = await fsHandler.process(new URL(path));
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
let tmpRequire: ReturnType<typeof createRequire> | undefined = undefined;
|
25
|
-
if (existsSync(path))
|
26
|
-
if (isAbsolute(packageName))
|
27
|
-
{
|
28
|
-
const stats = await fs.stat(packageName)
|
29
|
-
if (stats.isFile())
|
30
|
-
tmpRequire = createRequire(packageName);
|
31
|
-
else
|
32
|
-
tmpRequire = createRequire(join(packageName, './package.json'));
|
33
|
-
packageName = basename(packageName);
|
34
|
-
}
|
35
|
-
else
|
36
|
-
{
|
37
|
-
path = resolve(path);
|
38
|
-
const stats = await fs.stat(join(path, packageName))
|
39
|
-
if (stats.isFile())
|
40
|
-
tmpRequire = createRequire(join(path, packageName));
|
41
|
-
else
|
42
|
-
tmpRequire = createRequire(join(path, packageName, './package.json'));
|
43
|
-
}
|
44
|
-
|
45
|
-
if (typeof tmpRequire == 'undefined')
|
46
|
-
tmpRequire = createRequire(join(path, './package.json'));
|
47
|
-
|
48
|
-
function tryModuleRequireResolve(p: string)
|
49
|
-
{
|
50
|
-
try
|
51
|
-
{
|
52
|
-
return moduleRequire?.resolve(p)
|
53
|
-
}
|
54
|
-
catch (e)
|
55
|
-
{
|
56
|
-
return null;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
const moduleRequire = tmpRequire;
|
61
|
-
|
62
|
-
const packageConfig = moduleRequire('./package.json');
|
63
|
-
delete moduleRequire.cache[moduleRequire.resolve('./package.json')];
|
20
|
+
const packageConfig = await moduleFs.readFile<any>('./package.json', { encoding: 'json' })
|
64
21
|
|
65
22
|
if (packageConfig.commands)
|
66
23
|
{
|
@@ -70,9 +27,9 @@ export default async function discover(packageName: string, folder: string, pm:
|
|
70
27
|
if (Array.isArray(packageConfig))
|
71
28
|
throw new Error('commands property must be of type object or string');
|
72
29
|
|
73
|
-
return await Promise.all(Object.keys(packageConfig.commands).map(v => pm.dispatch('map', v,
|
30
|
+
return await Promise.all(Object.keys(packageConfig.commands).map(v => pm.dispatch('map', v, new URL(packageConfig.commands[v], moduleFs.root), 'nodejs', null, { commandable: true })));
|
74
31
|
case 'string':
|
75
|
-
return await pm.dispatch('map',
|
32
|
+
return await pm.dispatch('map', name ?? packageConfig.name, new URL(packageConfig.commands, moduleFs.root), 'nodejs', null, { commandable: true });
|
76
33
|
default:
|
77
34
|
throw new Error('commands property must be of type object or string');
|
78
35
|
}
|
@@ -85,17 +42,16 @@ export default async function discover(packageName: string, folder: string, pm:
|
|
85
42
|
case 'object':
|
86
43
|
if (Array.isArray(packageConfig))
|
87
44
|
throw new Error('bin property must be of type object or string');
|
88
|
-
return Promise.all(Object.keys(packageConfig.bin).map(v => pm.dispatch('map', v,
|
45
|
+
return Promise.all(Object.keys(packageConfig.bin).map(v => pm.dispatch('map', v, new URL(packageConfig.bin[v], moduleFs.root), 'nodejs', null, { commandable: false })));
|
89
46
|
case 'string':
|
90
|
-
return await pm.dispatch('map',
|
47
|
+
return await pm.dispatch('map', name ?? packageConfig.name, new URL('./' + packageConfig.bin, moduleFs.root), 'nodejs', null, { commandable: false });
|
91
48
|
default:
|
92
49
|
throw new Error('bin property must be of type object or string');
|
93
50
|
}
|
94
51
|
}
|
95
52
|
|
96
|
-
|
97
|
-
|
98
|
-
return pm.dispatch('map', packageName, commandsJsonFile, 'nodejs', path, { commandable: true });
|
53
|
+
if (await hasAccess(moduleFs, './commands.json', OpenFlags.Read))
|
54
|
+
return pm.dispatch('map', name ?? packageConfig.name, new URL('./commands.json', moduleFs.root), 'nodejs', null, { commandable: true });
|
99
55
|
|
100
|
-
return pm.dispatch('map',
|
56
|
+
return pm.dispatch('map', name ?? packageConfig.name, new URL('./' + packageConfig.main, moduleFs.root), 'nodejs', null, { commandable: false });
|
101
57
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/npenin/akala/main/packages/commands/command-schema.json",
|
3
3
|
"": {
|
4
4
|
"inject": [
|
5
|
+
"$state.config",
|
5
6
|
"params.0",
|
6
7
|
"params.1",
|
7
8
|
"params.2",
|
@@ -11,6 +12,7 @@
|
|
11
12
|
},
|
12
13
|
"cli": {
|
13
14
|
"inject": [
|
15
|
+
"context.state",
|
14
16
|
"options.name",
|
15
17
|
"options.path",
|
16
18
|
"options.runtime",
|
package/src/cli-commands/map.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import State, { SidecarMetadata } from '../state.js';
|
2
2
|
import { isAbsolute, resolve } from "path";
|
3
3
|
|
4
|
-
export default async function map<TName extends string>(
|
4
|
+
export default async function map<TName extends string>(config: State['config'], name: TName, targetPath: string | URL, runtime: SidecarMetadata['type'], cwd?: string, options?: { commandable?: boolean })
|
5
5
|
{
|
6
|
-
if (!isAbsolute(targetPath))
|
6
|
+
if (typeof targetPath == 'string' && !URL.canParse(targetPath) && !isAbsolute(targetPath))
|
7
7
|
targetPath = resolve(cwd || process.cwd(), targetPath);
|
8
|
-
|
9
|
-
await
|
8
|
+
config.containers.set(name, { type: runtime, path: targetPath.toString(), commandable: !!options?.commandable });
|
9
|
+
await config.commit();
|
10
10
|
return name
|
11
11
|
}
|
package/src/cli-commands/run.ts
CHANGED
@@ -77,8 +77,10 @@ export default async function run(program: string, name: string, c: CliContext<{
|
|
77
77
|
subContext.options.configFile = c.options.configFile + '#' + c.options.name;
|
78
78
|
subContext.state = c.state[c.options.name];
|
79
79
|
if (!subContext.state)
|
80
|
+
{
|
80
81
|
c.state[c.options.name] = {};
|
81
|
-
|
82
|
+
subContext.state = c.state[c.options.name];
|
83
|
+
}
|
82
84
|
|
83
85
|
await cli.process(subContext);
|
84
86
|
}
|
package/src/cli-container.ts
CHANGED
@@ -8,37 +8,37 @@ namespace cliCommands
|
|
8
8
|
{
|
9
9
|
export interface container
|
10
10
|
{
|
11
|
-
dispatch (cmd:'$init', ...args: [Argument0<typeof import('./cli-commands/$init.
|
12
|
-
dispatch (cmd:'connect', ...args: [Argument0<typeof import('./cli-commands/connect.
|
13
|
-
dispatch (cmd:'discover', ...args: [Argument0<typeof import('./cli-commands/discover.
|
14
|
-
dispatch (cmd:'install', ...args: [Argument0<typeof import('./cli-commands/install.
|
15
|
-
dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.
|
16
|
-
dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.
|
17
|
-
dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.
|
18
|
-
dispatch (cmd:'map', ...args: [
|
19
|
-
dispatch (cmd:'run', ...args: [Argument0<typeof import('./cli-commands/run.
|
20
|
-
dispatch (cmd:'start', ...args: [Argument0<typeof import('./cli-commands/start.
|
21
|
-
dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.
|
22
|
-
dispatch (cmd:'update', ...args: [Argument0<typeof import('./cli-commands/update.
|
23
|
-
dispatch (cmd:'version', ...args: [Argument0<typeof import('./cli-commands/version.
|
11
|
+
dispatch (cmd:'$init', ...args: [Argument0<typeof import('./cli-commands/$init.ts').default>, Argument1<typeof import('./cli-commands/$init.ts').default>]): ReturnType<typeof import('./cli-commands/$init.ts').default>
|
12
|
+
dispatch (cmd:'connect', ...args: [Argument0<typeof import('./cli-commands/connect.ts').default>, Argument1<typeof import('./cli-commands/connect.ts').default>]): ReturnType<typeof import('./cli-commands/connect.ts').default>
|
13
|
+
dispatch (cmd:'discover', ...args: [Argument0<typeof import('./cli-commands/discover.ts').default>, Argument2<typeof import('./cli-commands/discover.ts').default>]): ReturnType<typeof import('./cli-commands/discover.ts').default>
|
14
|
+
dispatch (cmd:'install', ...args: [Argument0<typeof import('./cli-commands/install.ts').default>]): ReturnType<typeof import('./cli-commands/install.ts').default>
|
15
|
+
dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.ts').default>, Argument1<typeof import('./cli-commands/link.ts').default>]): ReturnType<typeof import('./cli-commands/link.ts').default>
|
16
|
+
dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.ts').default>]): ReturnType<typeof import('./cli-commands/log.ts').default>
|
17
|
+
dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.ts').default>
|
18
|
+
dispatch (cmd:'map', ...args: [Argument1<typeof import('./cli-commands/map.ts').default>, Argument2<typeof import('./cli-commands/map.ts').default>, Argument3<typeof import('./cli-commands/map.ts').default>, Argument4<typeof import('./cli-commands/map.ts').default>, Argument5<typeof import('./cli-commands/map.ts').default>]): ReturnType<typeof import('./cli-commands/map.ts').default>
|
19
|
+
dispatch (cmd:'run', ...args: [Argument0<typeof import('./cli-commands/run.ts').default>, Argument1<typeof import('./cli-commands/run.ts').default>]): ReturnType<typeof import('./cli-commands/run.ts').default>
|
20
|
+
dispatch (cmd:'start', ...args: [Argument0<typeof import('./cli-commands/start.ts').default>, Argument1<typeof import('./cli-commands/start.ts').default>]): ReturnType<typeof import('./cli-commands/start.ts').default>
|
21
|
+
dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.ts').default>]): ReturnType<typeof import('./cli-commands/uninstall.ts').default>
|
22
|
+
dispatch (cmd:'update', ...args: [Argument0<typeof import('./cli-commands/update.ts').default>, Argument1<typeof import('./cli-commands/update.ts').default>, Argument2<typeof import('./cli-commands/update.ts').default>]): ReturnType<typeof import('./cli-commands/update.ts').default>
|
23
|
+
dispatch (cmd:'version', ...args: [Argument0<typeof import('./cli-commands/version.ts').default>, Argument1<typeof import('./cli-commands/version.ts').default>]): ReturnType<typeof import('./cli-commands/version.ts').default>
|
24
24
|
}
|
25
25
|
export interface proxy
|
26
26
|
{
|
27
|
-
'$init'(...args: [Argument0<typeof import('./cli-commands/$init.
|
28
|
-
'connect'(...args: [Argument0<typeof import('./cli-commands/connect.
|
29
|
-
'discover'(...args: [Argument0<typeof import('./cli-commands/discover.
|
30
|
-
'install'(...args: [Argument0<typeof import('./cli-commands/install.
|
31
|
-
'link'(...args: [Argument0<typeof import('./cli-commands/link.
|
32
|
-
'log'(...args: [Argument0<typeof import('./cli-commands/log.
|
33
|
-
'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.
|
34
|
-
'map'(...args: [
|
35
|
-
'run'(...args: [Argument0<typeof import('./cli-commands/run.
|
36
|
-
'start'(...args: [Argument0<typeof import('./cli-commands/start.
|
37
|
-
'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.
|
38
|
-
'update'(...args: [Argument0<typeof import('./cli-commands/update.
|
39
|
-
'version'(...args: [Argument0<typeof import('./cli-commands/version.
|
27
|
+
'$init'(...args: [Argument0<typeof import('./cli-commands/$init.ts').default>, Argument1<typeof import('./cli-commands/$init.ts').default>]): ReturnType<typeof import('./cli-commands/$init.ts').default>
|
28
|
+
'connect'(...args: [Argument0<typeof import('./cli-commands/connect.ts').default>, Argument1<typeof import('./cli-commands/connect.ts').default>]): ReturnType<typeof import('./cli-commands/connect.ts').default>
|
29
|
+
'discover'(...args: [Argument0<typeof import('./cli-commands/discover.ts').default>, Argument2<typeof import('./cli-commands/discover.ts').default>]): ReturnType<typeof import('./cli-commands/discover.ts').default>
|
30
|
+
'install'(...args: [Argument0<typeof import('./cli-commands/install.ts').default>]): ReturnType<typeof import('./cli-commands/install.ts').default>
|
31
|
+
'link'(...args: [Argument0<typeof import('./cli-commands/link.ts').default>, Argument1<typeof import('./cli-commands/link.ts').default>]): ReturnType<typeof import('./cli-commands/link.ts').default>
|
32
|
+
'log'(...args: [Argument0<typeof import('./cli-commands/log.ts').default>]): ReturnType<typeof import('./cli-commands/log.ts').default>
|
33
|
+
'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.ts').default>
|
34
|
+
'map'(...args: [Argument1<typeof import('./cli-commands/map.ts').default>, Argument2<typeof import('./cli-commands/map.ts').default>, Argument3<typeof import('./cli-commands/map.ts').default>, Argument4<typeof import('./cli-commands/map.ts').default>, Argument5<typeof import('./cli-commands/map.ts').default>]): ReturnType<typeof import('./cli-commands/map.ts').default>
|
35
|
+
'run'(...args: [Argument0<typeof import('./cli-commands/run.ts').default>, Argument1<typeof import('./cli-commands/run.ts').default>]): ReturnType<typeof import('./cli-commands/run.ts').default>
|
36
|
+
'start'(...args: [Argument0<typeof import('./cli-commands/start.ts').default>, Argument1<typeof import('./cli-commands/start.ts').default>]): ReturnType<typeof import('./cli-commands/start.ts').default>
|
37
|
+
'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.ts').default>]): ReturnType<typeof import('./cli-commands/uninstall.ts').default>
|
38
|
+
'update'(...args: [Argument0<typeof import('./cli-commands/update.ts').default>, Argument1<typeof import('./cli-commands/update.ts').default>, Argument2<typeof import('./cli-commands/update.ts').default>]): ReturnType<typeof import('./cli-commands/update.ts').default>
|
39
|
+
'version'(...args: [Argument0<typeof import('./cli-commands/version.ts').default>, Argument1<typeof import('./cli-commands/version.ts').default>]): ReturnType<typeof import('./cli-commands/version.ts').default>
|
40
40
|
}
|
41
|
-
export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"path":"dist/esm/cli-commands/$init.js","source":"src/cli-commands/$init.ts","inject":["params.0"]},"cli":{"inject":["context"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["params.0"]}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["params.0","params.1"
|
41
|
+
export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"path":"dist/esm/cli-commands/$init.js","source":"src/cli-commands/$init.ts","inject":["params.0","params.1"]},"cli":{"inject":["context","$container"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["params.0","params.1"]}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["params.0","$container","params.1"]},"":{"inject":["params.0","$container","params.1"]},"cli":{"usage":"discover <path> [name]","options":{"path":{"normalize":true}},"inject":["options.path","$container","options.name"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["params.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["params.0","params.1","$container"]},"":{"inject":["params.0","params.1","$container"]},"cli":{"inject":["params.0","params.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["params.0"]},"":{"inject":["params.0"]},"cli":{"inject":["params.0"]}}},{"name":"ls","config":{"fs":{"path":"dist/esm/cli-commands/ls.js","source":"src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"dist/esm/cli-commands/map.js","source":"src/cli-commands/map.ts","inject":["$state.config","params.0","params.1","params.2","params.3","params.4"]},"":{"inject":["$state.config","params.0","params.1","params.2","params.3","params.4"]},"cli":{"inject":["context.state","options.name","options.path","options.runtime","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false},"runtime":{"aliases":["r"],"needsValue":true}},"usage":"map <name> <path>"}}},{"name":"run","config":{"fs":{"path":"dist/esm/cli-commands/run.js","source":"src/cli-commands/run.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"jsonrpc":false,"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["options.program","options.name","context","options.pmSock"],"usage":"run <name> [...args]"}}},{"name":"start","config":{"fs":{"path":"dist/esm/cli-commands/start.js","source":"src/cli-commands/start.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"}},"inject":["options.program","context"],"usage":"start pm"}}},{"name":"uninstall","config":{"fs":{"path":"dist/esm/cli-commands/uninstall.js","source":"src/cli-commands/uninstall.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["params.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["params.0","params.1","params.2"]},"cli":{"inject":["params.0","params.1","$container"]},"":{"inject":["params.0","params.1","params.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["params.0","params.1"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"string"}}}}}],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
|
42
42
|
|
43
43
|
export function connect(processor?:ICommandProcessor) {
|
44
44
|
const container = new Container<void>("cliCommands", void 0);
|
package/src/commands/$init.ts
CHANGED
@@ -26,7 +26,7 @@ export async function metadata(container: Container<unknown>, deep?: boolean): P
|
|
26
26
|
try
|
27
27
|
{
|
28
28
|
const subContainer = await cmd.dispatch('$metadata', deep) as Metadata.Container;
|
29
|
-
console.log(subContainer);
|
29
|
+
//console.log(subContainer);
|
30
30
|
if (subContainer && subContainer.commands)
|
31
31
|
{
|
32
32
|
subContainer.commands.forEach(c => c.name = key + '.' + c.name)
|
package/src/container.ts
CHANGED
@@ -8,51 +8,51 @@ namespace commands
|
|
8
8
|
{
|
9
9
|
export interface container
|
10
10
|
{
|
11
|
-
dispatch (cmd:'bridge', ...args: [Argument0<typeof import('./commands/bridge.
|
12
|
-
dispatch (cmd:'name', ...args: [Argument0<typeof import('./commands/name.
|
13
|
-
dispatch (cmd:'proxy', ...args: [Argument0<typeof import('./commands/proxy.
|
14
|
-
dispatch (cmd:'ready', ...args: [Argument1<typeof import('./commands/ready.
|
15
|
-
dispatch (cmd:'reload-metadata', ...args: [Argument0<typeof import('./commands/reload-metadata.
|
16
|
-
dispatch (cmd:'restart', ...args: [Argument1<typeof import('./commands/restart.
|
17
|
-
dispatch (cmd:'start', ...args: [Argument1<typeof import('./commands/start.
|
18
|
-
dispatch (cmd:'status', ...args: [Argument0<typeof import('./commands/status.
|
19
|
-
dispatch (cmd:'stop', ...args: [Argument0<typeof import('./commands/stop.
|
20
|
-
dispatch (cmd:'connect', ...args: [Argument0<typeof import('./cli-commands/connect.
|
21
|
-
dispatch (cmd:'discover', ...args: [Argument0<typeof import('./cli-commands/discover.
|
22
|
-
dispatch (cmd:'install', ...args: [Argument0<typeof import('./cli-commands/install.
|
23
|
-
dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.
|
24
|
-
dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.
|
25
|
-
dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.
|
26
|
-
dispatch (cmd:'map', ...args: [
|
27
|
-
dispatch (cmd:'run', ...args: [Argument0<typeof import('./cli-commands/run.
|
28
|
-
dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.
|
29
|
-
dispatch (cmd:'update', ...args: [Argument0<typeof import('./cli-commands/update.
|
30
|
-
dispatch (cmd:'version', ...args: [Argument0<typeof import('./cli-commands/version.
|
11
|
+
dispatch (cmd:'bridge', ...args: [Argument0<typeof import('./commands/bridge.ts').default>, Argument1<typeof import('./commands/bridge.ts').default>]): ReturnType<typeof import('./commands/bridge.ts').default>
|
12
|
+
dispatch (cmd:'name', ...args: [Argument0<typeof import('./commands/name.ts').default>]): ReturnType<typeof import('./commands/name.ts').default>
|
13
|
+
dispatch (cmd:'proxy', ...args: [Argument0<typeof import('./commands/proxy.ts').default>, Argument1<typeof import('./commands/proxy.ts').default>]): ReturnType<typeof import('./commands/proxy.ts').default>
|
14
|
+
dispatch (cmd:'ready', ...args: [Argument1<typeof import('./commands/ready.ts').default>]): ReturnType<typeof import('./commands/ready.ts').default>
|
15
|
+
dispatch (cmd:'reload-metadata', ...args: [Argument0<typeof import('./commands/reload-metadata.ts').default>]): ReturnType<typeof import('./commands/reload-metadata.ts').default>
|
16
|
+
dispatch (cmd:'restart', ...args: [Argument1<typeof import('./commands/restart.ts').default>, Argument2<typeof import('./commands/restart.ts').default>]): ReturnType<typeof import('./commands/restart.ts').default>
|
17
|
+
dispatch (cmd:'start', ...args: [Argument1<typeof import('./commands/start.ts').default>, Argument2<typeof import('./commands/start.ts').default>, Argument3<typeof import('./commands/start.ts').default>]): ReturnType<typeof import('./commands/start.ts').default>
|
18
|
+
dispatch (cmd:'status', ...args: [Argument0<typeof import('./commands/status.ts').default>]): ReturnType<typeof import('./commands/status.ts').default>
|
19
|
+
dispatch (cmd:'stop', ...args: [Argument0<typeof import('./commands/stop.ts').default>]): ReturnType<typeof import('./commands/stop.ts').default>
|
20
|
+
dispatch (cmd:'connect', ...args: [Argument0<typeof import('./cli-commands/connect.ts').default>, Argument1<typeof import('./cli-commands/connect.ts').default>]): ReturnType<typeof import('./cli-commands/connect.ts').default>
|
21
|
+
dispatch (cmd:'discover', ...args: [Argument0<typeof import('./cli-commands/discover.ts').default>, Argument2<typeof import('./cli-commands/discover.ts').default>]): ReturnType<typeof import('./cli-commands/discover.ts').default>
|
22
|
+
dispatch (cmd:'install', ...args: [Argument0<typeof import('./cli-commands/install.ts').default>]): ReturnType<typeof import('./cli-commands/install.ts').default>
|
23
|
+
dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.ts').default>, Argument1<typeof import('./cli-commands/link.ts').default>]): ReturnType<typeof import('./cli-commands/link.ts').default>
|
24
|
+
dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.ts').default>]): ReturnType<typeof import('./cli-commands/log.ts').default>
|
25
|
+
dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.ts').default>
|
26
|
+
dispatch (cmd:'map', ...args: [Argument1<typeof import('./cli-commands/map.ts').default>, Argument2<typeof import('./cli-commands/map.ts').default>, Argument3<typeof import('./cli-commands/map.ts').default>, Argument4<typeof import('./cli-commands/map.ts').default>, Argument5<typeof import('./cli-commands/map.ts').default>]): ReturnType<typeof import('./cli-commands/map.ts').default>
|
27
|
+
dispatch (cmd:'run', ...args: [Argument0<typeof import('./cli-commands/run.ts').default>, Argument1<typeof import('./cli-commands/run.ts').default>]): ReturnType<typeof import('./cli-commands/run.ts').default>
|
28
|
+
dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.ts').default>]): ReturnType<typeof import('./cli-commands/uninstall.ts').default>
|
29
|
+
dispatch (cmd:'update', ...args: [Argument0<typeof import('./cli-commands/update.ts').default>, Argument1<typeof import('./cli-commands/update.ts').default>, Argument2<typeof import('./cli-commands/update.ts').default>]): ReturnType<typeof import('./cli-commands/update.ts').default>
|
30
|
+
dispatch (cmd:'version', ...args: [Argument0<typeof import('./cli-commands/version.ts').default>, Argument1<typeof import('./cli-commands/version.ts').default>]): ReturnType<typeof import('./cli-commands/version.ts').default>
|
31
31
|
}
|
32
32
|
export interface proxy
|
33
33
|
{
|
34
|
-
'bridge'(...args: [Argument0<typeof import('./commands/bridge.
|
35
|
-
'name'(...args: [Argument0<typeof import('./commands/name.
|
36
|
-
'proxy'(...args: [Argument0<typeof import('./commands/proxy.
|
37
|
-
'ready'(...args: [Argument1<typeof import('./commands/ready.
|
38
|
-
'reload-metadata'(...args: [Argument0<typeof import('./commands/reload-metadata.
|
39
|
-
'restart'(...args: [Argument1<typeof import('./commands/restart.
|
40
|
-
'start'(...args: [Argument1<typeof import('./commands/start.
|
41
|
-
'status'(...args: [Argument0<typeof import('./commands/status.
|
42
|
-
'stop'(...args: [Argument0<typeof import('./commands/stop.
|
43
|
-
'connect'(...args: [Argument0<typeof import('./cli-commands/connect.
|
44
|
-
'discover'(...args: [Argument0<typeof import('./cli-commands/discover.
|
45
|
-
'install'(...args: [Argument0<typeof import('./cli-commands/install.
|
46
|
-
'link'(...args: [Argument0<typeof import('./cli-commands/link.
|
47
|
-
'log'(...args: [Argument0<typeof import('./cli-commands/log.
|
48
|
-
'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.
|
49
|
-
'map'(...args: [
|
50
|
-
'run'(...args: [Argument0<typeof import('./cli-commands/run.
|
51
|
-
'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.
|
52
|
-
'update'(...args: [Argument0<typeof import('./cli-commands/update.
|
53
|
-
'version'(...args: [Argument0<typeof import('./cli-commands/version.
|
34
|
+
'bridge'(...args: [Argument0<typeof import('./commands/bridge.ts').default>, Argument1<typeof import('./commands/bridge.ts').default>]): ReturnType<typeof import('./commands/bridge.ts').default>
|
35
|
+
'name'(...args: [Argument0<typeof import('./commands/name.ts').default>]): ReturnType<typeof import('./commands/name.ts').default>
|
36
|
+
'proxy'(...args: [Argument0<typeof import('./commands/proxy.ts').default>, Argument1<typeof import('./commands/proxy.ts').default>]): ReturnType<typeof import('./commands/proxy.ts').default>
|
37
|
+
'ready'(...args: [Argument1<typeof import('./commands/ready.ts').default>]): ReturnType<typeof import('./commands/ready.ts').default>
|
38
|
+
'reload-metadata'(...args: [Argument0<typeof import('./commands/reload-metadata.ts').default>]): ReturnType<typeof import('./commands/reload-metadata.ts').default>
|
39
|
+
'restart'(...args: [Argument1<typeof import('./commands/restart.ts').default>, Argument2<typeof import('./commands/restart.ts').default>]): ReturnType<typeof import('./commands/restart.ts').default>
|
40
|
+
'start'(...args: [Argument1<typeof import('./commands/start.ts').default>, Argument2<typeof import('./commands/start.ts').default>, Argument3<typeof import('./commands/start.ts').default>]): ReturnType<typeof import('./commands/start.ts').default>
|
41
|
+
'status'(...args: [Argument0<typeof import('./commands/status.ts').default>]): ReturnType<typeof import('./commands/status.ts').default>
|
42
|
+
'stop'(...args: [Argument0<typeof import('./commands/stop.ts').default>]): ReturnType<typeof import('./commands/stop.ts').default>
|
43
|
+
'connect'(...args: [Argument0<typeof import('./cli-commands/connect.ts').default>, Argument1<typeof import('./cli-commands/connect.ts').default>]): ReturnType<typeof import('./cli-commands/connect.ts').default>
|
44
|
+
'discover'(...args: [Argument0<typeof import('./cli-commands/discover.ts').default>, Argument2<typeof import('./cli-commands/discover.ts').default>]): ReturnType<typeof import('./cli-commands/discover.ts').default>
|
45
|
+
'install'(...args: [Argument0<typeof import('./cli-commands/install.ts').default>]): ReturnType<typeof import('./cli-commands/install.ts').default>
|
46
|
+
'link'(...args: [Argument0<typeof import('./cli-commands/link.ts').default>, Argument1<typeof import('./cli-commands/link.ts').default>]): ReturnType<typeof import('./cli-commands/link.ts').default>
|
47
|
+
'log'(...args: [Argument0<typeof import('./cli-commands/log.ts').default>]): ReturnType<typeof import('./cli-commands/log.ts').default>
|
48
|
+
'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.ts').default>
|
49
|
+
'map'(...args: [Argument1<typeof import('./cli-commands/map.ts').default>, Argument2<typeof import('./cli-commands/map.ts').default>, Argument3<typeof import('./cli-commands/map.ts').default>, Argument4<typeof import('./cli-commands/map.ts').default>, Argument5<typeof import('./cli-commands/map.ts').default>]): ReturnType<typeof import('./cli-commands/map.ts').default>
|
50
|
+
'run'(...args: [Argument0<typeof import('./cli-commands/run.ts').default>, Argument1<typeof import('./cli-commands/run.ts').default>]): ReturnType<typeof import('./cli-commands/run.ts').default>
|
51
|
+
'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.ts').default>]): ReturnType<typeof import('./cli-commands/uninstall.ts').default>
|
52
|
+
'update'(...args: [Argument0<typeof import('./cli-commands/update.ts').default>, Argument1<typeof import('./cli-commands/update.ts').default>, Argument2<typeof import('./cli-commands/update.ts').default>]): ReturnType<typeof import('./cli-commands/update.ts').default>
|
53
|
+
'version'(...args: [Argument0<typeof import('./cli-commands/version.ts').default>, Argument1<typeof import('./cli-commands/version.ts').default>]): ReturnType<typeof import('./cli-commands/version.ts').default>
|
54
54
|
}
|
55
|
-
export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","params.0"]},"":{"inject":["$container","params.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["params.0","params.1"]},"jsonrpc":{"inject":["params.0","socket"]},"":{"inject":["params.0","params.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["params.0"]},"":{"inject":["params.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["params.0","params.1"]},"jsonrpc":{"inject":["params.0","socket"]},"":{"inject":["params.0","params.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","params.0"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"pm":{"inject":["$container","params.0"]},"":{"inject":["$container","params.0"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["params.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["params.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","params.0","params.1"]},"":{"inject":["$container","params.0","params.1"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","params.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","params.0","params.1"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","params.0","params.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","params.0","params.1","params.2"]},"":{"inject":["$container","params.0","params.1","params.2"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"},"autostart":{"doc":"start automatically when pm starts"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","params.0","params.1","params.2"]},"schema":{"inject":["$container","params.0","params.1","params.2"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"params.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["params.0"]},"":{"inject":["params.0"]},"cli":{"inject":["params.0"]},"html-form":{"inject":["params.0"]},"schema":{"inject":["params.0"],"$defs":{"params.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["params.0","$container"]},"schema":{"inject":["params.0","$container"],"$defs":{"params.0":{"type":"string"}}}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["params.0","params.1"
|
55
|
+
export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","params.0"]},"":{"inject":["$container","params.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["params.0","params.1"]},"jsonrpc":{"inject":["params.0","socket"]},"":{"inject":["params.0","params.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["params.0"]},"":{"inject":["params.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["params.0","params.1"]},"jsonrpc":{"inject":["params.0","socket"]},"":{"inject":["params.0","params.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","params.0"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"pm":{"inject":["$container","params.0"]},"":{"inject":["$container","params.0"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["params.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["params.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","params.0","params.1"]},"":{"inject":["$container","params.0","params.1"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["$container","params.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","params.0","params.1"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","params.0","params.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","params.0","params.1","params.2"]},"":{"inject":["$container","params.0","params.1","params.2"]},"cli":{"options":{"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"},"autostart":{"doc":"start automatically when pm starts"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","params.0","params.1","params.2"]},"schema":{"inject":["$container","params.0","params.1","params.2"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"params.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["params.0"]},"":{"inject":["params.0"]},"cli":{"inject":["params.0"]},"html-form":{"inject":["params.0"]},"schema":{"inject":["params.0"],"$defs":{"params.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["params.0","$container"]},"schema":{"inject":["params.0","$container"],"$defs":{"params.0":{"type":"string"}}}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["params.0","$container","params.1"]},"":{"inject":["params.0","$container","params.1"]},"cli":{"usage":"discover <path> [name]","options":{"path":{"normalize":true}},"inject":["options.path","$container","options.name"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["params.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["params.0","params.1","$container"]},"":{"inject":["params.0","params.1","$container"]},"cli":{"inject":["params.0","params.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["params.0"]},"":{"inject":["params.0"]},"cli":{"inject":["params.0"]}}},{"name":"ls","config":{"fs":{"path":"dist/esm/cli-commands/ls.js","source":"src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"dist/esm/cli-commands/map.js","source":"src/cli-commands/map.ts","inject":["$state.config","params.0","params.1","params.2","params.3","params.4"]},"":{"inject":["$state.config","params.0","params.1","params.2","params.3","params.4"]},"cli":{"inject":["context.state","options.name","options.path","options.runtime","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false},"runtime":{"aliases":["r"],"needsValue":true}},"usage":"map <name> <path>"}}},{"name":"run","config":{"fs":{"path":"dist/esm/cli-commands/run.js","source":"src/cli-commands/run.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"jsonrpc":false,"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["options.program","options.name","context","options.pmSock"],"usage":"run <name> [...args]"}}},{"name":"uninstall","config":{"fs":{"path":"dist/esm/cli-commands/uninstall.js","source":"src/cli-commands/uninstall.ts","inject":["params.0","$container"]},"":{"inject":["params.0","$container"]},"cli":{"inject":["params.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["params.0","params.1","params.2"]},"cli":{"inject":["params.0","params.1","$container"]},"":{"inject":["params.0","params.1","params.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["params.0","params.1"]},"":{"inject":["params.0","params.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["params.0","params.1"],"$defs":{"params.0":{"type":"string"},"params.1":{"type":"string"}}}}}],"extends":["./cli-commands.json"],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
|
56
56
|
|
57
57
|
export function connect(processor?:ICommandProcessor) {
|
58
58
|
const container = new Container<void>("commands", void 0);
|