@powerhousedao/ph-cli 0.31.3-dev.0 → 0.32.1-dev.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.
@@ -1,24 +1,30 @@
1
+ import {
2
+ inspectCommand
3
+ } from "./chunk-IFV5NKI4.js";
1
4
  import {
2
5
  installCommand
3
- } from "./chunk-E3EWRF5U.js";
6
+ } from "./chunk-FEGQ7JEJ.js";
7
+ import {
8
+ listCommand
9
+ } from "./chunk-6VK3FH3G.js";
4
10
  import {
5
11
  serviceCommand
6
- } from "./chunk-ZN4M6TJ2.js";
12
+ } from "./chunk-FFVIBNX6.js";
7
13
  import {
8
14
  uninstallCommand
9
- } from "./chunk-X2RNXISI.js";
15
+ } from "./chunk-D42NLWCH.js";
10
16
  import {
11
17
  connectCommand
12
18
  } from "./chunk-27FF7J6K.js";
13
19
  import {
14
20
  devCommand
15
- } from "./chunk-CWUXPR5K.js";
21
+ } from "./chunk-3LA6D2BV.js";
16
22
  import {
17
23
  reactorCommand
18
- } from "./chunk-6O6TUXJK.js";
24
+ } from "./chunk-ZZ3KNXW6.js";
19
25
  import {
20
26
  generateCommand
21
- } from "./chunk-OH5NZOCQ.js";
27
+ } from "./chunk-ACKSBZXF.js";
22
28
  import {
23
29
  helpCommand
24
30
  } from "./chunk-KPMNRIJU.js";
@@ -32,7 +38,9 @@ var commands = [
32
38
  helpCommand,
33
39
  installCommand,
34
40
  uninstallCommand,
35
- serviceCommand
41
+ serviceCommand,
42
+ listCommand,
43
+ inspectCommand
36
44
  ];
37
45
  function registerCommands(program) {
38
46
  commands.forEach((command) => command(program));
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DefaultSwitchboardOptions
3
- } from "./chunk-6O6TUXJK.js";
3
+ } from "./chunk-ZZ3KNXW6.js";
4
4
 
5
5
  // src/commands/dev.ts
6
6
  import { blue, green, red } from "colorette";
@@ -0,0 +1,36 @@
1
+ import {
2
+ getProjectInfo
3
+ } from "./chunk-V725N3UP.js";
4
+
5
+ // src/commands/list.ts
6
+ import path from "node:path";
7
+ var list = async (options) => {
8
+ if (options.debug) {
9
+ console.log(">>> command arguments", { options });
10
+ }
11
+ const projectInfo = getProjectInfo(options.debug);
12
+ if (options.debug) {
13
+ console.log("\n>>> projectInfo", projectInfo);
14
+ }
15
+ try {
16
+ const phConfig = await import(path.join(projectInfo.path, "powerhouse.config.json"));
17
+ if (!phConfig.packages || phConfig.packages.length === 0) {
18
+ console.log("No packages found in the project");
19
+ return;
20
+ }
21
+ console.log("Installed Packages:\n");
22
+ phConfig.packages.forEach((pkg) => {
23
+ console.log(pkg.packageName);
24
+ });
25
+ } catch (e) {
26
+ console.log("No packages found in the project");
27
+ }
28
+ };
29
+ function listCommand(program) {
30
+ program.command("list").alias("l").description("List installed packages").option("--debug", "Show additional logs").action(list);
31
+ }
32
+
33
+ export {
34
+ list,
35
+ listCommand
36
+ };
@@ -62,7 +62,7 @@ var generate = async (filePath, options) => {
62
62
  return;
63
63
  }
64
64
  if (command.subgraph && command.subgraphName) {
65
- await generateSubgraph(command.subgraphName, config);
65
+ await generateSubgraph(command.subgraphName, null, config);
66
66
  return;
67
67
  }
68
68
  if (command.importScript && command.importScriptName) {
@@ -4,7 +4,7 @@ import {
4
4
  getProjectInfo,
5
5
  packageManagers,
6
6
  updateConfigFile
7
- } from "./chunk-FDMMJENR.js";
7
+ } from "./chunk-V725N3UP.js";
8
8
 
