ph-cmd 0.43.13-staging.0 → 0.43.13-staging.2
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/scripts/generate-commands-md.d.ts +2 -0
- package/dist/scripts/generate-commands-md.d.ts.map +1 -0
- package/dist/scripts/generate-commands-md.js +72 -0
- package/dist/scripts/generate-commands-md.js.map +1 -0
- package/dist/scripts/generate-version.d.ts +2 -0
- package/dist/scripts/generate-version.d.ts.map +1 -0
- package/dist/scripts/generate-version.js +13 -0
- package/dist/scripts/generate-version.js.map +1 -0
- package/dist/src/cli.js +39 -4
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/__tests__/update.test.js +4 -4
- package/dist/src/commands/__tests__/update.test.js.map +1 -1
- package/dist/src/commands/__tests__/use.test.js +4 -4
- package/dist/src/commands/__tests__/use.test.js.map +1 -1
- package/dist/src/commands/forward.d.ts +2 -1
- package/dist/src/commands/forward.d.ts.map +1 -1
- package/dist/src/commands/forward.js +13 -4
- package/dist/src/commands/forward.js.map +1 -1
- package/dist/src/commands/help.d.ts +7 -0
- package/dist/src/commands/help.d.ts.map +1 -0
- package/dist/src/commands/help.js +14 -0
- package/dist/src/commands/help.js.map +1 -0
- package/dist/src/commands/index.d.ts +4 -2
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +6 -0
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts +10 -9
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +7 -4
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/setup-globals.d.ts +10 -9
- package/dist/src/commands/setup-globals.d.ts.map +1 -1
- package/dist/src/commands/setup-globals.js +7 -26
- package/dist/src/commands/setup-globals.js.map +1 -1
- package/dist/src/commands/update.d.ts +7 -8
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +9 -16
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/use.d.ts +13 -12
- package/dist/src/commands/use.d.ts.map +1 -1
- package/dist/src/commands/use.js +21 -9
- package/dist/src/commands/use.js.map +1 -1
- package/dist/src/commands/version.d.ts +4 -0
- package/dist/src/commands/version.d.ts.map +1 -0
- package/dist/src/commands/version.js +25 -0
- package/dist/src/commands/version.js.map +1 -0
- package/dist/src/help.d.ts +21 -0
- package/dist/src/help.d.ts.map +1 -0
- package/dist/src/help.js +186 -0
- package/dist/src/help.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils/help-formatting.d.ts +35 -0
- package/dist/src/utils/help-formatting.d.ts.map +1 -0
- package/dist/src/utils/help-formatting.js +176 -0
- package/dist/src/utils/help-formatting.js.map +1 -0
- package/dist/src/{utils.d.ts → utils/index.d.ts} +44 -4
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/{utils.js → utils/index.js} +121 -7
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.d.ts.map +1 -0
- package/dist/src/version.js +3 -0
- package/dist/src/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -3
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-globals.js","sourceRoot":"","sources":["../../../src/commands/setup-globals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-globals.js","sourceRoot":"","sources":["../../../src/commands/setup-globals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAYxE,MAAM,CAAC,MAAM,YAAY,GAErB,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;IACjC,MAAM,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,eAAe,GAAG,OAAO;SAC5B,OAAO,CAAC,eAAe,CAAC;SACxB,WAAW,CAAC,0BAA0B,CAAC;SACvC,QAAQ,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;SACjD,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC;SAC9C,MAAM,CAAC,mBAAmB,EAAE,qCAAqC,CAAC;SAClE,MAAM,CACL,eAAe,EACf,wDAAwD,CACzD;SACA,MAAM,CAAC,OAAO,EAAE,8CAA8C,CAAC;SAC/D,MAAM,CAAC,WAAW,EAAE,8CAA8C,CAAC;SACnE,MAAM,CACL,oCAAoC,EACpC,8BAA8B,CAC/B,CAAC;IAEJ,+DAA+D;IAC/D,OAAO,cAAc,CACnB,eAAe,EACf,YAAY,EACZ,gBAAgB,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { type Command } from "commander";
|
|
2
2
|
import { type CommandActionType } from "../types.js";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare function updateCommand(program: Command): void;
|
|
3
|
+
export type UpdateOptions = {
|
|
4
|
+
force?: string;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
packageManager?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const update: CommandActionType<[UpdateOptions]>;
|
|
9
|
+
export declare function updateCommand(program: Command): Command;
|
|
11
10
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwFrD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,CAAC,aAAa,CAAC,CA4DrD,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAmBvD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { execSync } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { updateHelp } from "../help.js";
|
|
5
|
+
import { findContainerDirectory, getPackageManagerFromLockfile, getProjectInfo, packageManagers, withCustomHelp, } from "../utils/index.js";
|
|
5
6
|
import { ENV_MAP, PH_PROJECT_DEPENDENCIES, updatePackageJson, } from "./use.js";
|
|
6
7
|
const FILE_PROTOCOL = "file:";
|
|
7
8
|
const LINK_PROTOCOL = "link:";
|
|
@@ -45,12 +46,12 @@ const getInstalledDependencies = (projectPath) => {
|
|
|
45
46
|
.sort(); // Sort dependencies alphabetically
|
|
46
47
|
return installedDeps;
|
|
47
48
|
};
|
|
48
|
-
export const update = (options) => {
|
|
49
|
+
export const update = async (options) => {
|
|
49
50
|
const { force, packageManager, debug } = options;
|
|
50
51
|
if (debug) {
|
|
51
52
|
console.log(">>> options", options);
|
|
52
53
|
}
|
|
53
|
-
const projectInfo = getProjectInfo();
|
|
54
|
+
const projectInfo = await getProjectInfo();
|
|
54
55
|
const pkgManagerName = (packageManager ||
|
|
55
56
|
getPackageManagerFromLockfile(projectInfo.path));
|
|
56
57
|
const localDependencyPath = getLocalDependencyPath(projectInfo.path);
|
|
@@ -68,7 +69,7 @@ export const update = (options) => {
|
|
|
68
69
|
throw new Error(`Invalid environment: ${force}, supported envs: ${supportedEnvs.join(", ")}`);
|
|
69
70
|
}
|
|
70
71
|
const env = force;
|
|
71
|
-
updatePackageJson(env, undefined, pkgManagerName, debug);
|
|
72
|
+
await updatePackageJson(env, undefined, pkgManagerName, debug);
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
const installedDeps = getInstalledDependencies(projectInfo.path);
|
|
@@ -89,22 +90,14 @@ export const update = (options) => {
|
|
|
89
90
|
});
|
|
90
91
|
};
|
|
91
92
|
export function updateCommand(program) {
|
|
92
|
-
program
|
|
93
|
+
const updateCmd = program
|
|
93
94
|
.command("update")
|
|
94
95
|
.alias("up")
|
|
95
96
|
.description("Allows you to update your dependencies to the latest version based on the specified range in package.json. If you want to update to the latest available version, use the --force flag.")
|
|
96
97
|
.option("--force <env>", "Force update to latest available version for the environment specified (dev, prod, latest)")
|
|
97
98
|
.option("--package-manager <packageManager>", "force package manager to use")
|
|
98
|
-
.option("--debug", "Show additional logs")
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
$ ph update # Update dependencies based on package.json ranges
|
|
102
|
-
$ ph update --force dev # Force update to latest dev version available
|
|
103
|
-
$ ph update --force prod # Force update to latest stable version available (same as latest)
|
|
104
|
-
$ ph update --force latest # Force update to latest stable version available (same as prod)
|
|
105
|
-
$ ph update --package-manager pnpm # Specify package manager to use
|
|
106
|
-
$ ph update --debug # Show debug information during update
|
|
107
|
-
`)
|
|
108
|
-
.action(update);
|
|
99
|
+
.option("--debug", "Show additional logs");
|
|
100
|
+
// Use withCustomHelp instead of withHelpAction and addHelpText
|
|
101
|
+
return withCustomHelp(updateCmd, update, updateHelp);
|
|
109
102
|
}
|
|
110
103
|
//# sourceMappingURL=update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,cAAc,GAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,iBAAiB,GAElB,MAAM,UAAU,CAAC;AAOlB,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,MAAM,sBAAsB,GAAG,CAC7B,mBAA2B,EAC3B,cAA8B,EAC9B,EAAE;IACF,MAAM,YAAY,GAAG,sBAAsB,CACzC,mBAAmB,EACnB,aAAa,CACd,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,UAAU,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE;QACjC,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,YAAY;KAClB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,WAAmB,EAAE,EAAE;IACrD,0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,+DAA+D;IAC/D,OAAO,cAAc,CAAkB,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Command } from "commander";
|
|
2
2
|
import { type CommandActionType } from "../types.js";
|
|
3
|
-
import { type PackageManager } from "../utils.js";
|
|
3
|
+
import { type PackageManager } from "../utils/index.js";
|
|
4
4
|
export declare const ORG = "@powerhousedao";
|
|
5
5
|
export declare const SPECIAL_PACKAGES: string[];
|
|
6
6
|
export declare const PACKAGES: string[];
|
|
@@ -15,19 +15,20 @@ export declare const ENV_MAP: {
|
|
|
15
15
|
latest: string;
|
|
16
16
|
};
|
|
17
17
|
export type Environment = keyof typeof ENV_MAP;
|
|
18
|
-
export declare const updatePackageJson: (env: Environment, localPath?: string, packageManager?: PackageManager, debug?: boolean) => void
|
|
18
|
+
export declare const updatePackageJson: (env: Environment, localPath?: string, packageManager?: PackageManager, debug?: boolean) => Promise<void>;
|
|
19
|
+
export type UseOptions = {
|
|
20
|
+
dev?: boolean;
|
|
21
|
+
prod?: boolean;
|
|
22
|
+
local?: string;
|
|
23
|
+
debug?: boolean;
|
|
24
|
+
latest?: boolean;
|
|
25
|
+
force?: boolean;
|
|
26
|
+
packageManager?: string;
|
|
27
|
+
};
|
|
19
28
|
export declare const use: CommandActionType<[
|
|
20
29
|
string | undefined,
|
|
21
30
|
string | undefined,
|
|
22
|
-
|
|
23
|
-
dev?: boolean;
|
|
24
|
-
prod?: boolean;
|
|
25
|
-
local?: string;
|
|
26
|
-
debug?: boolean;
|
|
27
|
-
latest?: boolean;
|
|
28
|
-
force?: boolean;
|
|
29
|
-
packageManager?: string;
|
|
30
|
-
}
|
|
31
|
+
UseOptions
|
|
31
32
|
]>;
|
|
32
|
-
export declare function useCommand(program: Command):
|
|
33
|
+
export declare function useCommand(program: Command): Command;
|
|
33
34
|
//# sourceMappingURL=use.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/commands/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/commands/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,GAAG,mBAAmB,CAAC;AAGpC,eAAO,MAAM,gBAAgB,UAAuC,CAAC;AAGrE,eAAO,MAAM,QAAQ,UAapB,CAAC;AAEF,eAAO,MAAM,IAAI,UAAuB,CAAC;AAEzC,eAAO,MAAM,IAAI,UAA6B,CAAC;AAE/C,eAAO,MAAM,uBAAuB,UAOnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,UAIzC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,OAAO,CAAC;AAE/C,eAAO,MAAM,iBAAiB,GAC5B,KAAK,WAAW,EAChB,YAAY,MAAM,EAClB,iBAAiB,cAAc,EAC/B,QAAQ,OAAO,kBAgEhB,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,iBAAiB,CACjC;IAAC,MAAM,GAAG,SAAS;IAAE,MAAM,GAAG,SAAS;IAAE,UAAU;CAAC,CAiCrD,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAuCpD"}
|
package/dist/src/commands/use.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { useHelp } from "../help.js";
|
|
4
|
+
import { getPackageManagerFromLockfile, getProjectInfo, installDependency, withCustomHelp, } from "../utils/index.js";
|
|
4
5
|
export const ORG = "@powerhousedao";
|
|
5
6
|
// Special packages that don't use the @powerhousedao organization
|
|
6
7
|
export const SPECIAL_PACKAGES = ["document-model", "document-drive"];
|
|
@@ -38,8 +39,8 @@ export const ENV_MAP = {
|
|
|
38
39
|
prod: "latest",
|
|
39
40
|
latest: "latest",
|
|
40
41
|
};
|
|
41
|
-
export const updatePackageJson = (env, localPath, packageManager, debug) => {
|
|
42
|
-
const projectInfo = getProjectInfo();
|
|
42
|
+
export const updatePackageJson = async (env, localPath, packageManager, debug) => {
|
|
43
|
+
const projectInfo = await getProjectInfo();
|
|
43
44
|
const pkgManager = packageManager || getPackageManagerFromLockfile(projectInfo.path);
|
|
44
45
|
if (debug) {
|
|
45
46
|
console.log(">>> projectInfo", projectInfo);
|
|
@@ -92,7 +93,7 @@ export const updatePackageJson = (env, localPath, packageManager, debug) => {
|
|
|
92
93
|
throw error;
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
|
-
export const use = (environment, localPath, options) => {
|
|
96
|
+
export const use = async (environment, localPath, options) => {
|
|
96
97
|
if (!environment ||
|
|
97
98
|
(!options.force &&
|
|
98
99
|
environment !== "local" &&
|
|
@@ -107,17 +108,28 @@ export const use = (environment, localPath, options) => {
|
|
|
107
108
|
if (debug) {
|
|
108
109
|
console.log(">>> options", options);
|
|
109
110
|
}
|
|
110
|
-
updatePackageJson(env, localPath, packageManager, debug);
|
|
111
|
+
await updatePackageJson(env, localPath, packageManager, debug);
|
|
111
112
|
};
|
|
112
113
|
export function useCommand(program) {
|
|
113
|
-
program
|
|
114
|
+
const useCmd = program
|
|
114
115
|
.command("use")
|
|
115
116
|
.description("Allows you to change your environment (latest, development, production, local)")
|
|
116
|
-
.argument("
|
|
117
|
+
.argument("[environment]", "The environment to use (latest, dev, prod, local)")
|
|
117
118
|
.argument("[localPath]", "The path to the local environment (you have to specify the path to the local environment)")
|
|
118
119
|
.option("--force", "force environment to use")
|
|
119
120
|
.option("--package-manager <packageManager>", "force package manager to use")
|
|
120
|
-
.option("--debug", "Show additional logs")
|
|
121
|
-
|
|
121
|
+
.option("--debug", "Show additional logs");
|
|
122
|
+
// Use withCustomHelp instead of withHelpAction and addHelpText
|
|
123
|
+
return withCustomHelp(useCmd, use, useHelp,
|
|
124
|
+
// Pre-check function to validate environment before running the action
|
|
125
|
+
(environment) => {
|
|
126
|
+
if (!environment &&
|
|
127
|
+
!process.argv.includes("--help") &&
|
|
128
|
+
!process.argv.includes("-h")) {
|
|
129
|
+
console.error('Error: Missing required argument "environment"');
|
|
130
|
+
process.exit(1);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
122
134
|
}
|
|
123
135
|
//# sourceMappingURL=use.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/commands/use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"use.js","sourceRoot":"","sources":["../../../src/commands/use.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EACL,6BAA6B,EAC7B,cAAc,EACd,iBAAiB,EAEjB,cAAc,GAC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SAAS,EAAE,sBAAsB,CAAC,CAAC;IAE7C,+DAA+D;IAC/D,OAAO,cAAc,CACnB,MAAM,EACN,GAAG,EACH,OAAO;IACP,uEAAuE;IACvE,CAAC,WAAW,EAAE,EAAE;QACd,IACE,CAAC,WAAW;YACZ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAChC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC5B,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,eAAO,MAAM,oBAAoB,qBA6BhC,CAAC;AAEF,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAMvD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { forwardPHCommand, getPackageManagerFromLockfile, getProjectInfo, } from "../utils/index.js";
|
|
2
|
+
import { version } from "../version.js";
|
|
3
|
+
// Custom version handler
|
|
4
|
+
export const customVersionHandler = async () => {
|
|
5
|
+
const projectInfo = await getProjectInfo(undefined, false);
|
|
6
|
+
console.log("PH CMD version: ", version);
|
|
7
|
+
if (projectInfo.available) {
|
|
8
|
+
const packageManager = getPackageManagerFromLockfile(projectInfo.path);
|
|
9
|
+
const versionOutput = forwardPHCommand(packageManager, projectInfo.path, "--version", false, true);
|
|
10
|
+
const cleanedOutput = versionOutput.replace(/\n/g, "");
|
|
11
|
+
console.log("PH CLI version: ", cleanedOutput);
|
|
12
|
+
console.log("-------------------------------------");
|
|
13
|
+
console.log("PH CLI path: ", projectInfo.path);
|
|
14
|
+
console.log("PH CLI isGlobalProject: ", projectInfo.isGlobal);
|
|
15
|
+
console.log("PH CLI packageManager: ", packageManager);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.log("-------------------------------------");
|
|
19
|
+
console.log("PH CLI is not available, please run `ph init` to generate the default global project");
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export function versionOption(program) {
|
|
23
|
+
return program.option("-v, --version", "Display version information", customVersionHandler);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/commands/version.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,yBAAyB;AACzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAAI,EAAE;IAC7C,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAE3D,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAEzC,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1B,MAAM,cAAc,GAAG,6BAA6B,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAEvE,MAAM,aAAa,GAAG,gBAAgB,CACpC,cAAc,EACd,WAAW,CAAC,IAAI,EAChB,WAAW,EACX,KAAK,EACL,IAAI,CACL,CAAC;QAEF,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEvD,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC9D,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,cAAc,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CACT,sFAAsF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO,OAAO,CAAC,MAAM,CACnB,eAAe,EACf,6BAA6B,EAC7B,oBAAoB,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help text for CLI commands
|
|
3
|
+
* This file centralizes all help text to keep command files clean
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Help text for the update command
|
|
7
|
+
*/
|
|
8
|
+
export declare const updateHelp = "\nCommand Overview:\n The update command helps you manage and update Powerhouse dependencies in your project. It provides\n an efficient way to keep your project up-to-date with the latest versions of Powerhouse packages.\n \n This command:\n 1. Updates all Powerhouse dependencies based on the semver ranges specified in your package.json\n 2. Can force update all dependencies to a specific environment version (dev, prod, latest)\n 3. Automatically builds any local dependencies before updating\n 4. Works with all dependencies with @powerhousedao/ prefix and special packages like document-model\n\nOptions:\n --force <env> Force update to the latest available version for the environment specified.\n Valid environments: dev, prod, latest.\n - dev: Uses @dev tag for all dependencies\n - prod/latest: Uses @latest tag for all dependencies\n \n --package-manager Override the auto-detected package manager with the specified one.\n \n --debug Show additional logs while executing the command.\n\nSpecial Cases:\n - Local Dependencies: If you have dependencies linked from a local monorepo (using file: or link:\n protocols), the command will detect the monorepo root, build affected packages, then update.\n \n - No Dependencies: If no Powerhouse dependencies are found in your project, the command will\n display a message and exit without making changes.\n\nExamples:\n $ ph update # Update dependencies based on package.json ranges\n $ ph update --force dev # Force update to latest dev version available\n $ ph update --force prod # Force update to latest stable version available (same as latest)\n $ ph update --force latest # Force update to latest stable version available (same as prod)\n $ ph update --package-manager pnpm # Specify package manager to use\n $ ph update --debug # Show debug information during update\n";
|
|
9
|
+
/**
|
|
10
|
+
* Help text for the use command
|
|
11
|
+
*/
|
|
12
|
+
export declare const useHelp = "\nCommand Overview:\n The use command allows you to quickly switch between different environments for all Powerhouse\n dependencies in your project. It provides a convenient way to toggle between development,\n production, and local versions of the packages.\n\n This command:\n 1. Updates all installed Powerhouse dependencies to the specified environment\n 2. Can link to local dependencies from a monorepo for development\n 3. Only updates dependencies that are already present in your package.json\n 4. Supports special packages without the @powerhousedao prefix\n\nArguments:\n <environment> Required. The environment to use. Valid options:\n - dev: Use development versions (@dev tag)\n - prod/latest: Use production versions (@latest tag)\n - local: Use local filesystem versions (requires localPath)\n \n [localPath] Path to the local monorepo. Required when environment is 'local'.\n This should be the root of your Powerhouse monorepo.\n\nOptions:\n --force Force environment to use, even if not in the predefined list\n \n --package-manager Override the auto-detected package manager with the specified one.\n \n --debug Show additional logs during execution for troubleshooting.\n\nSpecial Cases:\n - Local Development: When using the 'local' environment, dependencies are linked directly\n to local filesystem paths, allowing for real-time development and testing.\n \n - Missing Dependencies: The command only updates Powerhouse dependencies that are already\n installed in your project. It won't add new ones.\n\nExamples:\n $ ph use dev # Switch all dependencies to development versions\n $ ph use prod # Switch all dependencies to production versions\n $ ph use latest # Same as 'prod', use latest production versions\n $ ph use local /path/to/monorepo # Link to local versions in the specified monorepo\n $ ph use dev --package-manager npm # Use npm instead of the auto-detected package manager\n $ ph use dev --debug # Show debug information during execution\n";
|
|
13
|
+
/**
|
|
14
|
+
* Help text for the setup-globals command
|
|
15
|
+
*/
|
|
16
|
+
export declare const setupGlobalsHelp = "\nCommand Overview:\n The setup-globals command initializes a new Powerhouse project with the necessary global \n configuration. It helps you set up a project quickly with proper defaults and dependencies.\n\n This command:\n 1. Creates a new project with the specified name or in the current directory\n 2. Sets up all required Powerhouse dependencies\n 3. Configures the project with appropriate settings\n 4. Can run in interactive mode to guide you through the setup process\n\nArguments:\n [project-name] Optional. Name of the project to create. If not provided,\n the command will use the current directory.\n\nOptions:\n -p, --project Specify the name of the project to create.\n \n -i, --interactive Run the command in interactive mode, which will guide you\n through the setup process with questions and prompts.\n \n -v, --version Specify the development version to use. Defaults to \"main\".\n \n --dev Use the \"development\" version of the boilerplate.\n \n --staging Use the \"staging\" version of the boilerplate.\n \n --package-manager Override the auto-detected package manager with the specified one.\n\nProject Structure:\n The command will set up a project with the following structure:\n - Proper configuration files for TypeScript and ESLint\n - Dependencies for Powerhouse packages\n - Build and development scripts\n\nExamples:\n $ ph setup-globals my-project # Create a new project named \"my-project\"\n $ ph setup-globals # Set up a project in the current directory\n $ ph setup-globals -i # Run setup in interactive mode\n $ ph setup-globals --dev # Use development version\n $ ph setup-globals -v beta # Use specific version\n $ ph setup-globals --package-manager npm # Use npm as package manager\n";
|
|
17
|
+
/**
|
|
18
|
+
* Help text for the init command
|
|
19
|
+
*/
|
|
20
|
+
export declare const initHelp = "\nCommand Overview:\n The init command creates a new Powerhouse project with optimal defaults. It sets up a fully \n configured project structure with all necessary dependencies, configurations, and boilerplate.\n\n This command:\n 1. Creates a new project with the specified name\n 2. Installs all required dependencies for Powerhouse development\n 3. Sets up a proper project structure and configuration files\n 4. Can run in interactive mode for customized setup\n\nArguments:\n [project-name] Optional. Name of the project to create. If not provided,\n you'll be prompted to provide a name, or the current directory \n will be used if in interactive mode.\n\nOptions:\n -p, --project Specify the name of the project to create.\n \n -i, --interactive Run the command in interactive mode, which will guide you\n through the project setup with customizable options.\n \n -v, --version Specify the development version to use. Defaults to \"main\".\n \n --dev Use the \"development\" version of the boilerplate.\n \n --staging Use the \"staging\" version of the boilerplate.\n \n --package-manager Override the auto-detected package manager with the specified one.\n\nProject Structure:\n The command will create a complete project with:\n - Properly configured TypeScript and build settings\n - Powerhouse document-model integration\n - All necessary package.json dependencies\n - Development scripts and tooling\n\nExamples:\n $ ph init my-awesome-project # Create a new project named \"my-awesome-project\"\n $ ph init -i # Create a project in interactive mode\n $ ph init -p my-project # Same as ph init my-project\n $ ph init --dev # Use development version of boilerplate\n $ ph init -v beta # Use specific version\n $ ph init --package-manager yarn # Use yarn as package manager\n $ ph init my-awesome-project --dev --package-manager pnpm # Create a project with Powerhouse dev packages and pnpm as package manager\n";
|
|
21
|
+
//# sourceMappingURL=help.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/help.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,miEAmCtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,6vEA0CnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,kgEA0C5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,y3EA6CpB,CAAC"}
|
package/dist/src/help.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help text for CLI commands
|
|
3
|
+
* This file centralizes all help text to keep command files clean
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Help text for the update command
|
|
7
|
+
*/
|
|
8
|
+
export const updateHelp = `
|
|
9
|
+
Command Overview:
|
|
10
|
+
The update command helps you manage and update Powerhouse dependencies in your project. It provides
|
|
11
|
+
an efficient way to keep your project up-to-date with the latest versions of Powerhouse packages.
|
|
12
|
+
|
|
13
|
+
This command:
|
|
14
|
+
1. Updates all Powerhouse dependencies based on the semver ranges specified in your package.json
|
|
15
|
+
2. Can force update all dependencies to a specific environment version (dev, prod, latest)
|
|
16
|
+
3. Automatically builds any local dependencies before updating
|
|
17
|
+
4. Works with all dependencies with @powerhousedao/ prefix and special packages like document-model
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
--force <env> Force update to the latest available version for the environment specified.
|
|
21
|
+
Valid environments: dev, prod, latest.
|
|
22
|
+
- dev: Uses @dev tag for all dependencies
|
|
23
|
+
- prod/latest: Uses @latest tag for all dependencies
|
|
24
|
+
|
|
25
|
+
--package-manager Override the auto-detected package manager with the specified one.
|
|
26
|
+
|
|
27
|
+
--debug Show additional logs while executing the command.
|
|
28
|
+
|
|
29
|
+
Special Cases:
|
|
30
|
+
- Local Dependencies: If you have dependencies linked from a local monorepo (using file: or link:
|
|
31
|
+
protocols), the command will detect the monorepo root, build affected packages, then update.
|
|
32
|
+
|
|
33
|
+
- No Dependencies: If no Powerhouse dependencies are found in your project, the command will
|
|
34
|
+
display a message and exit without making changes.
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
$ ph update # Update dependencies based on package.json ranges
|
|
38
|
+
$ ph update --force dev # Force update to latest dev version available
|
|
39
|
+
$ ph update --force prod # Force update to latest stable version available (same as latest)
|
|
40
|
+
$ ph update --force latest # Force update to latest stable version available (same as prod)
|
|
41
|
+
$ ph update --package-manager pnpm # Specify package manager to use
|
|
42
|
+
$ ph update --debug # Show debug information during update
|
|
43
|
+
`;
|
|
44
|
+
/**
|
|
45
|
+
* Help text for the use command
|
|
46
|
+
*/
|
|
47
|
+
export const useHelp = `
|
|
48
|
+
Command Overview:
|
|
49
|
+
The use command allows you to quickly switch between different environments for all Powerhouse
|
|
50
|
+
dependencies in your project. It provides a convenient way to toggle between development,
|
|
51
|
+
production, and local versions of the packages.
|
|
52
|
+
|
|
53
|
+
This command:
|
|
54
|
+
1. Updates all installed Powerhouse dependencies to the specified environment
|
|
55
|
+
2. Can link to local dependencies from a monorepo for development
|
|
56
|
+
3. Only updates dependencies that are already present in your package.json
|
|
57
|
+
4. Supports special packages without the @powerhousedao prefix
|
|
58
|
+
|
|
59
|
+
Arguments:
|
|
60
|
+
<environment> Required. The environment to use. Valid options:
|
|
61
|
+
- dev: Use development versions (@dev tag)
|
|
62
|
+
- prod/latest: Use production versions (@latest tag)
|
|
63
|
+
- local: Use local filesystem versions (requires localPath)
|
|
64
|
+
|
|
65
|
+
[localPath] Path to the local monorepo. Required when environment is 'local'.
|
|
66
|
+
This should be the root of your Powerhouse monorepo.
|
|
67
|
+
|
|
68
|
+
Options:
|
|
69
|
+
--force Force environment to use, even if not in the predefined list
|
|
70
|
+
|
|
71
|
+
--package-manager Override the auto-detected package manager with the specified one.
|
|
72
|
+
|
|
73
|
+
--debug Show additional logs during execution for troubleshooting.
|
|
74
|
+
|
|
75
|
+
Special Cases:
|
|
76
|
+
- Local Development: When using the 'local' environment, dependencies are linked directly
|
|
77
|
+
to local filesystem paths, allowing for real-time development and testing.
|
|
78
|
+
|
|
79
|
+
- Missing Dependencies: The command only updates Powerhouse dependencies that are already
|
|
80
|
+
installed in your project. It won't add new ones.
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
$ ph use dev # Switch all dependencies to development versions
|
|
84
|
+
$ ph use prod # Switch all dependencies to production versions
|
|
85
|
+
$ ph use latest # Same as 'prod', use latest production versions
|
|
86
|
+
$ ph use local /path/to/monorepo # Link to local versions in the specified monorepo
|
|
87
|
+
$ ph use dev --package-manager npm # Use npm instead of the auto-detected package manager
|
|
88
|
+
$ ph use dev --debug # Show debug information during execution
|
|
89
|
+
`;
|
|
90
|
+
/**
|
|
91
|
+
* Help text for the setup-globals command
|
|
92
|
+
*/
|
|
93
|
+
export const setupGlobalsHelp = `
|
|
94
|
+
Command Overview:
|
|
95
|
+
The setup-globals command initializes a new Powerhouse project with the necessary global
|
|
96
|
+
configuration. It helps you set up a project quickly with proper defaults and dependencies.
|
|
97
|
+
|
|
98
|
+
This command:
|
|
99
|
+
1. Creates a new project with the specified name or in the current directory
|
|
100
|
+
2. Sets up all required Powerhouse dependencies
|
|
101
|
+
3. Configures the project with appropriate settings
|
|
102
|
+
4. Can run in interactive mode to guide you through the setup process
|
|
103
|
+
|
|
104
|
+
Arguments:
|
|
105
|
+
[project-name] Optional. Name of the project to create. If not provided,
|
|
106
|
+
the command will use the current directory.
|
|
107
|
+
|
|
108
|
+
Options:
|
|
109
|
+
-p, --project Specify the name of the project to create.
|
|
110
|
+
|
|
111
|
+
-i, --interactive Run the command in interactive mode, which will guide you
|
|
112
|
+
through the setup process with questions and prompts.
|
|
113
|
+
|
|
114
|
+
-v, --version Specify the development version to use. Defaults to "main".
|
|
115
|
+
|
|
116
|
+
--dev Use the "development" version of the boilerplate.
|
|
117
|
+
|
|
118
|
+
--staging Use the "staging" version of the boilerplate.
|
|
119
|
+
|
|
120
|
+
--package-manager Override the auto-detected package manager with the specified one.
|
|
121
|
+
|
|
122
|
+
Project Structure:
|
|
123
|
+
The command will set up a project with the following structure:
|
|
124
|
+
- Proper configuration files for TypeScript and ESLint
|
|
125
|
+
- Dependencies for Powerhouse packages
|
|
126
|
+
- Build and development scripts
|
|
127
|
+
|
|
128
|
+
Examples:
|
|
129
|
+
$ ph setup-globals my-project # Create a new project named "my-project"
|
|
130
|
+
$ ph setup-globals # Set up a project in the current directory
|
|
131
|
+
$ ph setup-globals -i # Run setup in interactive mode
|
|
132
|
+
$ ph setup-globals --dev # Use development version
|
|
133
|
+
$ ph setup-globals -v beta # Use specific version
|
|
134
|
+
$ ph setup-globals --package-manager npm # Use npm as package manager
|
|
135
|
+
`;
|
|
136
|
+
/**
|
|
137
|
+
* Help text for the init command
|
|
138
|
+
*/
|
|
139
|
+
export const initHelp = `
|
|
140
|
+
Command Overview:
|
|
141
|
+
The init command creates a new Powerhouse project with optimal defaults. It sets up a fully
|
|
142
|
+
configured project structure with all necessary dependencies, configurations, and boilerplate.
|
|
143
|
+
|
|
144
|
+
This command:
|
|
145
|
+
1. Creates a new project with the specified name
|
|
146
|
+
2. Installs all required dependencies for Powerhouse development
|
|
147
|
+
3. Sets up a proper project structure and configuration files
|
|
148
|
+
4. Can run in interactive mode for customized setup
|
|
149
|
+
|
|
150
|
+
Arguments:
|
|
151
|
+
[project-name] Optional. Name of the project to create. If not provided,
|
|
152
|
+
you'll be prompted to provide a name, or the current directory
|
|
153
|
+
will be used if in interactive mode.
|
|
154
|
+
|
|
155
|
+
Options:
|
|
156
|
+
-p, --project Specify the name of the project to create.
|
|
157
|
+
|
|
158
|
+
-i, --interactive Run the command in interactive mode, which will guide you
|
|
159
|
+
through the project setup with customizable options.
|
|
160
|
+
|
|
161
|
+
-v, --version Specify the development version to use. Defaults to "main".
|
|
162
|
+
|
|
163
|
+
--dev Use the "development" version of the boilerplate.
|
|
164
|
+
|
|
165
|
+
--staging Use the "staging" version of the boilerplate.
|
|
166
|
+
|
|
167
|
+
--package-manager Override the auto-detected package manager with the specified one.
|
|
168
|
+
|
|
169
|
+
Project Structure:
|
|
170
|
+
The command will create a complete project with:
|
|
171
|
+
- Properly configured TypeScript and build settings
|
|
172
|
+
- Powerhouse document-model integration
|
|
173
|
+
- All necessary package.json dependencies
|
|
174
|
+
- Development scripts and tooling
|
|
175
|
+
|
|
176
|
+
Examples:
|
|
177
|
+
$ ph init my-awesome-project # Create a new project named "my-awesome-project"
|
|
178
|
+
$ ph init -i # Create a project in interactive mode
|
|
179
|
+
$ ph init -p my-project # Same as ph init my-project
|
|
180
|
+
$ ph init --dev # Use development version of boilerplate
|
|
181
|
+
$ ph init -v beta # Use specific version
|
|
182
|
+
$ ph init --package-manager yarn # Use yarn as package manager
|
|
183
|
+
$ ph init my-awesome-project --dev --package-manager pnpm # Create a project with Powerhouse dev packages and pnpm as package manager
|
|
184
|
+
`;
|
|
185
|
+
// Add other command help texts here as needed
|
|
186
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/help.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCzB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0C/B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CvB,CAAC;AAEF,8CAA8C"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Command } from "commander";
|
|
2
|
+
export declare const HELP_FORMATTING_CONFIG: {
|
|
3
|
+
FIXED_COLUMN_WIDTH: number;
|
|
4
|
+
COMMANDS_TO_PAD: string[];
|
|
5
|
+
DESCRIPTION_PADDING: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Merges CLI help text with the forwarded PH CLI help text
|
|
9
|
+
* @param {string} cliHelp - Commander-generated help text
|
|
10
|
+
* @param {string} forwardedHelp - Help text from the PH CLI
|
|
11
|
+
* @returns {string} Merged help text
|
|
12
|
+
*/
|
|
13
|
+
export declare function mergeHelp(cliHelp: string, forwardedHelp: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Applies padding to command descriptions for better alignment
|
|
16
|
+
* @param {Command} program - Commander program instance
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyCommandPadding(program: Command): void;
|
|
19
|
+
/**
|
|
20
|
+
* Restores original command descriptions after generating help
|
|
21
|
+
* @param {Command} program - Commander program instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function restoreCommandDescriptions(program: Command): void;
|
|
24
|
+
/**
|
|
25
|
+
* Captures Commander help output as a string
|
|
26
|
+
* @param {Command} program - Commander program instance
|
|
27
|
+
* @returns {string} Help text as a string
|
|
28
|
+
*/
|
|
29
|
+
export declare function captureCommanderHelp(program: Command): string;
|
|
30
|
+
/**
|
|
31
|
+
* Generates and displays the merged help output
|
|
32
|
+
* @param {Command} program - Commander program instance
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateMergedHelp(program: Command): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=help-formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-formatting.d.ts","sourceRoot":"","sources":["../../../src/utils/help-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,eAAO,MAAM,sBAAsB;;;;CAOlC,CAAC;AAiEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CA2DxE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAS1D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAOjE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAe7D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BxE"}
|