@akala/pm 15.2.3 → 15.2.5
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/commands.json +2 -2
- package/dist/esm/cli-commands/run.js +2 -0
- package/dist/esm/cli-commands/run.js.map +1 -1
- package/dist/esm/commands/$init.js +3 -2
- package/dist/esm/commands/$init.js.map +1 -1
- package/dist/esm/commands/ready.d.ts +1 -1
- package/dist/esm/commands/ready.js +1 -1
- package/dist/esm/commands/ready.js.map +1 -1
- package/dist/esm/container.d.ts +2 -2
- package/dist/esm/container.js +1 -1
- package/dist/esm/container.js.map +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/cli-commands/run.ts +3 -0
- package/src/commands/$init.ts +4 -2
- package/src/commands/ready.json +8 -2
- package/src/commands/ready.ts +3 -3
- package/src/container.ts +3 -3
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.2.
|
7
|
+
"version": "15.2.5",
|
8
8
|
"scripts": {
|
9
9
|
"test": "echo 1",
|
10
10
|
"generate": "ac generate dist/esm/commands commands.json --name pm && ac generate dist/esm/cli-commands cli-commands.json --name pm",
|
@@ -29,11 +29,11 @@
|
|
29
29
|
"src/fork.ts"
|
30
30
|
],
|
31
31
|
"dependencies": {
|
32
|
-
"@akala/cli": "^5.9.
|
33
|
-
"@akala/commands": "^15.1.
|
34
|
-
"@akala/config": "^6.0.
|
35
|
-
"@akala/core": "^39.3.
|
36
|
-
"@akala/json-rpc-ws": "^11.0.
|
32
|
+
"@akala/cli": "^5.9.2",
|
33
|
+
"@akala/commands": "^15.1.3",
|
34
|
+
"@akala/config": "^6.0.73",
|
35
|
+
"@akala/core": "^39.3.1",
|
36
|
+
"@akala/json-rpc-ws": "^11.0.81",
|
37
37
|
"reflect-metadata": "^0.2.2",
|
38
38
|
"source-map-support": "^0.5.21"
|
39
39
|
},
|
package/src/cli-commands/run.ts
CHANGED
@@ -101,6 +101,9 @@ export default async function run(program: string, name: string, c: CliContext<{
|
|
101
101
|
|
102
102
|
if (pm !== cliContainer)
|
103
103
|
await pm.dispatch('ready')
|
104
|
+
else
|
105
|
+
await pm.dispatch('ready', { _trigger: 'pm', param: [pm] })
|
106
|
+
|
104
107
|
|
105
108
|
return new Promise(resolve => c.abort.signal.addEventListener('abort', resolve))
|
106
109
|
}
|
package/src/commands/$init.ts
CHANGED
@@ -6,7 +6,7 @@ import { PassThrough } from 'stream';
|
|
6
6
|
import { CliContext } from '@akala/cli';
|
7
7
|
import { Configuration } from '@akala/config';
|
8
8
|
import { fileURLToPath } from 'url';
|
9
|
-
import { eachAsync } from '@akala/core';
|
9
|
+
import { eachAsync, Event } from '@akala/core';
|
10
10
|
import Process from '../runtimes/process.js';
|
11
11
|
|
12
12
|
export async function metadata(container: Container<unknown>, deep?: boolean): Promise<Metadata.Container>
|
@@ -77,6 +77,8 @@ export default async function (this: State, container: RunningContainer & pmCont
|
|
77
77
|
stdin: process.stdin
|
78
78
|
});
|
79
79
|
|
80
|
+
container.ready = new Event();
|
81
|
+
|
80
82
|
const configPath = context.options.configFile || './.pm.config.json';
|
81
83
|
this.config = await Configuration.load<StateConfiguration>(configPath, true);
|
82
84
|
|
@@ -126,7 +128,7 @@ export default async function (this: State, container: RunningContainer & pmCont
|
|
126
128
|
await eachAsync(this.config.mapping.extract(), async (mapping, name) =>
|
127
129
|
{
|
128
130
|
if (mapping.autostart)
|
129
|
-
|
131
|
+
container.ready.addListener(() => container.dispatch('start', name, { autostart: true, wait: true }, { args: mapping.cli || [] }));
|
130
132
|
});
|
131
133
|
}
|
132
134
|
|
package/src/commands/ready.json
CHANGED
package/src/commands/ready.ts
CHANGED
@@ -2,11 +2,11 @@ import { $metadata, Container, Metadata, registerCommands, SelfDefinedCommand }
|
|
2
2
|
import pm from '../container.js';
|
3
3
|
import State, { RunningContainer } from '../state.js';
|
4
4
|
|
5
|
-
export default async function ready(this: State, pm: pm.container & Container<State>, container: RunningContainer, standaloneContainer:
|
5
|
+
export default async function ready(this: State, pm: pm.container & Container<State>, container: RunningContainer, standaloneContainer: RunningContainer): Promise<void>
|
6
6
|
{
|
7
|
-
if (standaloneContainer
|
7
|
+
if (standaloneContainer?.process)
|
8
8
|
{
|
9
|
-
container = standaloneContainer
|
9
|
+
container = standaloneContainer;
|
10
10
|
if (!container.stateless)
|
11
11
|
standaloneContainer = null;
|
12
12
|
}
|
package/src/container.ts
CHANGED
@@ -11,7 +11,7 @@ namespace commands
|
|
11
11
|
dispatch (cmd:'bridge', ...args: [Argument0<typeof import('./commands/bridge.js').default>, Argument1<typeof import('./commands/bridge.js').default>]): ReturnType<typeof import('./commands/bridge.js').default>
|
12
12
|
dispatch (cmd:'name', ...args: [Argument0<typeof import('./commands/name.js').default>]): ReturnType<typeof import('./commands/name.js').default>
|
13
13
|
dispatch (cmd:'proxy', ...args: [Argument0<typeof import('./commands/proxy.js').default>, Argument1<typeof import('./commands/proxy.js').default>]): ReturnType<typeof import('./commands/proxy.js').default>
|
14
|
-
dispatch (cmd:'ready', ...args: []): ReturnType<typeof import('./commands/ready.js').default>
|
14
|
+
dispatch (cmd:'ready', ...args: [Argument1<typeof import('./commands/ready.js').default>]): ReturnType<typeof import('./commands/ready.js').default>
|
15
15
|
dispatch (cmd:'reload-metadata', ...args: [Argument0<typeof import('./commands/reload-metadata.js').default>]): ReturnType<typeof import('./commands/reload-metadata.js').default>
|
16
16
|
dispatch (cmd:'restart', ...args: [Argument1<typeof import('./commands/restart.js').default>, Argument2<typeof import('./commands/restart.js').default>]): ReturnType<typeof import('./commands/restart.js').default>
|
17
17
|
dispatch (cmd:'start', ...args: [Argument1<typeof import('./commands/start.js').default>, Argument2<typeof import('./commands/start.js').default>, Argument3<typeof import('./commands/start.js').default>]): ReturnType<typeof import('./commands/start.js').default>
|
@@ -34,7 +34,7 @@ namespace commands
|
|
34
34
|
'bridge'(...args: [Argument0<typeof import('./commands/bridge.js').default>, Argument1<typeof import('./commands/bridge.js').default>]): ReturnType<typeof import('./commands/bridge.js').default>
|
35
35
|
'name'(...args: [Argument0<typeof import('./commands/name.js').default>]): ReturnType<typeof import('./commands/name.js').default>
|
36
36
|
'proxy'(...args: [Argument0<typeof import('./commands/proxy.js').default>, Argument1<typeof import('./commands/proxy.js').default>]): ReturnType<typeof import('./commands/proxy.js').default>
|
37
|
-
'ready'(...args: []): ReturnType<typeof import('./commands/ready.js').default>
|
37
|
+
'ready'(...args: [Argument1<typeof import('./commands/ready.js').default>]): ReturnType<typeof import('./commands/ready.js').default>
|
38
38
|
'reload-metadata'(...args: [Argument0<typeof import('./commands/reload-metadata.js').default>]): ReturnType<typeof import('./commands/reload-metadata.js').default>
|
39
39
|
'restart'(...args: [Argument1<typeof import('./commands/restart.js').default>, Argument2<typeof import('./commands/restart.js').default>]): ReturnType<typeof import('./commands/restart.js').default>
|
40
40
|
'start'(...args: [Argument1<typeof import('./commands/start.js').default>, Argument2<typeof import('./commands/start.js').default>, Argument3<typeof import('./commands/start.js').default>]): ReturnType<typeof import('./commands/start.js').default>
|
@@ -52,7 +52,7 @@ namespace commands
|
|
52
52
|
'update'(...args: [Argument0<typeof import('./cli-commands/update.js').default>, Argument1<typeof import('./cli-commands/update.js').default>, Argument2<typeof import('./cli-commands/update.js').default>]): ReturnType<typeof import('./cli-commands/update.js').default>
|
53
53
|
'version'(...args: [Argument0<typeof import('./cli-commands/version.js').default>, Argument1<typeof import('./cli-commands/version.js').default>]): ReturnType<typeof import('./cli-commands/version.js').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","param.0"]},"":{"inject":["$container","param.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":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","
|
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","param.0"]},"":{"inject":["$container","param.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":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","param.0"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"":{"inject":["$container","param.0"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["param.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["param.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.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","param.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","param.0","param.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","param.0","param.1","param.2"]},"":{"inject":["$container","param.0","param.1","param.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","param.0","param.1","param.2"]},"schema":{"inject":["$container","param.0","param.1","param.2"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"param.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":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]},"html-form":{"inject":["param.0"]},"schema":{"inject":["param.0"],"$defs":{"param.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":["param.0","$container"]},"":{"inject":["param.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":["param.0","$container"]},"schema":{"inject":["param.0","$container"],"$defs":{"param.0":{"type":"string"}}}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.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":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.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":["param.0","param.1","param.2","param.3","param.4"]},"":{"inject":["param.0","param.1","param.2","param.3","param.4"]},"cli":{"inject":["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":["param.0","param.1"]},"":{"inject":["param.0","param.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":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.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);
|