9
9
  // src/commands/uninstall.ts
10
10
  import { execSync } from "node:child_process";
@@ -4,7 +4,7 @@ import {
4
4
  getProjectInfo,
5
5
  packageManagers,
6
6
  updateConfigFile
7
- } from "./chunk-FDMMJENR.js";
7
+ } from "./chunk-V725N3UP.js";
8
8
 
9
9
  // src/commands/install.ts
10
10
  import { execSync } from "node:child_process";
@@ -1,8 +1,11 @@
1
1
  // src/commands/service.ts
2
2
  import { getConfig } from "@powerhousedao/config/powerhouse";
3
3
  import { Argument } from "commander";
4
+ import { execSync } from "node:child_process";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
4
7
  import pm2 from "pm2";
5
- var actions = ["start", "stop", "status", "list", "install", "save"];
8
+ var actions = ["start", "stop", "status", "list", "startup", "unstartup"];
6
9
  var services = ["switchboard", "connect", "all"];
7
10
  var switchboardPort = 8442;
8
11
  var connectPort = 8443;
@@ -23,7 +26,13 @@ var manageService = async (action, service) => {
23
26
  case "stop":
24
27
  stopServices(service);
25
28
  break;
26
- case "status":
29
+ case "startup":
30
+ startupServices();
31
+ break;
32
+ case "unstartup":
33
+ unstartupServices();
34
+ break;
35
+ default:
27
36
  statusServices();
28
37
  break;
29
38
  }
@@ -112,6 +121,25 @@ function statusServices() {
112
121
  process.exit(0);
113
122
  });
114
123
  }
124
+ function startupServices() {
125
+ const dirname = import.meta.dirname || path.dirname(fileURLToPath(import.meta.url));
126
+ const scriptPath = path.join(dirname, "..", "scripts", "service-startup.sh");
127
+ const result = execSync(`bash ${scriptPath}`).toString();
128
+ console.log(result);
129
+ process.exit(0);
130
+ }
131
+ function unstartupServices() {
132
+ const dirname = import.meta.dirname || path.dirname(fileURLToPath(import.meta.url));
133
+ const scriptPath = path.join(
134
+ dirname,
135
+ "..",
136
+ "scripts",
137
+ "service-unstartup.sh"
138
+ );
139
+ const result = execSync(`bash ${scriptPath}`).toString();
140
+ console.log(result);
141
+ process.exit(0);
142
+ }
115
143
 
