@powerhousedao/ph-cli 0.40.9-dev.0 → 0.40.11-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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "0.40.9-dev.0",
3
+ "version": "0.40.11-dev.0",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQrD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CACrC;IAAC,cAAc;CAAC,EAChB,OAAO,CAAC,IAAI,CAAC,CAGd,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAuB9C"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQrD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CACrC;IAAC,cAAc;CAAC,EAChB,OAAO,CAAC,IAAI,CAAC,CAGd,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAe9C"}
@@ -15,8 +15,6 @@ export function connectCommand(program) {
15
15
  .option("--https", "Enable HTTPS")
16
16
  .option("--open", "Open the browser")
17
17
  .option("--config-file <configFile>", "Path to the powerhouse.config.js file")
18
- .option("-le, --local-editors <localEditors>", "Link local document editors path")
19
- .option("-ld, --local-documents <localDocuments>", "Link local documents path")
20
18
  .action(async (...args) => {
21
19
  await connect(...args);
22
20
  });
@@ -1,9 +1,6 @@
1
1
  import { type Command } from "commander";
2
2
  import { type InspectOptions } from "../services/inspect.js";
3
3
  import { type CommandActionType } from "../types.js";
4
- export declare const inspect: CommandActionType<[
5
- string,
6
- InspectOptions
7
- ]>;
4
+ export declare const inspect: CommandActionType<[string, InspectOptions]>;
8
5
  export declare function inspectCommand(program: Command): void;
9
6
  //# sourceMappingURL=inspect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQrD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CACrC;IAAC,MAAM;IAAE,cAAc;CAAC,CAGzB,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAQ9C"}
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../src/commands/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQrD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAK/D,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAQ9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/services/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,6CAA6C,CAAC;AAKrD,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAElD,wBAAsB,YAAY,CAAC,cAAc,EAAE,cAAc,6BAYhE"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../src/services/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,6CAA6C,CAAC;AAKrD,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAElD,wBAAsB,YAAY,CAAC,cAAc,EAAE,cAAc,6BAUhE"}
@@ -3,13 +3,11 @@ import { getConfig } from "@powerhousedao/config/powerhouse";
3
3
  import packageJson from "../../package.json" with { type: "json" };
4
4
  const version = packageJson.version;
