@powerhousedao/ph-cli 0.21.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/service.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { Argument } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { execSync } from 'node:child_process';
|
|
3
3
|
|
|
4
4
|
const actions = ["start", "stop", "status", "list", "install", "save"];
|
|
5
5
|
const services = ["reactor", "connect", "all"];
|
|
6
6
|
const manageService = async (action, service) => {
|
|
7
|
-
|
|
8
|
-
`pm2
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
}
|
|
13
20
|
};
|
|
14
21
|
function serviceCommand(program) {
|
|
15
22
|
program.command("service").description("Manage services").addArgument(new Argument("action").choices(actions).default("list")).addArgument(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/service.ts"],"names":[],"mappings":";;;
|
|
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/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",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"react": "^18.3.1",
|
|
41
41
|
"react-dom": "^18.3.1",
|
|
42
42
|
"@powerhousedao/config": "1.10.0",
|
|
43
|
-
"@powerhousedao/codegen": "0.31.0",
|
|
44
43
|
"@powerhousedao/design-system": "1.21.0",
|
|
45
|
-
"@powerhousedao/reactor-local": "1.15.0",
|
|
46
44
|
"@powerhousedao/scalars": "1.18.0",
|
|
47
|
-
"
|
|
45
|
+
"@powerhousedao/codegen": "0.31.0",
|
|
46
|
+
"document-model-libs": "1.127.0",
|
|
47
|
+
"@powerhousedao/reactor-local": "1.15.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsup",
|