116
144
  export {
117
145
  manageService,
@@ -0,0 +1,57 @@
1
+ import {
2
+ getProjectInfo
3
+ } from "./chunk-V725N3UP.js";
4
+
5
+ // src/commands/inspect.ts
6
+ import path from "node:path";
7
+ var inspect = async (packageName, options) => {
8
+ if (options.debug) {
9
+ console.log(">>> command arguments", { options });
10
+ }
11
+ const projectInfo = getProjectInfo(options.debug);
12
+ if (options.debug) {
13
+ console.log("\n>>> projectInfo", projectInfo);
14
+ }
15
+ try {
16
+ const manifest = await import(path.join(packageName, "manifest"));
17
+ console.log(manifest.name);
18
+ if (manifest.documentModels) {
19
+ console.log("\nDocument Models:");
20
+ manifest.documentModels.forEach((model) => {
21
+ console.log(`- ${model.name} (${model.id})`);
22
+ });
23
+ }
24
+ if (manifest.editors) {
25
+ console.log("\nEditors:");
26
+ manifest.editors.forEach((editor) => {
27
+ console.log(`- ${editor.name} (${editor.id})`);
28
+ });
29
+ }
30
+ if (manifest.processors) {
31
+ console.log("\nProcessors:");
32
+ manifest.processors.forEach((processor) => {
33
+ console.log(`- ${processor.name} (${processor.id})`);
34
+ });
35
+ }
36
+ if (manifest.subgraphs) {
37
+ console.log("\nSubgraphs:");
38
+ manifest.subgraphs.forEach((subgraph) => {
39
+ console.log(`- ${subgraph.name} (${subgraph.id})`);
40
+ });
41
+ }
42
+ } catch (e) {
43
+ if (options.debug) {
44
+ console.error(e);
45
+ } else {
46
+ console.log("No manifest found in the package");
47
+ }
48
+ }
49
+ };
50
+ function inspectCommand(program) {
51
+ program.command("inspect").alias("is").description("Inspect a package").option("--debug", "Show additional logs").argument("<packageName>", "The name of the package to inspect").action(inspect);
52
+ }
53
+
54
+ export {
55
+ inspect,
56
+ inspectCommand
57
+ };
@@ -62,7 +62,8 @@ var switchboard = (options) => {
62
62
  function reactorCommand(program) {
63
63
  program.command("switchboard").alias("reactor").description("Starts local switchboard").option("--port <PORT>", "port to host the api", "4001").option(
64
64
  "--config-file <configFile>",
65
- "Path to the powerhouse.config.js file"
65
+ "Path to the powerhouse.config.js file",
66
+ "./powerhouse.config.json"
66
67
  ).option("--generate", "generate code when document model is updated").option("--db-path <DB_PATH>", "path to the database").option("--https-key-file <HTTPS_KEY_FILE>", "path to the ssl key file").option("--https-cert-file <HTTPS_CERT_FILE>", "path to the ssl cert file").option(
67
68
  "-w, --watch",
68
69
  "if the reactor should watch for local changes to document models and processors"
package/dist/cli.js CHANGED
@@ -1,15 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerCommands
4
- } from "./chunk-PUQARXW2.js";
5
- import "./chunk-E3EWRF5U.js";
6
- import "./chunk-ZN4M6TJ2.js";
7
- import "./chunk-X2RNXISI.js";
8
- import "./chunk-FDMMJENR.js";
4
+ } from "./chunk-36HFAN3C.js";
5
+ import "./chunk-IFV5NKI4.js";
6
+ import "./chunk-FEGQ7JEJ.js";
7
+ import "./chunk-6VK3FH3G.js";
8
+ import "./chunk-FFVIBNX6.js";
9
+ import "./chunk-D42NLWCH.js";
10
+ import "./chunk-V725N3UP.js";
9
11
  import "./chunk-27FF7J6K.js";
10
- import "./chunk-CWUXPR5K.js";
11
- import "./chunk-6O6TUXJK.js";
12
- import "./chunk-OH5NZOCQ.js";
12
+ import "./chunk-3LA6D2BV.js";
13
+ import "./chunk-ZZ3KNXW6.js";
14
+ import "./chunk-ACKSBZXF.js";
13
15
  import "./chunk-KPMNRIJU.js";
14
16
 
15
17
  // src/cli.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  dev,
3
3
  devCommand
4
- } from "../chunk-CWUXPR5K.js";
5
- import "../chunk-6O6TUXJK.js";
4
+ } from "../chunk-3LA6D2BV.js";
5
+ import "../chunk-ZZ3KNXW6.js";
6
6
  export {
7
7
  dev,
8
8
  devCommand
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generate,
3
3
  generateCommand
4
- } from "../chunk-OH5NZOCQ.js";
4
+ } from "../chunk-ACKSBZXF.js";
5
5
  export {
6
6
  generate,
7
7
  generateCommand
@@ -1,22 +1,27 @@
1
1
  import {
2
2
  commands,
3
3
  registerCommands
4
- } from "../chunk-PUQARXW2.js";
4
+ } from "../chunk-36HFAN3C.js";
5
+ import "../chunk-IFV5NKI4.js";
5
6
  import {
6
7
  install,
7
8
  installCommand,
8
9
  installDependency
9
- } from "../chunk-E3EWRF5U.js";
10
+ } from "../chunk-FEGQ7JEJ.js";
11
+ import {
12
+ list,
13
+ listCommand
14
+ } from "../chunk-6VK3FH3G.js";
10
15
  import {
11
16
  manageService,
12
17
  serviceCommand
13
- } from "../chunk-ZN4M6TJ2.js";
18
+ } from "../chunk-FFVIBNX6.js";
14
19
  import {
15
20
  uninstall,
16
21
  uninstallCommand,
17
22
  uninstallDependency
18
- } from "../chunk-X2RNXISI.js";
19
- import "../chunk-FDMMJENR.js";
23
+ } from "../chunk-D42NLWCH.js";
24
+ import "../chunk-V725N3UP.js";
20
25
  import {
21
26
  connectCommand,
22
27
  startConnect
@@ -24,16 +29,16 @@ import {
24
29
  import {
25
30
  dev,
26
31
  devCommand
27
- } from "../chunk-CWUXPR5K.js";
32
+ } from "../chunk-3LA6D2BV.js";
28
33
  import {
29
34
  DefaultSwitchboardOptions,
30
35
  reactorCommand,
31
36
  switchboard
32
- } from "../chunk-6O6TUXJK.js";
37
+ } from "../chunk-ZZ3KNXW6.js";
33
38
  import {
34
39
  generate,
35
40
  generateCommand
36
- } from "../chunk-OH5NZOCQ.js";
41
+ } from "../chunk-ACKSBZXF.js";
37
42
  import {
38
43
  helpCommand
39
44
  } from "../chunk-KPMNRIJU.js";
