@powerhousedao/ph-cli 0.33.1-dev.0 → 0.34.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.
- package/dist/package.json +51 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +10 -0
- package/dist/src/commands/connect.d.ts +6 -0
- package/dist/src/commands/connect.d.ts.map +1 -0
- package/dist/src/commands/connect.js +44 -0
- package/dist/src/commands/dev.d.ts +14 -0
- package/dist/src/commands/dev.d.ts.map +1 -0
- package/dist/src/commands/dev.js +88 -0
- package/dist/src/commands/generate.d.ts +21 -0
- package/dist/src/commands/generate.d.ts.map +1 -0
- package/dist/src/commands/generate.js +74 -0
- package/dist/src/commands/help.d.ts +3 -0
- package/dist/src/commands/help.d.ts.map +1 -0
- package/dist/src/commands/help.js +8 -0
- package/dist/src/commands/index.d.ts +14 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +34 -0
- package/dist/src/commands/inspect.d.ts +10 -0
- package/dist/src/commands/inspect.d.ts.map +1 -0
- package/dist/src/commands/inspect.js +57 -0
- package/dist/src/commands/install.d.ts +15 -0
- package/dist/src/commands/install.d.ts.map +1 -0
- package/dist/src/commands/install.js +80 -0
- package/dist/src/commands/list.d.ts +9 -0
- package/dist/src/commands/list.d.ts.map +1 -0
- package/dist/src/commands/list.js +33 -0
- package/dist/src/commands/service.d.ts +5 -0
- package/dist/src/commands/service.d.ts.map +1 -0
- package/dist/src/commands/service.js +141 -0
- package/dist/src/commands/switchboard.d.ts +34 -0
- package/dist/src/commands/switchboard.d.ts.map +1 -0
- package/dist/src/commands/switchboard.js +82 -0
- package/dist/src/commands/uninstall.d.ts +15 -0
- package/dist/src/commands/uninstall.d.ts.map +1 -0
- package/dist/src/commands/uninstall.js +80 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils.d.ts +47 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +114 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +15 -15
- package/dist/chunk-3LA6D2BV.js +0 -109
- package/dist/chunk-4CHMELTF.js +0 -51
- package/dist/chunk-6VK3FH3G.js +0 -36
- package/dist/chunk-7FTFL36R.js +0 -52
- package/dist/chunk-ACKSBZXF.js +0 -85
- package/dist/chunk-D42NLWCH.js +0 -98
- package/dist/chunk-DYKO5D3K.js +0 -52
- package/dist/chunk-FEGQ7JEJ.js +0 -97
- package/dist/chunk-FFVIBNX6.js +0 -147
- package/dist/chunk-IFV5NKI4.js +0 -57
- package/dist/chunk-KPMNRIJU.js +0 -10
- package/dist/chunk-V725N3UP.js +0 -132
- package/dist/chunk-XYNGLOOS.js +0 -51
- package/dist/chunk-ZZ3KNXW6.js +0 -91
- package/dist/cli.js +0 -22
- package/dist/commands/connect.js +0 -8
- package/dist/commands/dev.js +0 -9
- package/dist/commands/generate.js +0 -8
- package/dist/commands/help.js +0 -6
- package/dist/commands/index.js +0 -68
- package/dist/commands/inspect.js +0 -9
- package/dist/commands/install.js +0 -11
- package/dist/commands/list.js +0 -9
- package/dist/commands/service.js +0 -8
- package/dist/commands/switchboard.js +0 -10
- package/dist/commands/uninstall.js +0 -11
- package/dist/index.js +0 -91
- package/dist/scripts/service-startup.sh +0 -7
- package/dist/scripts/service-unstartup.sh +0 -6
- package/dist/scripts/setup.sh +0 -24
- package/dist/types.js +0 -0
- package/dist/utils.js +0 -28
package/dist/chunk-3LA6D2BV.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DefaultSwitchboardOptions
|
|
3
|
-
} from "./chunk-ZZ3KNXW6.js";
|
|
4
|
-
|
|
5
|
-
// src/commands/dev.ts
|
|
6
|
-
import { blue, green, red } from "colorette";
|
|
7
|
-
import { fork } from "node:child_process";
|
|
8
|
-
import path, { dirname } from "node:path";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
-
var __dirname = import.meta.dirname || dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
function spawnLocalSwitchboard(options) {
|
|
12
|
-
const child = fork(
|
|
13
|
-
path.join(__dirname, "switchboard.js"),
|
|
14
|
-
["spawn", JSON.stringify(options)],
|
|
15
|
-
{ silent: true }
|
|
16
|
-
);
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
child.on("message", (message) => {
|
|
19
|
-
const text = message.toString();
|
|
20
|
-
if (text.startsWith("driveUrl:")) {
|
|
21
|
-
const driveUrl = text.substring("driveUrl:".length);
|
|
22
|
-
resolve({ driveUrl });
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
child.stdout.on("data", (data) => {
|
|
26
|
-
const message = data.toString();
|
|
27
|
-
const lines = message.split("\n").filter((line) => line.trim().length);
|
|
28
|
-
for (const line of lines) {
|
|
29
|
-
process.stdout.write(blue(`[Switchboard]: ${line}
|
|
30
|
-
`));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
child.stderr.on("error", (data) => {
|
|
34
|
-
process.stderr.write(red(`[Switchboard]: ${data.toString()}`));
|
|
35
|
-
});
|
|
36
|
-
child.on("error", (err) => {
|
|
37
|
-
process.stderr.write(red(`[Switchboard]: ${err}`));
|
|
38
|
-
});
|
|
39
|
-
child.on("exit", (code) => {
|
|
40
|
-
console.log(`Switchboard process exited with code ${code}`);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async function spawnConnect(options, localReactorUrl) {
|
|
45
|
-
const child = fork(
|
|
46
|
-
path.join(__dirname, "connect.js"),
|
|
47
|
-
["spawn", JSON.stringify(options ?? {})],
|
|
48
|
-
{
|
|
49
|
-
silent: true,
|
|
50
|
-
env: {
|
|
51
|
-
...process.env,
|
|
52
|
-
// TODO add studio variables?
|
|
53
|
-
LOCAL_DOCUMENT_MODELS: options?.localDocuments,
|
|
54
|
-
LOCAL_DOCUMENT_EDITORS: options?.localEditors,
|
|
55
|
-
PH_CONNECT_DEFAULT_DRIVES_URL: localReactorUrl
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
return new Promise((resolve) => {
|
|
60
|
-
child.stdout.on("data", (data) => {
|
|
61
|
-
resolve();
|
|
62
|
-
process.stdout.write(green(`[Connect]: ${data.toString()}`));
|
|
63
|
-
});
|
|
64
|
-
child.stderr.on("data", (data) => {
|
|
65
|
-
process.stderr.write(red(`[Connect]: ${data.toString()}`));
|
|
66
|
-
});
|
|
67
|
-
child.on("close", (code) => {
|
|
68
|
-
console.log(`Connect process exited with code ${code}`);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
var dev = async ({
|
|
73
|
-
generate,
|
|
74
|
-
watch,
|
|
75
|
-
switchboardPort = DefaultSwitchboardOptions.port,
|
|
76
|
-
configFile,
|
|
77
|
-
httpsKeyFile,
|
|
78
|
-
httpsCertFile
|
|
79
|
-
}) => {
|
|
80
|
-
try {
|
|
81
|
-
const https = httpsKeyFile && httpsCertFile ? {
|
|
82
|
-
keyPath: httpsKeyFile,
|
|
83
|
-
certPath: httpsCertFile
|
|
84
|
-
} : void 0;
|
|
85
|
-
const { driveUrl } = await spawnLocalSwitchboard({
|
|
86
|
-
generate,
|
|
87
|
-
port: switchboardPort,
|
|
88
|
-
watch,
|
|
89
|
-
https
|
|
90
|
-
});
|
|
91
|
-
await spawnConnect({ configFile }, driveUrl);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error(error);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
function devCommand(program) {
|
|
97
|
-
program.command("dev").description("Starts dev environment").option("--generate", "generate code when document model is updated").option("--switchboard-port <port>", "port to use for the switchboard").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(
|
|
98
|
-
"--config-file <configFile>",
|
|
99
|
-
"Path to the powerhouse.config.js file"
|
|
100
|
-
).option(
|
|
101
|
-
"-w, --watch",
|
|
102
|
-
"if the switchboard should watch for local changes to document models and processors"
|
|
103
|
-
).action(dev);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export {
|
|
107
|
-
dev,
|
|
108
|
-
devCommand
|
|
109
|
-
};
|
package/dist/chunk-4CHMELTF.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// src/commands/connect.ts
|
|
2
|
-
import { getConfig } from "@powerhousedao/config/powerhouse";
|
|
3
|
-
import {
|
|
4
|
-
startConnectStudio
|
|
5
|
-
} from "@powerhousedao/connect";
|
|
6
|
-
|
|
7
|
-
// package.json
|
|
8
|
-
var version = "0.33.1-dev.0";
|
|
9
|
-
|
|
10
|
-
// src/commands/connect.ts
|
|
11
|
-
async function startConnect(connectOptions) {
|
|
12
|
-
const { documentModelsDir, editorsDir } = getConfig();
|
|
13
|
-
const options = { documentModelsDir, editorsDir, ...connectOptions };
|
|
14
|
-
return await startConnectStudio(options);
|
|
15
|
-
}
|
|
16
|
-
function connectCommand(program) {
|
|
17
|
-
program.command("connect").description("Starts Connect Studio").option("-p, --port <port>", "Port to run the server on", "3000").option("-h, --host", "Expose the server to the network").option("--https", "Enable HTTPS").option("--open", "Open the browser").option(
|
|
18
|
-
"--config-file <configFile>",
|
|
19
|
-
"Path to the powerhouse.config.js file"
|
|
20
|
-
).option(
|
|
21
|
-
"-le, --local-editors <localEditors>",
|
|
22
|
-
"Link local document editors path"
|
|
23
|
-
).option(
|
|
24
|
-
"-ld, --local-documents <localDocuments>",
|
|
25
|
-
"Link local documents path"
|
|
26
|
-
).action(async (...args) => {
|
|
27
|
-
const connectOptions = args.at(0) || {};
|
|
28
|
-
const { documentModelsDir, editorsDir, packages, studio } = getConfig();
|
|
29
|
-
await startConnectStudio({
|
|
30
|
-
port: studio?.port?.toString() || void 0,
|
|
31
|
-
packages,
|
|
32
|
-
phCliVersion: typeof version === "string" ? version : void 0,
|
|
33
|
-
localDocuments: documentModelsDir || void 0,
|
|
34
|
-
localEditors: editorsDir || void 0,
|
|
35
|
-
open: studio?.openBrowser,
|
|
36
|
-
...connectOptions
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (process.argv.at(2) === "spawn") {
|
|
41
|
-
const optionsArg = process.argv.at(3);
|
|
42
|
-
const options = optionsArg ? JSON.parse(optionsArg) : {};
|
|
43
|
-
startConnect(options).catch((e) => {
|
|
44
|
-
throw e;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
startConnect,
|
|
50
|
-
connectCommand
|
|
51
|
-
};
|
package/dist/chunk-6VK3FH3G.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/chunk-7FTFL36R.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
inspectCommand
|
|
3
|
-
} from "./chunk-IFV5NKI4.js";
|
|
4
|
-
import {
|
|
5
|
-
installCommand
|
|
6
|
-
} from "./chunk-FEGQ7JEJ.js";
|
|
7
|
-
import {
|
|
8
|
-
listCommand
|
|
9
|
-
} from "./chunk-6VK3FH3G.js";
|
|
10
|
-
import {
|
|
11
|
-
serviceCommand
|
|
12
|
-
} from "./chunk-FFVIBNX6.js";
|
|
13
|
-
import {
|
|
14
|
-
uninstallCommand
|
|
15
|
-
} from "./chunk-D42NLWCH.js";
|
|
16
|
-
import {
|
|
17
|
-
connectCommand
|
|
18
|
-
} from "./chunk-4CHMELTF.js";
|
|
19
|
-
import {
|
|
20
|
-
devCommand
|
|
21
|
-
} from "./chunk-3LA6D2BV.js";
|
|
22
|
-
import {
|
|
23
|
-
reactorCommand
|
|
24
|
-
} from "./chunk-ZZ3KNXW6.js";
|
|
25
|
-
import {
|
|
26
|
-
generateCommand
|
|
27
|
-
} from "./chunk-ACKSBZXF.js";
|
|
28
|
-
import {
|
|
29
|
-
helpCommand
|
|
30
|
-
} from "./chunk-KPMNRIJU.js";
|
|
31
|
-
|
|
32
|
-
// src/commands/index.ts
|
|
33
|
-
var commands = [
|
|
34
|
-
devCommand,
|
|
35
|
-
connectCommand,
|
|
36
|
-
generateCommand,
|
|
37
|
-
reactorCommand,
|
|
38
|
-
helpCommand,
|
|
39
|
-
installCommand,
|
|
40
|
-
uninstallCommand,
|
|
41
|
-
serviceCommand,
|
|
42
|
-
listCommand,
|
|
43
|
-
inspectCommand
|
|
44
|
-
];
|
|
45
|
-
function registerCommands(program) {
|
|
46
|
-
commands.forEach((command) => command(program));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
commands,
|
|
51
|
-
registerCommands
|
|
52
|
-
};
|
package/dist/chunk-ACKSBZXF.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// src/commands/generate.ts
|
|
2
|
-
import {
|
|
3
|
-
generate as generateCode,
|
|
4
|
-
generateEditor,
|
|
5
|
-
generateFromFile,
|
|
6
|
-
generateImportScript,
|
|
7
|
-
generateProcessor,
|
|
8
|
-
generateSubgraph,
|
|
9
|
-
promptDirectories
|
|
10
|
-
} from "@powerhousedao/codegen";
|
|
11
|
-
import { getConfig } from "@powerhousedao/config/powerhouse";
|
|
12
|
-
var generate = async (filePath, options) => {
|
|
13
|
-
const baseConfig = getConfig();
|
|
14
|
-
const config = {
|
|
15
|
-
...baseConfig,
|
|
16
|
-
...{
|
|
17
|
-
...options.editors && { editorsDir: options.editors },
|
|
18
|
-
...options.processors && { processorsDir: options.processors },
|
|
19
|
-
...options.documentModels && {
|
|
20
|
-
documentModelsDir: options.documentModels
|
|
21
|
-
},
|
|
22
|
-
...options.skipFormat && { skipFormat: options.skipFormat },
|
|
23
|
-
...options.interactive && { interactive: options.interactive },
|
|
24
|
-
...options.watch && { watch: options.watch }
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const command = {
|
|
28
|
-
editor: !!options.editor,
|
|
29
|
-
editorName: options.editor,
|
|
30
|
-
documentTypes: options.documentTypes,
|
|
31
|
-
processor: !!options.processor,
|
|
32
|
-
processorName: options.processor,
|
|
33
|
-
processorType: options.processorType,
|
|
34
|
-
subgraph: !!options.subgraph,
|
|
35
|
-
subgraphName: options.subgraph,
|
|
36
|
-
importScript: !!options.importScript,
|
|
37
|
-
importScriptName: options.importScript
|
|
38
|
-
};
|
|
39
|
-
if (config.interactive) {
|
|
40
|
-
const result = await promptDirectories(config);
|
|
41
|
-
Object.assign(config, result);
|
|
42
|
-
}
|
|
43
|
-
if (command.editor) {
|
|
44
|
-
if (!command.editorName) {
|
|
45
|
-
throw new Error("Editor name is required (--editor or -e)");
|
|
46
|
-
}
|
|
47
|
-
await generateEditor(
|
|
48
|
-
command.editorName,
|
|
49
|
-
command.documentTypes?.split(/[|,;]/g) ?? [],
|
|
50
|
-
config
|
|
51
|
-
);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
if (command.processor && options.processor) {
|
|
55
|
-
const processorType = options.processorType === "operational" ? "operational" : "analytics";
|
|
56
|
-
await generateProcessor(
|
|
57
|
-
options.processor,
|
|
58
|
-
processorType,
|
|
59
|
-
options.documentTypes?.split(",") ?? [],
|
|
60
|
-
config
|
|
61
|
-
);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (command.subgraph && command.subgraphName) {
|
|
65
|
-
await generateSubgraph(command.subgraphName, null, config);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (command.importScript && command.importScriptName) {
|
|
69
|
-
await generateImportScript(command.importScriptName, config);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (filePath) {
|
|
73
|
-
await generateFromFile(filePath, config);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
await generateCode(config);
|
|
77
|
-
};
|
|
78
|
-
function generateCommand(program) {
|
|
79
|
-
program.command("generate").description("Generate code from the document models").argument("[document-model-file]", "Path to the document model file").option("-i, --interactive", "Run the command in interactive mode").option("--editors <type>", "Path to the editors directory").option("-e, --editor <type>", "Editor Name").option("--processors <type>", "Path to the processors directory").option("-p, --processor <type>", "Processor Name").option("--processor-type <type>", "Processor Type").option("-s, --subgraph <type>", "Subgraph Name").option("--document-models <type>", "Path to the document models directory").option("--document-types <type>", "Supported document types by the editor").option("-is, --import-script <type>", "Import Script Name").option("-sf, --skip-format", "Skip formatting the generated code").option("-w, --watch", "Watch the generated code").action(generate);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export {
|
|
83
|
-
generate,
|
|
84
|
-
generateCommand
|
|
85
|
-
};
|
package/dist/chunk-D42NLWCH.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SUPPORTED_PACKAGE_MANAGERS,
|
|
3
|
-
getPackageManagerFromLockfile,
|
|
4
|
-
getProjectInfo,
|
|
5
|
-
packageManagers,
|
|
6
|
-
updateConfigFile
|
|
7
|
-
} from "./chunk-V725N3UP.js";
|
|
8
|
-
|
|
9
|
-
// src/commands/uninstall.ts
|
|
10
|
-
import { execSync } from "node:child_process";
|
|
11
|
-
import fs from "node:fs";
|
|
12
|
-
function uninstallDependency(packageManager, dependencies, projectPath, workspace) {
|
|
13
|
-
if (!fs.existsSync(projectPath)) {
|
|
14
|
-
throw new Error(`Project path not found: ${projectPath}`);
|
|
15
|
-
}
|
|
16
|
-
const manager = packageManagers[packageManager];
|
|
17
|
-
let uninstallCommand2 = manager.uninstallCommand.replace(
|
|
18
|
-
"{{dependency}}",
|
|
19
|
-
dependencies.join(" ")
|
|
20
|
-
);
|
|
21
|
-
if (workspace) {
|
|
22
|
-
uninstallCommand2 += ` ${manager.workspaceOption}`;
|
|
23
|
-
}
|
|
24
|
-
const commandOptions = { cwd: projectPath };
|
|
25
|
-
execSync(uninstallCommand2, {
|
|
26
|
-
stdio: "inherit",
|
|
27
|
-
...commandOptions
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
var uninstall = (dependencies, options) => {
|
|
31
|
-
if (options.debug) {
|
|
32
|
-
console.log(">>> command arguments", { dependencies, options });
|
|
33
|
-
}
|
|
34
|
-
if (!dependencies || dependencies.length === 0) {
|
|
35
|
-
throw new Error("\u274C Dependency name is required");
|
|
36
|
-
}
|
|
37
|
-
if (options.packageManager && !SUPPORTED_PACKAGE_MANAGERS.includes(options.packageManager)) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
"\u274C Unsupported package manager. Supported package managers: npm, yarn, pnpm, bun"
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const projectInfo = getProjectInfo(options.debug);
|
|
43
|
-
if (options.debug) {
|
|
44
|
-
console.log("\n>>> projectInfo", projectInfo);
|
|
45
|
-
}
|
|
46
|
-
const isGlobal = options.global || projectInfo.isGlobal;
|
|
47
|
-
const packageManager = options.packageManager || getPackageManagerFromLockfile(projectInfo.path);
|
|
48
|
-
if (options.debug) {
|
|
49
|
-
console.log("\n>>> uninstallDependency arguments:");
|
|
50
|
-
console.log(">>> packageManager", packageManager);
|
|
51
|
-
console.log(">>> dependencies", dependencies);
|
|
52
|
-
console.log(">>> isGlobal", isGlobal);
|
|
53
|
-
console.log(">>> projectPath", projectInfo.path);
|
|
54
|
-
console.log(">>> workspace", options.workspace);
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
console.log("Uninstalling dependencies \u{1F4E6} ...");
|
|
58
|
-
uninstallDependency(
|
|
59
|
-
packageManager,
|
|
60
|
-
dependencies,
|
|
61
|
-
projectInfo.path,
|
|
62
|
-
options.workspace
|
|
63
|
-
);
|
|
64
|
-
console.log("Dependency uninstalled successfully \u{1F389}");
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error("\u274C Failed to uninstall dependencies");
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
if (options.debug) {
|
|
70
|
-
console.log("\n>>> updateConfigFile arguments:");
|
|
71
|
-
console.log(">>> dependencies", dependencies);
|
|
72
|
-
console.log(">>> projectPath", projectInfo.path);
|
|
73
|
-
console.log(">>> task", "uninstall");
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
console.log("\u2699\uFE0F Updating powerhouse config file...");
|
|
77
|
-
updateConfigFile(dependencies, projectInfo.path, "uninstall");
|
|
78
|
-
console.log("Config file updated successfully \u{1F389}");
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("\u274C Failed to update config file");
|
|
81
|
-
throw error;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
function uninstallCommand(program) {
|
|
85
|
-
program.command("uninstall").alias("remove").description("Uninstall a powerhouse dependency").argument("[dependencies...]", "Names of the dependencies to remove").option("-g, --global", "Remove the dependency globally").option("--debug", "Show additional logs").option(
|
|
86
|
-
"-w, --workspace",
|
|
87
|
-
"Remove the dependency in the workspace (use this option for monorepos)"
|
|
88
|
-
).option(
|
|
89
|
-
"--package-manager <packageManager>",
|
|
90
|
-
"force package manager to use"
|
|
91
|
-
).action(uninstall);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
uninstallDependency,
|
|
96
|
-
uninstall,
|
|
97
|
-
uninstallCommand
|
|
98
|
-
};
|
package/dist/chunk-DYKO5D3K.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
inspectCommand
|
|
3
|
-
} from "./chunk-IFV5NKI4.js";
|
|
4
|
-
import {
|
|
5
|
-
installCommand
|
|
6
|
-
} from "./chunk-FEGQ7JEJ.js";
|
|
7
|
-
import {
|
|
8
|
-
listCommand
|
|
9
|
-
} from "./chunk-6VK3FH3G.js";
|
|
10
|
-
import {
|
|
11
|
-
serviceCommand
|
|
12
|
-
} from "./chunk-FFVIBNX6.js";
|
|
13
|
-
import {
|
|
14
|
-
uninstallCommand
|
|
15
|
-
} from "./chunk-D42NLWCH.js";
|
|
16
|
-
import {
|
|
17
|
-
connectCommand
|
|
18
|
-
} from "./chunk-XYNGLOOS.js";
|
|
19
|
-
import {
|
|
20
|
-
devCommand
|
|
21
|
-
} from "./chunk-3LA6D2BV.js";
|
|
22
|
-
import {
|
|
23
|
-
reactorCommand
|
|
24
|
-
} from "./chunk-ZZ3KNXW6.js";
|
|
25
|
-
import {
|
|
26
|
-
generateCommand
|
|
27
|
-
} from "./chunk-ACKSBZXF.js";
|
|
28
|
-
import {
|
|
29
|
-
helpCommand
|
|
30
|
-
} from "./chunk-KPMNRIJU.js";
|
|
31
|
-
|
|
32
|
-
// src/commands/index.ts
|
|
33
|
-
var commands = [
|
|
34
|
-
devCommand,
|
|
35
|
-
connectCommand,
|
|
36
|
-
generateCommand,
|
|
37
|
-
reactorCommand,
|
|
38
|
-
helpCommand,
|
|
39
|
-
installCommand,
|
|
40
|
-
uninstallCommand,
|
|
41
|
-
serviceCommand,
|
|
42
|
-
listCommand,
|
|
43
|
-
inspectCommand
|
|
44
|
-
];
|
|
45
|
-
function registerCommands(program) {
|
|
46
|
-
commands.forEach((command) => command(program));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
commands,
|
|
51
|
-
registerCommands
|
|
52
|
-
};
|
package/dist/chunk-FEGQ7JEJ.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SUPPORTED_PACKAGE_MANAGERS,
|
|
3
|
-
getPackageManagerFromLockfile,
|
|
4
|
-
getProjectInfo,
|
|
5
|
-
packageManagers,
|
|
6
|
-
updateConfigFile
|
|
7
|
-
} from "./chunk-V725N3UP.js";
|
|
8
|
-
|
|
9
|
-
// src/commands/install.ts
|
|
10
|
-
import { execSync } from "node:child_process";
|
|
11
|
-
import fs from "node:fs";
|
|
12
|
-
function installDependency(packageManager, dependencies, projectPath, workspace) {
|
|
13
|
-
if (!fs.existsSync(projectPath)) {
|
|
14
|
-
throw new Error(`Project path not found: ${projectPath}`);
|
|
15
|
-
}
|
|
16
|
-
const manager = packageManagers[packageManager];
|
|
17
|
-
let installCommand2 = manager.installCommand.replace(
|
|
18
|
-
"{{dependency}}",
|
|
19
|
-
dependencies.join(" ")
|
|
20
|
-
);
|
|
21
|
-
if (workspace) {
|
|
22
|
-
installCommand2 += ` ${manager.workspaceOption}`;
|
|
23
|
-
}
|
|
24
|
-
const commandOptions = { cwd: projectPath };
|
|
25
|
-
execSync(installCommand2, {
|
|
26
|
-
stdio: "inherit",
|
|
27
|
-
...commandOptions
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
var install = (dependencies, options) => {
|
|
31
|
-
if (options.debug) {
|
|
32
|
-
console.log(">>> command arguments", { dependencies, options });
|
|
33
|
-
}
|
|
34
|
-
if (!dependencies || dependencies.length === 0) {
|
|
35
|
-
throw new Error("\u274C Dependency name is required");
|
|
36
|
-
}
|
|
37
|
-
if (options.packageManager && !SUPPORTED_PACKAGE_MANAGERS.includes(options.packageManager)) {
|
|
38
|
-
throw new Error(
|
|
39
|
-
"\u274C Unsupported package manager. Supported package managers: npm, yarn, pnpm, bun"
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const projectInfo = getProjectInfo(options.debug);
|
|
43
|
-
if (options.debug) {
|
|
44
|
-
console.log("\n>>> projectInfo", projectInfo);
|
|
45
|
-
}
|
|
46
|
-
const isGlobal = options.global || projectInfo.isGlobal;
|
|
47
|
-
const packageManager = options.packageManager || getPackageManagerFromLockfile(projectInfo.path);
|
|
48
|
-
if (options.debug) {
|
|
49
|
-
console.log("\n>>> installDependency arguments:");
|
|
50
|
-
console.log(">>> packageManager", packageManager);
|
|
51
|
-
console.log(">>> dependencies", dependencies);
|
|
52
|
-
console.log(">>> isGlobal", isGlobal);
|
|
53
|
-
console.log(">>> projectPath", projectInfo.path);
|
|
54
|
-
console.log(">>> workspace", options.workspace);
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
console.log("installing dependencies \u{1F4E6} ...");
|
|
58
|
-
installDependency(
|
|
59
|
-
packageManager,
|
|
60
|
-
dependencies,
|
|
61
|
-
projectInfo.path,
|
|
62
|
-
options.workspace
|
|
63
|
-
);
|
|
64
|
-
console.log("Dependency installed successfully \u{1F389}");
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error("\u274C Failed to install dependencies");
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
if (options.debug) {
|
|
70
|
-
console.log("\n>>> updateConfigFile arguments:");
|
|
71
|
-
console.log(">>> dependencies", dependencies);
|
|
72
|
-
console.log(">>> projectPath", projectInfo.path);
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
console.log("\u2699\uFE0F Updating powerhouse config file...");
|
|
76
|
-
updateConfigFile(dependencies, projectInfo.path, "install");
|
|
77
|
-
console.log("Config file updated successfully \u{1F389}");
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error("\u274C Failed to update config file");
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
function installCommand(program) {
|
|
84
|
-
program.command("install").alias("add").alias("i").description("Install a powerhouse dependency").argument("[dependencies...]", "Names of the dependencies to install").option("-g, --global", "Install the dependency globally").option("--debug", "Show additional logs").option(
|
|
85
|
-
"-w, --workspace",
|
|
86
|
-
"Install the dependency in the workspace (use this option for monorepos)"
|
|
87
|
-
).option(
|
|
88
|
-
"--package-manager <packageManager>",
|
|
89
|
-
"force package manager to use"
|
|
90
|
-
).action(install);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
installDependency,
|
|
95
|
-
install,
|
|
96
|
-
installCommand
|
|
97
|
-
};
|