@powerhousedao/ph-cli 0.2.4 → 0.2.6
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/cli.js +4 -10
- package/dist/cli.js.map +1 -1
- package/dist/commands/dev.js +13 -21
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/generate.js +7 -10
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/help.js +1 -3
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.js +10 -35
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.js +3 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +1 -12
- package/dist/types.js +0 -1
- package/package.json +9 -6
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import registerCommands from './commands/index.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
var registerCommands = require('./commands');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var registerCommands__default = /*#__PURE__*/_interopDefault(registerCommands);
|
|
10
|
-
|
|
11
|
-
const program = new commander.Command();
|
|
5
|
+
const program = new Command();
|
|
12
6
|
program.name("ph-cli").description("CLI tool for Powerhouse DAO").version("1.0.0");
|
|
13
|
-
|
|
7
|
+
registerCommands(program);
|
|
14
8
|
program.parse(process.argv);
|
|
15
9
|
//# sourceMappingURL=cli.js.map
|
|
16
10
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"names":[],"mappings":";;;;AAIA,MAAM,OAAA,GAAU,IAAI,OAAQ,EAAA;AAE5B,OAAA,CACG,KAAK,QAAQ,CAAA,CACb,YAAY,6BAA6B,CAAA,CACzC,QAAQ,OAAO,CAAA;AAElB,gBAAA,CAAiB,OAAO,CAAA;AAExB,OAAQ,CAAA,KAAA,CAAM,QAAQ,IAAI,CAAA","file":"cli.js","sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport registerCommands from \"./commands/index.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"ph-cli\")\n .description(\"CLI tool for Powerhouse DAO\")\n .version(\"1.0.0\");\n\nregisterCommands(program);\n\nprogram.parse(process.argv);\n"]}
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var colorette = require('colorette');
|
|
6
|
-
var fs = require('fs');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
11
|
-
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { green, red } from 'colorette';
|
|
4
|
+
import fs from 'fs';
|
|
12
5
|
|
|
13
6
|
const CONNECT_BIN_PATH = "node_modules/.bin/connect";
|
|
14
7
|
const dev = ({
|
|
15
8
|
projectPath
|
|
16
9
|
}) => {
|
|
17
|
-
let binPath =
|
|
18
|
-
if (!
|
|
10
|
+
let binPath = path.join(projectPath || ".", "node_modules/.bin/connect");
|
|
11
|
+
if (!fs.existsSync(binPath)) {
|
|
19
12
|
const packagePath = require.resolve("@powerhousedao/connect/package.json");
|
|
20
|
-
const packageDir =
|
|
21
|
-
binPath =
|
|
13
|
+
const packageDir = path.dirname(packagePath);
|
|
14
|
+
binPath = path.join(packageDir, CONNECT_BIN_PATH);
|
|
22
15
|
}
|
|
23
|
-
const child =
|
|
16
|
+
const child = spawn(binPath);
|
|
24
17
|
child.stdout.on("data", (data) => {
|
|
25
|
-
|
|
26
|
-
process.stdout.write(
|
|
18
|
+
green(data.toString());
|
|
19
|
+
process.stdout.write(green(`[Connect]: ${data.toString()}`));
|
|
27
20
|
});
|
|
28
21
|
child.stderr.on("data", (data) => {
|
|
29
|
-
process.stderr.write(
|
|
22
|
+
process.stderr.write(red(`[Connect]: ${data.toString()}`));
|
|
30
23
|
});
|
|
31
24
|
child.on("close", (code) => {
|
|
32
25
|
console.log(`Connect process exited with code ${code}`);
|
|
@@ -36,7 +29,6 @@ function devCommand(program) {
|
|
|
36
29
|
program.command("dev").description("Starts dev environment").option("--project-path <type>", "path to the project").action(dev);
|
|
37
30
|
}
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
exports.devCommand = devCommand;
|
|
32
|
+
export { dev, devCommand };
|
|
41
33
|
//# sourceMappingURL=dev.js.map
|
|
42
34
|
//# sourceMappingURL=dev.js.map
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/dev.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;;;;AAOA,MAAM,gBAAmB,GAAA,2BAAA;AAElB,MAAM,MAAqD,CAAC;AAAA,EACjE;AACF,CAAM,KAAA;AACJ,EAAA,IAAI,OAAU,GAAA,IAAA,CAAK,IAAK,CAAA,WAAA,IAAe,KAAK,2BAA2B,CAAA;AAEvE,EAAA,IAAI,CAAC,EAAA,CAAG,UAAW,CAAA,OAAO,CAAG,EAAA;AAC3B,IAAM,MAAA,WAAA,GAAc,gBAAgB,qCAAqC,CAAA;AACzE,IAAM,MAAA,UAAA,GAAa,IAAK,CAAA,OAAA,CAAQ,WAAW,CAAA;AAE3C,IAAU,OAAA,GAAA,IAAA,CAAK,IAAK,CAAA,UAAA,EAAY,gBAAgB,CAAA;AAAA;AAGlD,EAAM,MAAA,KAAA,GAAQ,MAAM,OAAO,CAAA;AAE3B,EAAA,KAAA,CAAM,MAAO,CAAA,EAAA,CAAG,MAAQ,EAAA,CAAC,IAAiB,KAAA;AACxC,IAAM,KAAA,CAAA,IAAA,CAAK,UAAU,CAAA;AACrB,IAAQ,OAAA,CAAA,MAAA,CAAO,MAAM,KAAM,CAAA,CAAA,WAAA,EAAc,KAAK,QAAS,EAAC,EAAE,CAAC,CAAA;AAAA,GAC5D,CAAA;AAED,EAAA,KAAA,CAAM,MAAO,CAAA,EAAA,CAAG,MAAQ,EAAA,CAAC,IAAiB,KAAA;AACxC,IAAQ,OAAA,CAAA,MAAA,CAAO,MAAM,GAAI,CAAA,CAAA,WAAA,EAAc,KAAK,QAAS,EAAC,EAAE,CAAC,CAAA;AAAA,GAC1D,CAAA;AAED,EAAM,KAAA,CAAA,EAAA,CAAG,OAAS,EAAA,CAAC,IAAS,KAAA;AAC1B,IAAQ,OAAA,CAAA,GAAA,CAAI,CAAoC,iCAAA,EAAA,IAAI,CAAE,CAAA,CAAA;AAAA,GACvD,CAAA;AACH;AAEO,SAAS,WAAW,OAAkB,EAAA;AAC3C,EACG,OAAA,CAAA,OAAA,CAAQ,KAAK,CAAA,CACb,WAAY,CAAA,wBAAwB,CACpC,CAAA,MAAA,CAAO,uBAAyB,EAAA,qBAAqB,CACrD,CAAA,MAAA,CAAO,GAAG,CAAA;AACf","file":"dev.js","sourcesContent":["import { Command } from \"commander\";\nimport path from \"path\";\nimport { spawn } from \"child_process\";\nimport { green, red } from \"colorette\";\nimport fs from \"fs\";\nimport { CommandActionType } from \"../types.js\";\n\nconst CONNECT_BIN_PATH = \"node_modules/.bin/connect\";\n\nexport const dev: CommandActionType<[{ projectPath?: string }]> = ({\n projectPath,\n}) => {\n let binPath = path.join(projectPath || \".\", \"node_modules/.bin/connect\");\n\n if (!fs.existsSync(binPath)) {\n const packagePath = require.resolve(\"@powerhousedao/connect/package.json\");\n const packageDir = path.dirname(packagePath);\n\n binPath = path.join(packageDir, CONNECT_BIN_PATH);\n }\n\n const child = spawn(binPath);\n\n child.stdout.on(\"data\", (data: Buffer) => {\n green(data.toString());\n process.stdout.write(green(`[Connect]: ${data.toString()}`));\n });\n\n child.stderr.on(\"data\", (data: Buffer) => {\n process.stderr.write(red(`[Connect]: ${data.toString()}`));\n });\n\n child.on(\"close\", (code) => {\n console.log(`Connect process exited with code ${code}`);\n });\n};\n\nexport function devCommand(program: Command) {\n program\n .command(\"dev\")\n .description(\"Starts dev environment\")\n .option(\"--project-path <type>\", \"path to the project\")\n .action(dev);\n}\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var codegen = require('@powerhousedao/codegen');
|
|
1
|
+
import { getConfig, promptDirectories, generateEditor, generateFromFile, generate as generate$1 } from '@powerhousedao/codegen';
|
|
4
2
|
|
|
5
3
|
const generate = async (filePath, options) => {
|
|
6
|
-
const baseConfig =
|
|
4
|
+
const baseConfig = getConfig();
|
|
7
5
|
const config = {
|
|
8
6
|
...baseConfig,
|
|
9
7
|
...{
|
|
@@ -22,14 +20,14 @@ const generate = async (filePath, options) => {
|
|
|
22
20
|
documentTypes: options.documentTypes
|
|
23
21
|
};
|
|
24
22
|
if (config.interactive) {
|
|
25
|
-
const result = await
|
|
23
|
+
const result = await promptDirectories(config);
|
|
26
24
|
Object.assign(config, result);
|
|
27
25
|
}
|
|
28
26
|
if (command.editor) {
|
|
29
27
|
if (!command.editorName) {
|
|
30
28
|
throw new Error("Editor name is required (--editor or -e)");
|
|
31
29
|
}
|
|
32
|
-
await
|
|
30
|
+
await generateEditor(
|
|
33
31
|
command.editorName,
|
|
34
32
|
command.documentTypes?.split(/[|,;]/g) ?? [],
|
|
35
33
|
config
|
|
@@ -37,16 +35,15 @@ const generate = async (filePath, options) => {
|
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
39
37
|
if (filePath) {
|
|
40
|
-
await
|
|
38
|
+
await generateFromFile(filePath, config);
|
|
41
39
|
return;
|
|
42
40
|
}
|
|
43
|
-
await
|
|
41
|
+
await generate$1(config);
|
|
44
42
|
};
|
|
45
43
|
function generateCommand(program) {
|
|
46
44
|
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("--document-models <type>", "Path to the document models directory").option("--document-types <type>", "Supported document types by the editor").option("-f, --format", "Format the generated code").option("-w, --watch", "Watch the generated code").action(generate);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
exports.generateCommand = generateCommand;
|
|
47
|
+
export { generate, generateCommand };
|
|
51
48
|
//# sourceMappingURL=generate.js.map
|
|
52
49
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/generate.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/commands/generate.ts"],"names":["generateCode"],"mappings":";;AAUa,MAAA,QAAA,GAaT,OAAO,QAAA,EAAU,OAAY,KAAA;AAC/B,EAAA,MAAM,aAAa,SAAU,EAAA;AAE7B,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,GAAG,UAAA;AAAA,IACH,GAAG;AAAA,MACD,GAAI,OAAQ,CAAA,OAAA,IAAW,EAAE,UAAA,EAAY,QAAQ,OAAQ,EAAA;AAAA,MACrD,GAAI,QAAQ,cAAkB,IAAA;AAAA,QAC5B,mBAAmB,OAAQ,CAAA;AAAA,OAC7B;AAAA,MACA,GAAI,OAAQ,CAAA,MAAA,IAAU,EAAE,MAAA,EAAQ,QAAQ,MAAO,EAAA;AAAA,MAC/C,GAAI,OAAQ,CAAA,WAAA,IAAe,EAAE,WAAA,EAAa,QAAQ,WAAY,EAAA;AAAA,MAC9D,GAAI,OAAQ,CAAA,KAAA,IAAS,EAAE,KAAA,EAAO,QAAQ,KAAM;AAAA;AAC9C,GACF;AAEA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,MAAA,EAAQ,CAAC,CAAC,OAAQ,CAAA,MAAA;AAAA,IAClB,YAAY,OAAQ,CAAA,MAAA;AAAA,IACpB,eAAe,OAAQ,CAAA;AAAA,GACzB;AAEA,EAAA,IAAI,OAAO,WAAa,EAAA;AACtB,IAAM,MAAA,MAAA,GAAS,MAAM,iBAAA,CAAkB,MAAM,CAAA;AAC7C,IAAO,MAAA,CAAA,MAAA,CAAO,QAAQ,MAAM,CAAA;AAAA;AAG9B,EAAA,IAAI,QAAQ,MAAQ,EAAA;AAClB,IAAI,IAAA,CAAC,QAAQ,UAAY,EAAA;AACvB,MAAM,MAAA,IAAI,MAAM,0CAA0C,CAAA;AAAA;AAE5D,IAAM,MAAA,cAAA;AAAA,MACJ,OAAQ,CAAA,UAAA;AAAA,MACR,OAAQ,CAAA,aAAA,EAAe,KAAM,CAAA,QAAQ,KAAK,EAAC;AAAA,MAC3C;AAAA,KACF;AAEA,IAAA;AAAA;AAGF,EAAA,IAAI,QAAU,EAAA;AACZ,IAAM,MAAA,gBAAA,CAAiB,UAAU,MAAM,CAAA;AACvC,IAAA;AAAA;AAGF,EAAA,MAAMA,WAAa,MAAM,CAAA;AAC3B;AAEO,SAAS,gBAAgB,OAAkB,EAAA;AAChD,EAAA,OAAA,CACG,QAAQ,UAAU,CAAA,CAClB,WAAY,CAAA,wCAAwC,EACpD,QAAS,CAAA,uBAAA,EAAyB,iCAAiC,CAAA,CACnE,OAAO,mBAAqB,EAAA,qCAAqC,EACjE,MAAO,CAAA,kBAAA,EAAoB,+BAA+B,CAC1D,CAAA,MAAA,CAAO,qBAAuB,EAAA,aAAa,EAC3C,MAAO,CAAA,0BAAA,EAA4B,uCAAuC,CAC1E,CAAA,MAAA,CAAO,2BAA2B,wCAAwC,CAAA,CAC1E,MAAO,CAAA,cAAA,EAAgB,2BAA2B,CAClD,CAAA,MAAA,CAAO,eAAe,0BAA0B,CAAA,CAChD,OAAO,QAAQ,CAAA;AACpB","file":"generate.js","sourcesContent":["import { Command } from \"commander\";\nimport {\n getConfig,\n generate as generateCode,\n generateEditor,\n generateFromFile,\n promptDirectories,\n} from \"@powerhousedao/codegen\";\nimport { CommandActionType } from \"../types.js\";\n\nexport const generate: CommandActionType<\n [\n string | undefined,\n {\n interactive?: boolean;\n editors?: string;\n documentModels?: string;\n format?: boolean;\n watch?: boolean;\n editor?: string;\n documentTypes?: string;\n },\n ]\n> = async (filePath, options) => {\n const baseConfig = getConfig();\n\n const config = {\n ...baseConfig,\n ...{\n ...(options.editors && { editorsDir: options.editors }),\n ...(options.documentModels && {\n documentModelsDir: options.documentModels,\n }),\n ...(options.format && { format: options.format }),\n ...(options.interactive && { interactive: options.interactive }),\n ...(options.watch && { watch: options.watch }),\n },\n };\n\n const command = {\n editor: !!options.editor,\n editorName: options.editor,\n documentTypes: options.documentTypes,\n };\n\n if (config.interactive) {\n const result = await promptDirectories(config);\n Object.assign(config, result);\n }\n\n if (command.editor) {\n if (!command.editorName) {\n throw new Error(\"Editor name is required (--editor or -e)\");\n }\n await generateEditor(\n command.editorName,\n command.documentTypes?.split(/[|,;]/g) ?? [],\n config,\n );\n\n return;\n }\n\n if (filePath) {\n await generateFromFile(filePath, config);\n return;\n }\n\n await generateCode(config);\n};\n\nexport function generateCommand(program: Command) {\n program\n .command(\"generate\")\n .description(\"Generate code from the document models\")\n .argument(\"[document-model-file]\", \"Path to the document model file\")\n .option(\"-i, --interactive\", \"Run the command in interactive mode\")\n .option(\"--editors <type>\", \"Path to the editors directory\")\n .option(\"-e, --editor <type>\", \"Editor Name\")\n .option(\"--document-models <type>\", \"Path to the document models directory\")\n .option(\"--document-types <type>\", \"Supported document types by the editor\")\n .option(\"-f, --format\", \"Format the generated code\")\n .option(\"-w, --watch\", \"Watch the generated code\")\n .action(generate);\n}\n"]}
|
package/dist/commands/help.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
function helpCommand(program) {
|
|
4
2
|
program.command("help").description("Display help information").action(() => {
|
|
5
3
|
program.help();
|
|
6
4
|
});
|
|
7
5
|
}
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
export { helpCommand };
|
|
10
8
|
//# sourceMappingURL=help.js.map
|
|
11
9
|
//# sourceMappingURL=help.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/help.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAEO,SAAS,YAAY,OAAkB,EAAA;AAC5C,EAAA,OAAA,CACG,QAAQ,MAAM,CAAA,CACd,YAAY,0BAA0B,CAAA,CACtC,OAAO,MAAM;AACZ,IAAA,OAAA,CAAQ,IAAK,EAAA;AAAA,GACd,CAAA;AACL","file":"help.js","sourcesContent":["import { Command } from \"commander\";\n\nexport function helpCommand(program: Command) {\n program\n .command(\"help\")\n .description(\"Display help information\")\n .action(() => {\n program.help();\n });\n}\n"]}
|
package/dist/commands/index.js
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { devCommand } from './dev.js';
|
|
2
|
+
export * from './dev.js';
|
|
3
|
+
import { helpCommand } from './help.js';
|
|
4
|
+
export * from './help.js';
|
|
5
|
+
import { initCommand } from './init.js';
|
|
6
|
+
export * from './init.js';
|
|
7
|
+
import { generateCommand } from './generate.js';
|
|
8
|
+
export * from './generate.js';
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var dev = require('./dev');
|
|
6
|
-
var help = require('./help');
|
|
7
|
-
var init = require('./init');
|
|
8
|
-
var generate = require('./generate');
|
|
9
|
-
|
|
10
|
-
const commands = [init.initCommand, dev.devCommand, generate.generateCommand, help.helpCommand];
|
|
10
|
+
const commands = [initCommand, devCommand, generateCommand, helpCommand];
|
|
11
11
|
function registerCommands(program) {
|
|
12
12
|
commands.forEach((command) => command(program));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
exports.default = registerCommands;
|
|
17
|
-
Object.keys(dev).forEach(function (k) {
|
|
18
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return dev[k]; }
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
Object.keys(help).forEach(function (k) {
|
|
24
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return help[k]; }
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
Object.keys(init).forEach(function (k) {
|
|
30
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () { return init[k]; }
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
Object.keys(generate).forEach(function (k) {
|
|
36
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () { return generate[k]; }
|
|
39
|
-
});
|
|
40
|
-
});
|
|
15
|
+
export { commands, registerCommands as default };
|
|
41
16
|
//# sourceMappingURL=index.js.map
|
|
42
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/index.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/commands/index.ts"],"names":[],"mappings":";;;;;;;;;AAMO,MAAM,QAAW,GAAA,CAAC,WAAa,EAAA,UAAA,EAAY,iBAAiB,WAAW;AAE/D,SAAR,iBAAkC,OAAkB,EAAA;AACzD,EAAA,QAAA,CAAS,OAAQ,CAAA,CAAC,OAAY,KAAA,OAAA,CAAQ,OAAO,CAAC,CAAA;AAChD","file":"index.js","sourcesContent":["import { Command } from \"commander\";\nimport { devCommand } from \"./dev.js\";\nimport { helpCommand } from \"./help.js\";\nimport { initCommand } from \"./init.js\";\nimport { generateCommand } from \"./generate.js\";\n\nexport const commands = [initCommand, devCommand, generateCommand, helpCommand];\n\nexport default function registerCommands(program: Command) {\n commands.forEach((command) => command(program));\n}\n\nexport * from \"./dev.js\";\nexport * from \"./help.js\";\nexport * from \"./init.js\";\nexport * from \"./generate.js\";\n"]}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var codegen = require('@powerhousedao/codegen');
|
|
1
|
+
import { createProject } from '@powerhousedao/codegen';
|
|
4
2
|
|
|
5
3
|
const init = async (projectName, options) => {
|
|
6
4
|
console.log("Initializing a new project...", projectName);
|
|
@@ -10,7 +8,7 @@ const init = async (projectName, options) => {
|
|
|
10
8
|
positionalArgs.push(projectName);
|
|
11
9
|
}
|
|
12
10
|
try {
|
|
13
|
-
await
|
|
11
|
+
await createProject({
|
|
14
12
|
_: positionalArgs,
|
|
15
13
|
"--interactive": !!options.interactive
|
|
16
14
|
});
|
|
@@ -22,7 +20,6 @@ function initCommand(program) {
|
|
|
22
20
|
program.command("init").description("Initialize a new project").argument("[project-name]", "Name of the project").option("--interactive", "Run the command in interactive mode").action(init);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
exports.initCommand = initCommand;
|
|
23
|
+
export { init, initCommand };
|
|
27
24
|
//# sourceMappingURL=init.js.map
|
|
28
25
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"names":[],"mappings":";;AAIa,MAAA,IAAA,GAET,OAAO,WAAA,EAAa,OAAY,KAAA;AAClC,EAAQ,OAAA,CAAA,GAAA,CAAI,iCAAiC,WAAW,CAAA;AACxD,EAAQ,OAAA,CAAA,GAAA,CAAI,WAAW,OAAO,CAAA;AAC9B,EAAA,MAAM,iBAA2B,EAAC;AAElC,EAAA,IAAI,WAAa,EAAA;AACf,IAAA,cAAA,CAAe,KAAK,WAAW,CAAA;AAAA;AAGjC,EAAI,IAAA;AACF,IAAA,MAAM,aAAc,CAAA;AAAA,MAClB,CAAG,EAAA,cAAA;AAAA,MACH,eAAA,EAAiB,CAAC,CAAC,OAAQ,CAAA;AAAA,KAC5B,CAAA;AAAA,GACK,CAAA,MAAA;AACN,IAAA,OAAA,CAAQ,IAAI,kCAAkC,CAAA;AAAA;AAElD;AAEO,SAAS,YAAY,OAAkB,EAAA;AAC5C,EAAA,OAAA,CACG,OAAQ,CAAA,MAAM,CACd,CAAA,WAAA,CAAY,0BAA0B,CACtC,CAAA,QAAA,CAAS,gBAAkB,EAAA,qBAAqB,EAChD,MAAO,CAAA,eAAA,EAAiB,qCAAqC,CAAA,CAC7D,OAAO,IAAI,CAAA;AAChB","file":"init.js","sourcesContent":["import { Command } from \"commander\";\nimport { createProject } from \"@powerhousedao/codegen\";\nimport { CommandActionType } from \"../types.js\";\n\nexport const init: CommandActionType<\n [string | undefined, { interactive?: boolean }]\n> = async (projectName, options) => {\n console.log(\"Initializing a new project...\", projectName);\n console.log(\"Options\", options);\n const positionalArgs: string[] = [];\n\n if (projectName) {\n positionalArgs.push(projectName);\n }\n\n try {\n await createProject({\n _: positionalArgs,\n \"--interactive\": !!options.interactive,\n });\n } catch {\n console.log(\"Failed to initialize the project\");\n }\n};\n\nexport function initCommand(program: Command) {\n program\n .command(\"init\")\n .description(\"Initialize a new project\")\n .argument(\"[project-name]\", \"Name of the project\")\n .option(\"--interactive\", \"Run the command in interactive mode\")\n .action(init);\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var commands = require('./commands');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(commands).forEach(function (k) {
|
|
8
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return commands[k]; }
|
|
11
|
-
});
|
|
12
|
-
});
|
|
1
|
+
export * from './commands/index.js';
|
|
13
2
|
//# sourceMappingURL=index.js.map
|
|
14
3
|
//# sourceMappingURL=index.js.map
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"main": "dist/index.js",
|
|
8
9
|
"publishConfig": {
|
|
@@ -21,14 +22,16 @@
|
|
|
21
22
|
"tsup": "^8.3.0"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@powerhousedao/codegen": "0.
|
|
25
|
+
"@powerhousedao/codegen": "0.11.1",
|
|
25
26
|
"@powerhousedao/connect": "develop",
|
|
27
|
+
"@powerhousedao/design-system": "^1.5.0",
|
|
28
|
+
"@powerhousedao/scalars": "^1.6.0",
|
|
26
29
|
"colorette": "^2.0.20",
|
|
27
30
|
"commander": "^12.1.0",
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
31
|
+
"document-model-libs": "^1.105.0",
|
|
32
|
+
"graphql": "^16.8.1",
|
|
33
|
+
"react": "^18.3.1",
|
|
34
|
+
"react-dom": "^18.3.1"
|
|
32
35
|
},
|
|
33
36
|
"scripts": {
|
|
34
37
|
"build": "tsup",
|