@@ -50,6 +55,8 @@ export {
50
55
  install,
51
56
  installCommand,
52
57
  installDependency,
58
+ list,
59
+ listCommand,
53
60
  manageService,
54
61
  reactorCommand,
55
62
  serviceCommand,
@@ -0,0 +1,9 @@
1
+ import {
2
+ inspect,
3
+ inspectCommand
4
+ } from "../chunk-IFV5NKI4.js";
5
+ import "../chunk-V725N3UP.js";
6
+ export {
7
+ inspect,
8
+ inspectCommand
9
+ };
@@ -2,8 +2,8 @@ import {
2
2
  install,
3
3
  installCommand,
4
4
  installDependency
5
- } from "../chunk-E3EWRF5U.js";
6
- import "../chunk-FDMMJENR.js";
5
+ } from "../chunk-FEGQ7JEJ.js";
6
+ import "../chunk-V725N3UP.js";
7
7
  export {
8
8
  install,
9
9
  installCommand,
@@ -0,0 +1,9 @@
1
+ import {
2
+ list,
3
+ listCommand
4
+ } from "../chunk-6VK3FH3G.js";
5
+ import "../chunk-V725N3UP.js";
6
+ export {
7
+ list,
8
+ listCommand
9
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  manageService,
3
3
  serviceCommand
4
- } from "../chunk-ZN4M6TJ2.js";
4
+ } from "../chunk-FFVIBNX6.js";
5
5
  export {
6
6
  manageService,
7
7
  serviceCommand
@@ -2,7 +2,7 @@ import {
2
2
  DefaultSwitchboardOptions,
3
3
  reactorCommand,
4
4
  switchboard
5
- } from "../chunk-6O6TUXJK.js";
5
+ } from "../chunk-ZZ3KNXW6.js";
6
6
  export {
7
7
  DefaultSwitchboardOptions,
8
8
  reactorCommand,
@@ -2,8 +2,8 @@ import {
2
2
  uninstall,
3
3
  uninstallCommand,
4
4
  uninstallDependency
5
- } from "../chunk-X2RNXISI.js";
6
- import "../chunk-FDMMJENR.js";
5
+ } from "../chunk-D42NLWCH.js";
6
+ import "../chunk-V725N3UP.js";
7
7
  export {
8
8
  uninstall,
9
9
  uninstallCommand,
package/dist/index.js CHANGED
@@ -1,20 +1,25 @@
1
1
  import {
2
2
  commands
3
- } from "./chunk-PUQARXW2.js";
3
+ } from "./chunk-36HFAN3C.js";
4
+ import "./chunk-IFV5NKI4.js";
4
5
  import {
5
6
  install,
6
7
  installCommand,
7
8
  installDependency
8
- } from "./chunk-E3EWRF5U.js";
9
+ } from "./chunk-FEGQ7JEJ.js";
10
+ import {
11
+ list,
12
+ listCommand
13
+ } from "./chunk-6VK3FH3G.js";
9
14
  import {
10
15
  manageService,
11
16
  serviceCommand
12
- } from "./chunk-ZN4M6TJ2.js";
17
+ } from "./chunk-FFVIBNX6.js";
13
18
  import {
14
19
  uninstall,
15
20
  uninstallCommand,
16
21
  uninstallDependency
17
- } from "./chunk-X2RNXISI.js";
22
+ } from "./chunk-D42NLWCH.js";
18
23
  import {
19
24
  POWERHOUSE_CONFIG_FILE,
20
25
  POWERHOUSE_GLOBAL_DIR,
@@ -28,7 +33,7 @@ import {
28
33
  isPowerhouseProject,
29
34
  packageManagers,
30
35
  updateConfigFile
31
- } from "./chunk-FDMMJENR.js";
36
+ } from "./chunk-V725N3UP.js";
32
37
  import {
33
38
  connectCommand,
34
39
  startConnect
@@ -36,16 +41,16 @@ import {
36
41
  import {
37
42
  dev,
38
43
  devCommand
39
- } from "./chunk-CWUXPR5K.js";
44
+ } from "./chunk-3LA6D2BV.js";
40
45
  import {
41
46
  DefaultSwitchboardOptions,
42
47
  reactorCommand,
43
48
  switchboard
44
- } from "./chunk-6O6TUXJK.js";
49
+ } from "./chunk-ZZ3KNXW6.js";
45
50
  import {
46
51
  generate,
47
52
  generateCommand
48
- } from "./chunk-OH5NZOCQ.js";
53
+ } from "./chunk-ACKSBZXF.js";
49
54
  import {
50
55
  helpCommand
51
56
  } from "./chunk-KPMNRIJU.js";
