@powerhousedao/ph-cli 0.40.7-dev.0 → 0.40.7-dev.3
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 +4 -2
- package/dist/src/commands/__tests__/update.test.d.ts +2 -0
- package/dist/src/commands/__tests__/update.test.d.ts.map +1 -0
- package/dist/src/commands/__tests__/update.test.js +152 -0
- package/dist/src/commands/__tests__/use.test.d.ts +2 -0
- package/dist/src/commands/__tests__/use.test.d.ts.map +1 -0
- package/dist/src/commands/__tests__/use.test.js +130 -0
- package/dist/src/commands/connect.d.ts.map +1 -1
- package/dist/src/commands/connect.js +0 -2
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +4 -0
- package/dist/src/commands/inspect.d.ts +1 -4
- package/dist/src/commands/inspect.d.ts.map +1 -1
- package/dist/src/commands/update.d.ts +11 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +89 -0
- package/dist/src/commands/use.d.ts +27 -0
- package/dist/src/commands/use.d.ts.map +1 -0
- package/dist/src/commands/use.js +82 -0
- package/dist/src/services/connect.d.ts.map +1 -1
- package/dist/src/services/connect.js +1 -3
- package/dist/src/services/dev.d.ts.map +1 -1
- package/dist/src/services/dev.js +0 -2
- package/dist/src/utils.d.ts +25 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +36 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -9
package/dist/src/utils.d.ts
CHANGED
|
@@ -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
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC3B,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D,MAAM,MAAM,WAAW,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";
|