@powerhousedao/ph-cli 0.3.2 → 0.4.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.
|
@@ -9,7 +9,7 @@ const generate = async (filePath, options) => {
|
|
|
9
9
|
...options.documentModels && {
|
|
10
10
|
documentModelsDir: options.documentModels
|
|
11
11
|
},
|
|
12
|
-
...options.
|
|
12
|
+
...options.skipFormat && { skipFormat: options.skipFormat },
|
|
13
13
|
...options.interactive && { interactive: options.interactive },
|
|
14
14
|
...options.watch && { watch: options.watch }
|
|
15
15
|
}
|
|
@@ -41,7 +41,7 @@ const generate = async (filePath, options) => {
|
|
|
41
41
|
await generate$1(config);
|
|
42
42
|
};
|
|
43
43
|
function generateCommand(program) {
|
|
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("-
|
|
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("-sf, --skip-format", "Skip formatting the generated code").option("-w, --watch", "Watch the generated code").action(generate);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export { generate, generateCommand };
|
|
@@ -1 +1 @@
|
|
|
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,I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AAA,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,oBAAA,EAAsB,oCAAoC,CACjE,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 skipFormat?: 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.skipFormat && { skipFormat: options.skipFormat }),\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(\"-sf, --skip-format\", \"Skip formatting the generated code\")\n .option(\"-w, --watch\", \"Watch the generated code\")\n .action(generate);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"tsup": "^8.3.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@powerhousedao/codegen": "0.
|
|
25
|
+
"@powerhousedao/codegen": "0.14.0",
|
|
26
26
|
"@powerhousedao/connect": "develop",
|
|
27
|
-
"@powerhousedao/design-system": "^1.7.
|
|
27
|
+
"@powerhousedao/design-system": "^1.7.1",
|
|
28
28
|
"@powerhousedao/scalars": "^1.8.0",
|
|
29
29
|
"colorette": "^2.0.20",
|
|
30
30
|
"commander": "^12.1.0",
|
|
31
|
-
"document-model-libs": "^1.
|
|
31
|
+
"document-model-libs": "^1.110.0",
|
|
32
32
|
"graphql": "^16.8.1",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
34
|
"react-dom": "^18.3.1"
|