@@ -71,6 +76,8 @@ export {
71
76
  installCommand,
72
77
  installDependency,
73
78
  isPowerhouseProject,
79
+ list,
80
+ listCommand,
74
81
  manageService,
75
82
  packageManagers,
76
83
  reactorCommand,
package/dist/utils.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  isPowerhouseProject,
12
12
  packageManagers,
13
13
  updateConfigFile
14
- } from "./chunk-FDMMJENR.js";
14
+ } from "./chunk-V725N3UP.js";
15
15
  export {
16
16
  POWERHOUSE_CONFIG_FILE,
17
17
  POWERHOUSE_GLOBAL_DIR,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "0.31.3-dev.0",
3
+ "version": "0.32.1-dev.0",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "graphql-tag": "^2.12.6",
23
23
  "knex": "^3.1.0",
24
24
  "luxon": "^3.5.0",
25
- "document-drive": "1.17.2"
25
+ "document-drive": "1.18.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "colorette": "^2.0.20",
@@ -31,13 +31,14 @@
31
31
  "pm2": "^5.4.3",
32
32
  "react": "^18.3.1",
33
33
  "react-dom": "^18.3.1",
34
- "@powerhousedao/codegen": "0.34.0",
35
- "@powerhousedao/config": "1.16.0",
36
- "@powerhousedao/connect": "1.0.0-dev.199",
37
- "@powerhousedao/design-system": "1.25.0",
38
- "@powerhousedao/reactor-local": "1.19.2",
39
- "@powerhousedao/scalars": "1.22.0",
40
- "document-model-libs": "1.131.2"
34
+ "@powerhousedao/codegen": "0.35.0",
35
+ "@powerhousedao/config": "1.17.0",
36
+ "@powerhousedao/design-system": "1.26.0",
37
+ "@powerhousedao/reactor-local": "1.20.0",
38
+ "@powerhousedao/scalars": "1.23.0",
39
+ "@powerhousedao/connect": "1.0.0-dev.200",
40
+ "document-model": "2.20.0",
41
+ "document-model-libs": "1.132.0"
41
42
  },
42
43
  "scripts": {
43
44
  "build": "tsup",
@@ -1,7 +1,7 @@
1
1
  // src/utils.ts
2
- import path, { dirname } from "node:path";
3
2
  import fs from "node:fs";
4
3
  import { homedir } from "node:os";
4
+ import path, { dirname } from "node:path";
5
5
  import { getConfig } from "@powerhousedao/config/powerhouse";
6
6
  var POWERHOUSE_CONFIG_FILE = "powerhouse.config.json";
7
7
  var POWERHOUSE_GLOBAL_DIR = path.join(homedir(), ".ph");