5
5
  export async function startConnect(connectOptions) {
6
- const { documentModelsDir, editorsDir, packages, studio, logLevel } = getConfig(connectOptions.configFile);
6
+ const { packages, studio, logLevel } = getConfig(connectOptions.configFile);
7
7
  return await startConnectStudio({
8
8
  port: studio?.port?.toString() || undefined,
9
9
  packages,
10
10
  phCliVersion: typeof version === "string" ? version : undefined,
11
- localDocuments: documentModelsDir || undefined,
12
- localEditors: editorsDir || undefined,
13
11
  open: studio?.openBrowser,
14
12
  logLevel: logLevel,
15
13
  ...connectOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/services/dev.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA4EF,wBAAsB,QAAQ,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,eAAgD,EAChD,UAAU,GACX,EAAE,UAAU,iBAcZ"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/services/dev.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA0EF,wBAAsB,QAAQ,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,eAAgD,EAChD,UAAU,GACX,EAAE,UAAU,iBAcZ"}
@@ -40,8 +40,6 @@ async function spawnConnect(options, localReactorUrl) {
40
40
  env: {
41
41
  ...process.env,
42
42
  // TODO add studio variables?
43
- LOCAL_DOCUMENT_MODELS: options?.localDocuments,
44
- LOCAL_DOCUMENT_EDITORS: options?.localEditors,
45
43
  PH_CONNECT_DEFAULT_DRIVES_URL: localReactorUrl,
46
44
  },
47
45
  });
@@ -8,7 +8,10 @@ export type SwitchboardOptions = StartServerOptions & {
8
8
  export declare const DefaultSwitchboardOptions: {
9
9
  dev: boolean;
10
10
  port: number;
11
- storagePath: string;
11
+ storage: {
12
+ type: "filesystem";
13
+ filesystemPath: string;
14
+ };
12
15
  dbPath: string;
13
16
  drive: {
14
17
  global: {
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard.d.ts","sourceRoot":"","sources":["../../../src/services/switchboard.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAC;AAStC,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;CAGrC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,kBAAkB,EAAE,kBAAkB,yBAoBvC"}
1
+ {"version":3,"file":"switchboard.d.ts","sourceRoot":"","sources":["../../../src/services/switchboard.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAC;AAStC,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAGrC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,kBAAkB,EAAE,kBAAkB,yBAqBvC"}
@@ -17,6 +17,7 @@ export async function startLocalSwitchboard(switchboardOptions) {
17
17
  ...options,
18
18
  https,
19
19
  logLevel: baseConfig.logLevel,
20
+ storage: baseConfig.reactor?.storage || options.storage,
20
21
  });
21
22
  if (options.generate) {
22
23
  await addGenerateTransmitter(reactor, baseConfig);
@@ -8,6 +8,8 @@ export declare const packageManagers: {
8
8
  uninstallCommand: string;
9
9
  workspaceOption: string;
10
10
  lockfile: string;
11
+ updateCommand: string;
12
+ buildAffected: string;
11
13
  };
12
14
  pnpm: {
13
15
  globalPathRegexp: RegExp;
@@ -15,6 +17,8 @@ export declare const packageManagers: {
15
17
  uninstallCommand: string;
16
18
  workspaceOption: string;
17
19
  lockfile: string;
20
+ updateCommand: string;
21
+ buildAffected: string;
18
22
  };
19
23
  yarn: {
20
24
  globalPathRegexp: RegExp;
@@ -22,12 +26,16 @@ export declare const packageManagers: {
22
26
  uninstallCommand: string;
23
27
  workspaceOption: string;
24
28
  lockfile: string;
29
+ updateCommand: string;
30
+ buildAffected: string;
25
31
  };
26
32
  npm: {
27
33
  installCommand: string;
28
34
  uninstallCommand: string;
29
35
  workspaceOption: string;
30
36
  lockfile: string;
37
+ updateCommand: string;
38
+ buildAffected: string;
31
39
  };
32
40
  };
33
41
  type PathValidation = (dir: string) => boolean;
@@ -43,5 +51,22 @@ export declare function getProjectInfo(debug?: boolean): ProjectInfo;
43
51
  export declare function getPackageManagerFromLockfile(dir: string): PackageManager;
44
52
  export declare function getPackageManagerFromPath(dir: string): PackageManager;
45
53
  export declare function updateConfigFile(dependencies: string[], projectPath: string, task?: "install" | "uninstall"): void;
54
+ /**
55
+ * Recursively searches for a specific file by traversing up the directory tree.
56
+ * Starting from the given path, it checks each parent directory until it finds
57
+ * the target file or reaches the root directory.
58
+ *
59
+ * @param startPath - The absolute path of the directory to start searching from
60
+ * @param targetFile - The name of the file to search for (e.g., 'package.json', 'pnpm-workspace.yaml')
61
+ * @returns The absolute path of the directory containing the target file, or null if not found
62
+ *
63
+ * @example
64
+ * // Find the workspace root directory
65
+ * const workspaceRoot = findContainerDirectory('/path/to/project/src', 'pnpm-workspace.yaml');
66
+ *
67
+ * // Find the nearest package.json
68
+ * const packageDir = findContainerDirectory('/path/to/project/src/components', 'package.json');
69
+ */
70
+ export declare const findContainerDirectory: (startPath: string, targetFile: string) => string | null;
46
71
  export { getConfig } from "@powerhousedao/config/powerhouse";
47
72
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,qBAAqB,QAA8B,CAAC;AACjE,eAAO,MAAM,0BAA0B,UAAiC,CAAC;AAEzE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4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AAW,GAAG;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,qBAAqB,YAEpC;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAI9C;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,cAAc,GAAE,cAAsC,iBAevD;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,WAAW,CAoB3D;AAED,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAUzE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAYrE;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,SAAS,GAAG,WAAuB,QAwC1C;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,MAAM,EACjB,YAAY,MAAM,KACjB,MAAM,GAAG,IAeX,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/src/utils.js CHANGED
@@ -11,6 +11,8 @@ export const packageManagers = {
11
11
  uninstallCommand: "bun remove {{dependency}}",
12
12
  workspaceOption: "",
13
13
  lockfile: "bun.lock",
14
+ updateCommand: "bun update {{dependency}}",
15
+ buildAffected: "bun run build:affected",
14
16
  },
15
17
  pnpm: {
16
18
  globalPathRegexp: /[\\/]pnpm[\\/]/,
@@ -18,6 +20,8 @@ export const packageManagers = {
18
20
  uninstallCommand: "pnpm remove {{dependency}}",
19
21
  workspaceOption: "--workspace-root",
20
22
  lockfile: "pnpm-lock.yaml",
23
+ updateCommand: "pnpm update {{dependency}}",
24
+ buildAffected: "pnpm run build:affected",
21
25
  },
22
26
  yarn: {
23
27
  globalPathRegexp: /[\\/]yarn[\\/]/,
@@ -25,12 +29,16 @@ export const packageManagers = {
25
29
  uninstallCommand: "yarn remove {{dependency}}",
26
30
  workspaceOption: "-W",
27
31
  lockfile: "yarn.lock",
32
+ updateCommand: "yarn upgrade {{dependency}}",
33
+ buildAffected: "yarn run build:affected",
28
34
  },
29
35
  npm: {
30
36
  installCommand: "npm install {{dependency}}",
31
37
  uninstallCommand: "npm uninstall {{dependency}}",
32
38
  workspaceOption: "",
33
39
  lockfile: "package-lock.json",
40
+ updateCommand: "npm update {{dependency}} --save",
41
+ buildAffected: "npm run build:affected",
34
42
  },
35
43
  };
36
44
  export function defaultPathValidation() {
@@ -115,4 +123,32 @@ export function updateConfigFile(dependencies, projectPath, task = "install") {
115
123
  };
116
124
  fs.writeFileSync(configPath, JSON.stringify(updatedConfig, null, 2));
117
125
  }
126
+ /**
127
+ * Recursively searches for a specific file by traversing up the directory tree.
128
+ * Starting from the given path, it checks each parent directory until it finds
129
+ * the target file or reaches the root directory.
130
+ *
131
+ * @param startPath - The absolute path of the directory to start searching from
132
+ * @param targetFile - The name of the file to search for (e.g., 'package.json', 'pnpm-workspace.yaml')
133
+ * @returns The absolute path of the directory containing the target file, or null if not found
134
+ *
135
+ * @example
136
+ * // Find the workspace root directory
137
+ * const workspaceRoot = findContainerDirectory('/path/to/project/src', 'pnpm-workspace.yaml');
138
+ *
139
+ * // Find the nearest package.json
140
+ * const packageDir = findContainerDirectory('/path/to/project/src/components', 'package.json');
141
+ */
142
+ export const findContainerDirectory = (startPath, targetFile) => {
143
+ const filePath = path.join(startPath, targetFile);
144
+ if (fs.existsSync(filePath)) {
145
+ return startPath;
146
+ }
147
+ const parentDir = path.dirname(startPath);
148
+ //reached the root directory and haven't found the file
149
+ if (parentDir === startPath) {
150
+ return null;
151
+ }
152
+ return findContainerDirectory(parentDir, targetFile);
153
+ };
118
154
  export { getConfig } from "@powerhousedao/config/powerhouse";