@powerhousedao/ph-cli 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { initCommand } from './init.js';
|
|
3
3
|
export { init } from './init.js';
|
|
4
4
|
export { dev, devCommand } from './dev.js';
|
|
5
|
-
export { helpCommand } from './help.js';
|
|
6
5
|
export { generate, generateCommand } from './generate.js';
|
|
6
|
+
export { helpCommand } from './help.js';
|
|
7
7
|
export { DefaultReactorOptions, ReactorOptions, reactor, reactorCommand } from './reactor.js';
|
|
8
|
+
export { manageService, serviceCommand } from './service.js';
|
|
8
9
|
import '@powerhousedao/config/powerhouse';
|
|
9
10
|
import '../types.js';
|
|
10
11
|
import '@powerhousedao/reactor-local';
|
package/dist/commands/index.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { connectCommand } from './connect.js';
|
|
1
2
|
import { devCommand } from './dev.js';
|
|
2
3
|
export * from './dev.js';
|
|
4
|
+
import { generateCommand } from './generate.js';
|
|
5
|
+
export * from './generate.js';
|
|
3
6
|
import { helpCommand } from './help.js';
|
|
4
7
|
export * from './help.js';
|
|
5
8
|
import { initCommand } from './init.js';
|
|
6
9
|
export * from './init.js';
|
|
7
|
-
import {
|
|
10
|
+
import { installCommand } from './install.js';
|
|
8
11
|
import { reactorCommand } from './reactor.js';
|
|
9
12
|
export * from './reactor.js';
|
|
10
|
-
import {
|
|
11
|
-
export * from './
|
|
12
|
-
import { installCommand } from './install.js';
|
|
13
|
+
import { serviceCommand } from './service.js';
|
|
14
|
+
export * from './service.js';
|
|
13
15
|
|
|
14
16
|
const commands = [
|
|
15
17
|
initCommand,
|
|
@@ -18,7 +20,8 @@ const commands = [
|
|
|
18
20
|
generateCommand,
|
|
19
21
|
reactorCommand,
|
|
20
22
|
helpCommand,
|
|
21
|
-
installCommand
|
|
23
|
+
installCommand,
|
|
24
|
+
serviceCommand
|
|
22
25
|
];
|
|
23
26
|
function registerCommands(program) {
|
|
24
27
|
commands.forEach((command) => command(program));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUO,MAAM,QAAW,GAAA;AAAA,EACtB,WAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF;AAEe,SAAR,iBAAkC,OAAkB,EAAA;AACzD,EAAA,QAAA,CAAS,OAAQ,CAAA,CAAC,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA;AAChD","file":"index.js","sourcesContent":["import { Command } from \"commander\";\nimport { connectCommand } from \"./connect.js\";\nimport { devCommand } from \"./dev.js\";\nimport { generateCommand } from \"./generate.js\";\nimport { helpCommand } from \"./help.js\";\nimport { initCommand } from \"./init.js\";\nimport { installCommand } from \"./install.js\";\nimport { reactorCommand } from \"./reactor.js\";\n\nimport { serviceCommand } from \"./service.js\";\nexport const commands = [\n initCommand,\n devCommand,\n connectCommand,\n generateCommand,\n reactorCommand,\n helpCommand,\n installCommand,\n serviceCommand,\n];\n\nexport default function registerCommands(program: Command) {\n commands.forEach((command) => command(program));\n}\n\nexport * from \"./dev.js\";\nexport * from \"./generate.js\";\nexport * from \"./help.js\";\nexport * from \"./init.js\";\nexport * from \"./reactor.js\";\nexport * from \"./service.js\";\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Argument } from 'commander';
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
|
+
|
|
4
|
+
const actions = ["start", "stop", "status", "list", "install", "save"];
|
|
5
|
+
const services = ["reactor", "connect", "all"];
|
|
6
|
+
const manageService = async (action, service) => {
|
|
7
|
+
if (action === "install") {
|
|
8
|
+
const result = execSync(`pm2 startup | tail -n 1`);
|
|
9
|
+
const result2 = execSync(result.toString());
|
|
10
|
+
console.log(result2.toString());
|
|
11
|
+
return;
|
|
12
|
+
} else {
|
|
13
|
+
const app = service !== "all" ? `--only ${service}` : "";
|
|
14
|
+
const response = execSync(
|
|
15
|
+
`pm2 ${action} ${["start", "stop", "list"].includes(action) ? `powerhouse-services.config.json ${app}` : ""}`
|
|
16
|
+
);
|
|
17
|
+
execSync(`pm2 save`);
|
|
18
|
+
console.log(response.toString());
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function serviceCommand(program) {
|
|
22
|
+
program.command("service").description("Manage services").addArgument(new Argument("action").choices(actions).default("list")).addArgument(
|
|
23
|
+
new Argument("service").choices(services).argOptional().default("all")
|
|
24
|
+
).action(manageService);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { manageService, serviceCommand };
|
|
28
|
+
//# sourceMappingURL=service.js.map
|
|
29
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/service.ts"],"names":[],"mappings":";;;AAGA,MAAM,UAAU,CAAC,OAAA,EAAS,QAAQ,QAAU,EAAA,MAAA,EAAQ,WAAW,MAAM,CAAA;AACrE,MAAM,QAAW,GAAA,CAAC,SAAW,EAAA,SAAA,EAAW,KAAK,CAAA;AAEhC,MAAA,aAAA,GAAqD,OAChE,MAAA,EACA,OACG,KAAA;AACH,EAAA,IAAI,WAAW,SAAW,EAAA;AACxB,IAAM,MAAA,MAAA,GAAS,SAAS,CAAyB,uBAAA,CAAA,CAAA;AACjD,IAAA,MAAM,OAAU,GAAA,QAAA,CAAS,MAAO,CAAA,QAAA,EAAU,CAAA;AAC1C,IAAQ,OAAA,CAAA,GAAA,CAAI,OAAQ,CAAA,QAAA,EAAU,CAAA;AAE9B,IAAA;AAAA,GACK,MAAA;AACL,IAAA,MAAM,GAAM,GAAA,OAAA,KAAY,KAAQ,GAAA,CAAA,QAAA,EAAW,OAAO,CAAK,CAAA,GAAA,EAAA;AACvD,IAAA,MAAM,QAAW,GAAA,QAAA;AAAA,MACf,CAAO,IAAA,EAAA,MAAM,CACX,CAAA,EAAA,CAAC,SAAS,MAAQ,EAAA,MAAM,CAAE,CAAA,QAAA,CAAS,MAAM,CAAA,GACrC,CAAmC,gCAAA,EAAA,GAAG,KACtC,EACN,CAAA;AAAA,KACF;AACA,IAAA,QAAA,CAAS,CAAU,QAAA,CAAA,CAAA;AACnB,IAAQ,OAAA,CAAA,GAAA,CAAI,QAAS,CAAA,QAAA,EAAU,CAAA;AAAA;AAEnC;AAEO,SAAS,eAAe,OAAkB,EAAA;AAC/C,EAAA,OAAA,CACG,QAAQ,SAAS,CAAA,CACjB,WAAY,CAAA,iBAAiB,EAC7B,WAAY,CAAA,IAAI,QAAS,CAAA,QAAQ,EAAE,OAAQ,CAAA,OAAO,EAAE,OAAQ,CAAA,MAAM,CAAC,CACnE,CAAA,WAAA;AAAA,IACC,IAAI,QAAS,CAAA,SAAS,CAAE,CAAA,OAAA,CAAQ,QAAQ,CAAE,CAAA,WAAA,EAAc,CAAA,OAAA,CAAQ,KAAK;AAAA,GACvE,CACC,OAAO,aAAa,CAAA;AACzB","file":"service.js","sourcesContent":["import { Argument, Command } from \"commander\";\nimport { execSync } from \"node:child_process\";\nimport { CommandActionType } from \"../types.js\";\nconst actions = [\"start\", \"stop\", \"status\", \"list\", \"install\", \"save\"];\nconst services = [\"reactor\", \"connect\", \"all\"];\n\nexport const manageService: CommandActionType<[string, string]> = async (\n action,\n service,\n) => {\n if (action === \"install\") {\n const result = execSync(`pm2 startup | tail -n 1`);\n const result2 = execSync(result.toString());\n console.log(result2.toString());\n\n return;\n } else {\n const app = service !== \"all\" ? `--only ${service}` : \"\";\n const response = execSync(\n `pm2 ${action} ${\n [\"start\", \"stop\", \"list\"].includes(action)\n ? `powerhouse-services.config.json ${app}`\n : \"\"\n }`,\n );\n execSync(`pm2 save`);\n console.log(response.toString());\n }\n};\n\nexport function serviceCommand(program: Command) {\n program\n .command(\"service\")\n .description(\"Manage services\")\n .addArgument(new Argument(\"action\").choices(actions).default(\"list\"))\n .addArgument(\n new Argument(\"service\").choices(services).argOptional().default(\"all\"),\n )\n .action(manageService);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { commands } from './commands/index.js';
|
|
2
2
|
export { getConfig } from '@powerhousedao/config/powerhouse';
|
|
3
3
|
export { dev, devCommand } from './commands/dev.js';
|
|
4
|
+
export { generate, generateCommand } from './commands/generate.js';
|
|
4
5
|
export { helpCommand } from './commands/help.js';
|
|
5
6
|
export { init, initCommand } from './commands/init.js';
|
|
6
|
-
export { generate, generateCommand } from './commands/generate.js';
|
|
7
7
|
export { DefaultReactorOptions, ReactorOptions, reactor, reactorCommand } from './commands/reactor.js';
|
|
8
|
+
export { manageService, serviceCommand } from './commands/service.js';
|
|
8
9
|
import 'commander';
|
|
9
10
|
import './types.js';
|
|
10
11
|
import '@powerhousedao/reactor-local';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"colorette": "^2.0.20",
|
|
37
37
|
"commander": "^12.1.0",
|
|
38
38
|
"graphql": "^16.9.0",
|
|
39
|
+
"pm2": "^5.4.3",
|
|
39
40
|
"react": "^18.3.1",
|
|
40
41
|
"react-dom": "^18.3.1",
|
|
41
|
-
"@powerhousedao/codegen": "0.31.0",
|
|
42
42
|
"@powerhousedao/config": "1.10.0",
|
|
43
43
|
"@powerhousedao/design-system": "1.21.0",
|
|
44
44
|
"@powerhousedao/scalars": "1.18.0",
|
|
45
|
-
"@powerhousedao/
|
|
46
|
-
"document-model-libs": "1.127.0"
|
|
45
|
+
"@powerhousedao/codegen": "0.31.0",
|
|
46
|
+
"document-model-libs": "1.127.0",
|
|
47
|
+
"@powerhousedao/reactor-local": "1.15.0"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsup",
|