@powerhousedao/ph-cli 6.2.3-dev.5 → 6.2.3-dev.50
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/{auth-AR3VxAIk.mjs → auth-BFUq7CvE.mjs} +3 -3
- package/dist/{auth-AR3VxAIk.mjs.map → auth-BFUq7CvE.mjs.map} +1 -1
- package/dist/auth-CNhbN5UM.mjs +4 -0
- package/dist/build-Di0SwHGs.mjs +166 -0
- package/dist/build-Di0SwHGs.mjs.map +1 -0
- package/dist/build-Dk9HoX9_.mjs +4 -0
- package/dist/{cli-connect-override-D3hh4aH_.mjs → cli-connect-override-b4kKqgOZ.mjs} +62 -27
- package/dist/cli-connect-override-b4kKqgOZ.mjs.map +1 -0
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +304 -89
- package/dist/cli.mjs.map +1 -1
- package/dist/connect-build-CJhbzYPL.mjs +218 -0
- package/dist/connect-build-CJhbzYPL.mjs.map +1 -0
- package/dist/{connect-config-BWGiW3IB.mjs → connect-config-DGfPEeP8.mjs} +19 -12
- package/dist/connect-config-DGfPEeP8.mjs.map +1 -0
- package/dist/{connect-preview-D7ypzFDc.mjs → connect-preview-CzDqR-JN.mjs} +12 -8
- package/dist/{connect-preview-D7ypzFDc.mjs.map → connect-preview-CzDqR-JN.mjs.map} +1 -1
- package/dist/{connect-studio-D6rfWCNB.mjs → connect-studio-_-O1-oef.mjs} +15 -10
- package/dist/{connect-studio-D6rfWCNB.mjs.map → connect-studio-_-O1-oef.mjs.map} +1 -1
- package/dist/connect-studio-f3K1qPWd.mjs +4 -0
- package/dist/{generate-all-DrT4ZxHX.mjs → generate-all-CIwP-3aa.mjs} +3 -3
- package/dist/{generate-all-DrT4ZxHX.mjs.map → generate-all-CIwP-3aa.mjs.map} +1 -1
- package/dist/{generate-app-DNNqA-H3.mjs → generate-app-BTs1u-9l.mjs} +7 -5
- package/dist/{generate-app-DNNqA-H3.mjs.map → generate-app-BTs1u-9l.mjs.map} +1 -1
- package/dist/{generate-document-model-BJXyODfm.mjs → generate-document-model-DhDQ_06X.mjs} +17 -7
- package/dist/{generate-document-model-BJXyODfm.mjs.map → generate-document-model-DhDQ_06X.mjs.map} +1 -1
- package/dist/{generate-editor-BejvaVVT.mjs → generate-editor-CW7Do69u.mjs} +7 -5
- package/dist/{generate-editor-BejvaVVT.mjs.map → generate-editor-CW7Do69u.mjs.map} +1 -1
- package/dist/generate-piece-QTt-ddt2.mjs +65 -0
- package/dist/generate-piece-QTt-ddt2.mjs.map +1 -0
- package/dist/generate-piece-action-DbxrzfKY.mjs +29 -0
- package/dist/generate-piece-action-DbxrzfKY.mjs.map +1 -0
- package/dist/generate-piece-trigger-CqVOcL9g.mjs +30 -0
- package/dist/generate-piece-trigger-CqVOcL9g.mjs.map +1 -0
- package/dist/{generate-processor-_WOx-mMe.mjs → generate-processor-DBtTkgo5.mjs} +15 -8
- package/dist/generate-processor-DBtTkgo5.mjs.map +1 -0
- package/dist/{generate-subgraph-BsHUstpl.mjs → generate-subgraph-Dm27O59o.mjs} +10 -6
- package/dist/generate-subgraph-Dm27O59o.mjs.map +1 -0
- package/dist/{init-BZP6gvYd.mjs → init-CIEMyAug.mjs} +4 -4
- package/dist/{init-BZP6gvYd.mjs.map → init-CIEMyAug.mjs.map} +1 -1
- package/dist/{inspect-DXjbQEV_.mjs → inspect-BpCB0TPo.mjs} +11 -4
- package/dist/inspect-BpCB0TPo.mjs.map +1 -0
- package/dist/install-added-dependencies-DVSbzler.mjs +33 -0
- package/dist/install-added-dependencies-DVSbzler.mjs.map +1 -0
- package/dist/{migrate-jGKfE02L.mjs → migrate-DK4HK7Dn.mjs} +4 -4
- package/dist/{migrate-jGKfE02L.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
- package/dist/{registry-auth-DxEWCJu2.mjs → registry-auth-Bm5AR-fB.mjs} +4 -4
- package/dist/{registry-auth-DxEWCJu2.mjs.map → registry-auth-Bm5AR-fB.mjs.map} +1 -1
- package/dist/scripts/generate-commands-docs.ts +8 -0
- package/dist/switchboard-KQaBlAda.mjs +131 -0
- package/dist/switchboard-KQaBlAda.mjs.map +1 -0
- package/dist/{switchboard-migrate-NQ7LHWSi.mjs → switchboard-migrate-7JQZM7-5.mjs} +5 -4
- package/dist/{switchboard-migrate-NQ7LHWSi.mjs.map → switchboard-migrate-7JQZM7-5.mjs.map} +1 -1
- package/dist/{switchboard-reset-BcQXlcVf.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
- package/dist/{switchboard-reset-BcQXlcVf.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
- package/dist/switchboard-yDRjakQT.mjs +4 -0
- package/dist/{utils-BzwczAW-.mjs → utils-C3c5YG6v.mjs} +3 -3
- package/dist/{utils-C4isxXSO.mjs → utils-CvmDmCVd.mjs} +3 -3
- package/dist/{utils-C4isxXSO.mjs.map → utils-CvmDmCVd.mjs.map} +1 -1
- package/dist/{vetra-DkF6EJMY.mjs → vetra-CPGUTtaF.mjs} +64 -16
- package/dist/vetra-CPGUTtaF.mjs.map +1 -0
- package/package.json +17 -16
- package/dist/auth-BNkN6kS9.mjs +0 -4
- package/dist/build-C-A5-ipO.mjs +0 -4
- package/dist/build-uQXq6_HU.mjs +0 -71
- package/dist/build-uQXq6_HU.mjs.map +0 -1
- package/dist/cli-connect-override-D3hh4aH_.mjs.map +0 -1
- package/dist/connect-build-WL4axo4z.mjs +0 -43
- package/dist/connect-build-WL4axo4z.mjs.map +0 -1
- package/dist/connect-config-BWGiW3IB.mjs.map +0 -1
- package/dist/connect-studio-BIQzyq5B.mjs +0 -5
- package/dist/generate-processor-_WOx-mMe.mjs.map +0 -1
- package/dist/generate-subgraph-BsHUstpl.mjs.map +0 -1
- package/dist/inspect-DXjbQEV_.mjs.map +0 -1
- package/dist/switchboard-CJMoMzWx.mjs +0 -75
- package/dist/switchboard-CJMoMzWx.mjs.map +0 -1
- package/dist/switchboard-iRFugh8I.mjs +0 -4
- package/dist/vetra-DkF6EJMY.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="52f5688d-6e33-5a44-a55b-802d5da44b75")}catch(e){}}();
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { generateAllDocumentModels, generateDocumentModel, loadDocumentModel } from "@powerhousedao/codegen";
|
|
5
5
|
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
@@ -18,10 +18,20 @@ async function startGenerateDocumentModel(args, projectDir) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (all) await generateAllDocumentModels(project);
|
|
21
|
-
else if (document)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
else if (document) {
|
|
22
|
+
if (document.endsWith(".phd")) {
|
|
23
|
+
const doc = await getDocument(document);
|
|
24
|
+
await generateDocumentModelFromDocument(doc, project);
|
|
25
|
+
} else {
|
|
26
|
+
const state = await loadDocumentModel(document);
|
|
27
|
+
await generateDocumentModel(state, project);
|
|
28
|
+
}
|
|
29
|
+
} else if (dir) {
|
|
30
|
+
const documentModelFileName = `${dirname(dir)}.json`;
|
|
31
|
+
const documentModelFilePath = join(dir, documentModelFileName);
|
|
32
|
+
const state = await loadDocumentModel(documentModelFilePath);
|
|
33
|
+
await generateDocumentModel(state, project);
|
|
34
|
+
} else {
|
|
25
35
|
console.log("Please specify one of `document`, `dir`, `all`, or `extract`.");
|
|
26
36
|
return;
|
|
27
37
|
}
|
|
@@ -30,5 +40,5 @@ async function startGenerateDocumentModel(args, projectDir) {
|
|
|
30
40
|
//#endregion
|
|
31
41
|
export { startGenerateDocumentModel };
|
|
32
42
|
|
|
33
|
-
//# sourceMappingURL=generate-document-model-
|
|
34
|
-
//# debugId=
|
|
43
|
+
//# sourceMappingURL=generate-document-model-DhDQ_06X.mjs.map
|
|
44
|
+
//# debugId=52f5688d-6e33-5a44-a55b-802d5da44b75
|
package/dist/{generate-document-model-BJXyODfm.mjs.map → generate-document-model-DhDQ_06X.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-document-model-
|
|
1
|
+
{"version":3,"file":"generate-document-model-DhDQ_06X.mjs","sources":["../src/services/generate-document-model.ts"],"sourcesContent":["import {\n generateAllDocumentModels,\n generateDocumentModel,\n loadDocumentModel,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n generateDocumentModelFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { dirname, join } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractDocumentModelDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllDocumentModels(project);\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await generateDocumentModelFromDocument(doc, project);\n } else {\n const state = await loadDocumentModel(document);\n await generateDocumentModel(state, project);\n }\n } else if (dir) {\n const documentModelDirName = dirname(dir);\n const documentModelFileName = `${documentModelDirName}.json`;\n const documentModelFilePath = join(dir, documentModelFileName);\n const state = await loadDocumentModel(documentModelFilePath);\n await generateDocumentModel(state, project);\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n}\n"],"names":[],"mappings":";;;;;;;AAgBA,eAAsB,2BACpB,MACA,YACA;CACA,MAAM,EAAE,UAAU,KAAK,KAAK,SAAS,UAAU;CAC/C,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,8BAA8B,OAAO;EAClD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,0BAA0B,OAAO;MAClC,IAAI,UAAU;EACnB,IAAI,SAAS,SAAS,MAAM,GAAG;GAC7B,MAAM,MAAO,MAAM,YAAY,QAAQ;GACvC,MAAM,kCAAkC,KAAK,OAAO;EACtD,OAAO;GACL,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;GAC9C,MAAM,sBAAsB,OAAO,OAAO;EAC5C;CACF,OAAO,IAAI,KAAK;EAEd,MAAM,wBAAwB,GADD,QAAQ,GACe,EAAE;EACtD,MAAM,wBAAwB,KAAK,KAAK,qBAAqB;EAC7D,MAAM,QAAQ,MAAM,kBAAkB,qBAAqB;EAC3D,MAAM,sBAAsB,OAAO,OAAO;CAC5C,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;AACrB","debug_id":"52f5688d-6e33-5a44-a55b-802d5da44b75"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b204b504-9786-5632-91d5-eaabb22de195")}catch(e){}}();
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { generateAllEditors, generateEditor } from "@powerhousedao/codegen";
|
|
5
5
|
import { buildTsMorphProject, getEditorMetadata } from "@powerhousedao/codegen/utils";
|
|
@@ -18,8 +18,10 @@ async function startGenerateEditor(args, projectDir) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (all) await generateAllEditors(project);
|
|
21
|
-
else if (document)
|
|
22
|
-
|
|
21
|
+
else if (document) {
|
|
22
|
+
const doc = await getDocument(document);
|
|
23
|
+
await generateEditorFromDocument(doc, project);
|
|
24
|
+
} else if (name) {
|
|
23
25
|
if (!documentType) throw new Error("Please specify a document type for the new editor to generate.");
|
|
24
26
|
await generateEditor({
|
|
25
27
|
editorName: name,
|
|
@@ -44,5 +46,5 @@ async function startGenerateEditor(args, projectDir) {
|
|
|
44
46
|
//#endregion
|
|
45
47
|
export { startGenerateEditor };
|
|
46
48
|
|
|
47
|
-
//# sourceMappingURL=generate-editor-
|
|
48
|
-
//# debugId=
|
|
49
|
+
//# sourceMappingURL=generate-editor-CW7Do69u.mjs.map
|
|
50
|
+
//# debugId=b204b504-9786-5632-91d5-eaabb22de195
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-editor-
|
|
1
|
+
{"version":3,"file":"generate-editor-CW7Do69u.mjs","sources":["../src/services/generate-editor.ts"],"sourcesContent":["import { generateAllEditors, generateEditor } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractEditorDocuments,\n generateEditorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentEditorDocument } from \"@powerhousedao/vetra/document-models/document-editor\";\nimport { dirname } from \"node:path\";\nimport type { GenerateEditorArgs } from \"../types.js\";\n\nexport async function startGenerateEditor(\n args: GenerateEditorArgs,\n projectDir: string,\n) {\n const { name, documentType, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractEditorDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllEditors(project);\n } else if (document) {\n const doc = (await getDocument(document)) as DocumentEditorDocument;\n await generateEditorFromDocument(doc, project);\n } else if (name) {\n if (!documentType) {\n throw new Error(\n \"Please specify a document type for the new editor to generate.\",\n );\n }\n await generateEditor(\n { editorName: name, documentTypes: [documentType] },\n project,\n );\n } else if (dir) {\n const editorArgs = getEditorMetadata(project, dirname(dir));\n if (!editorArgs) {\n throw new Error(`Failed to get data for editor in dir \"${dir}\"`);\n }\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorArgs;\n await generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n}\n"],"names":[],"mappings":";;;;;;;AAeA,eAAsB,oBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,cAAc,UAAU,KAAK,KAAK,SAAS,UAAU;CACnE,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,uBAAuB,OAAO;EAC3C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,mBAAmB,OAAO;MAC3B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,2BAA2B,KAAK,OAAO;CAC/C,OAAO,IAAI,MAAM;EACf,IAAI,CAAC,cACH,MAAM,IAAI,MACR,gEACF;EAEF,MAAM,eACJ;GAAE,YAAY;GAAM,eAAe,CAAC,YAAY;EAAE,GAClD,OACF;CACF,OAAO,IAAI,KAAK;EACd,MAAM,aAAa,kBAAkB,SAAS,QAAQ,GAAG,CAAC;EAC1D,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,yCAAyC,IAAI,EAAE;EAEjE,MAAM,EACJ,MAAM,YACN,IAAI,UACJ,SAAS,eACT,kBACE;EACJ,MAAM,eACJ;GACE;GACA;GACA;GACA;EACF,GACA,OACF;CACF,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;AACrB","debug_id":"b204b504-9786-5632-91d5-eaabb22de195"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8b015725-4996-50bb-890c-e6cf4750fe5e")}catch(e){}}();
|
|
3
|
+
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
4
|
+
import { basename } from "node:path";
|
|
5
|
+
import { readPackage } from "read-pkg";
|
|
6
|
+
import { detectFeatures, generateAllPieces, generatePiece, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
7
|
+
import { buildTsMorphProject, readPiecesList } from "@powerhousedao/codegen/utils";
|
|
8
|
+
import { derivePieceId } from "@powerhousedao/codegen/name-builders";
|
|
9
|
+
import { kebabCase } from "change-case";
|
|
10
|
+
import enquirer from "enquirer";
|
|
11
|
+
//#region src/services/generate-piece.ts
|
|
12
|
+
async function resolvePieceId(v) {
|
|
13
|
+
if (v.id) return v.id;
|
|
14
|
+
const pkg = await readPackage({
|
|
15
|
+
cwd: v.projectDir,
|
|
16
|
+
normalize: false
|
|
17
|
+
});
|
|
18
|
+
const { id, needsConfirmation } = derivePieceId({
|
|
19
|
+
packageName: pkg.name ?? "",
|
|
20
|
+
slug: kebabCase(v.pieceName),
|
|
21
|
+
hasOtherPieces: readPiecesList(v.project).length > 0
|
|
22
|
+
});
|
|
23
|
+
if (!needsConfirmation || !process.stdin.isTTY) return id;
|
|
24
|
+
const { prompt } = enquirer;
|
|
25
|
+
return (await prompt([{
|
|
26
|
+
type: "input",
|
|
27
|
+
name: "pieceId",
|
|
28
|
+
message: "What id should this piece have? A workflow step names it as its pieceName.",
|
|
29
|
+
initial: id,
|
|
30
|
+
required: true
|
|
31
|
+
}])).pieceId || id;
|
|
32
|
+
}
|
|
33
|
+
async function startGeneratePiece(args, projectDir) {
|
|
34
|
+
const { namePositional, name: nameOption, id, auth, description, dir, all, debug } = args;
|
|
35
|
+
if (debug) console.log({ args });
|
|
36
|
+
const project = buildTsMorphProject(projectDir);
|
|
37
|
+
const name = namePositional ?? nameOption;
|
|
38
|
+
if (all) await generateAllPieces(project);
|
|
39
|
+
else if (dir) await generateAllPieces(project, basename(dir.replace(/\/+$/, "")));
|
|
40
|
+
else if (name) {
|
|
41
|
+
const pieceId = await resolvePieceId({
|
|
42
|
+
project,
|
|
43
|
+
projectDir,
|
|
44
|
+
pieceName: name,
|
|
45
|
+
id
|
|
46
|
+
});
|
|
47
|
+
await generatePiece({
|
|
48
|
+
pieceName: name,
|
|
49
|
+
pieceId,
|
|
50
|
+
auth,
|
|
51
|
+
description
|
|
52
|
+
}, project);
|
|
53
|
+
} else {
|
|
54
|
+
console.log("Please specify one of `name`, `dir`, or `all`.");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
await project.save();
|
|
58
|
+
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
59
|
+
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { startGeneratePiece };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=generate-piece-QTt-ddt2.mjs.map
|
|
65
|
+
//# debugId=8b015725-4996-50bb-890c-e6cf4750fe5e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-piece-QTt-ddt2.mjs","sources":["../src/services/generate-piece.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllPieces,\n generatePiece,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { derivePieceId } from \"@powerhousedao/codegen/name-builders\";\nimport {\n buildTsMorphProject,\n readPiecesList,\n} from \"@powerhousedao/codegen/utils\";\nimport { kebabCase } from \"change-case\";\nimport enquirer from \"enquirer\";\nimport { basename } from \"node:path\";\nimport { readPackage } from \"read-pkg\";\nimport type { Project } from \"ts-morph\";\nimport type { GeneratePieceArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\n// The id a block type will name, asked for only where deriving one would claim\n// a namespace nobody owns; CI, with no TTY, takes the derived value.\nasync function resolvePieceId(v: {\n project: Project;\n projectDir: string;\n pieceName: string;\n id?: string;\n}): Promise<string> {\n if (v.id) return v.id;\n const pkg = await readPackage({ cwd: v.projectDir, normalize: false });\n const { id, needsConfirmation } = derivePieceId({\n packageName: pkg.name ?? \"\",\n slug: kebabCase(v.pieceName),\n hasOtherPieces: readPiecesList(v.project).length > 0,\n });\n if (!needsConfirmation || !process.stdin.isTTY) return id;\n const { prompt } = enquirer;\n const result = await prompt<{ pieceId: string }>([\n {\n type: \"input\",\n name: \"pieceId\",\n message:\n \"What id should this piece have? A workflow step names it as its pieceName.\",\n initial: id,\n required: true,\n },\n ]);\n return result.pieceId || id;\n}\n\nexport async function startGeneratePiece(\n args: GeneratePieceArgs,\n projectDir: string,\n) {\n const {\n namePositional,\n name: nameOption,\n id,\n auth,\n description,\n dir,\n all,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n const name = namePositional ?? nameOption;\n if (all) {\n await generateAllPieces(project);\n } else if (dir) {\n await generateAllPieces(project, basename(dir.replace(/\\/+$/, \"\")));\n } else if (name) {\n const pieceId = await resolvePieceId({\n project,\n projectDir,\n pieceName: name,\n id,\n });\n await generatePiece(\n { pieceName: name, pieceId, auth, description },\n project,\n );\n } else {\n console.log(\"Please specify one of `name`, `dir`, or `all`.\");\n return;\n }\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAqBA,eAAe,eAAe,GAKV;CAClB,IAAI,EAAE,IAAI,OAAO,EAAE;CACnB,MAAM,MAAM,MAAM,YAAY;EAAE,KAAK,EAAE;EAAY,WAAW;CAAM,CAAC;CACrE,MAAM,EAAE,IAAI,sBAAsB,cAAc;EAC9C,aAAa,IAAI,QAAQ;EACzB,MAAM,UAAU,EAAE,SAAS;EAC3B,gBAAgB,eAAe,EAAE,OAAO,CAAC,CAAC,SAAS;CACrD,CAAC;CACD,IAAI,CAAC,qBAAqB,CAAC,QAAQ,MAAM,OAAO,OAAO;CACvD,MAAM,EAAE,WAAW;CAWnB,QAAO,MAVc,OAA4B,CAC/C;EACE,MAAM;EACN,MAAM;EACN,SACE;EACF,SAAS;EACT,UAAU;CACZ,CACF,CAAC,EAAA,CACa,WAAW;AAC3B;AAEA,eAAsB,mBACpB,MACA,YACA;CACA,MAAM,EACJ,gBACA,MAAM,YACN,IACA,MACA,aACA,KACA,KACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,OAAO,kBAAkB;CAC/B,IAAI,KACF,MAAM,kBAAkB,OAAO;MAC1B,IAAI,KACT,MAAM,kBAAkB,SAAS,SAAS,IAAI,QAAQ,QAAQ,EAAE,CAAC,CAAC;MAC7D,IAAI,MAAM;EACf,MAAM,UAAU,MAAM,eAAe;GACnC;GACA;GACA,WAAW;GACX;EACF,CAAC;EACD,MAAM,cACJ;GAAE,WAAW;GAAM;GAAS;GAAM;EAAY,GAC9C,OACF;CACF,OAAO;EACL,QAAQ,IAAI,gDAAgD;EAC5D;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"8b015725-4996-50bb-890c-e6cf4750fe5e"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f49d0352-90e3-5961-b001-c9dfb74af954")}catch(e){}}();
|
|
3
|
+
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
4
|
+
import { detectFeatures, generatePieceAction, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
5
|
+
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
6
|
+
//#region src/services/generate-piece-action.ts
|
|
7
|
+
async function startGeneratePieceAction(args, projectDir) {
|
|
8
|
+
const { namePositional, name: nameOption, piece, requireReactor, debug } = args;
|
|
9
|
+
if (debug) console.log({ args });
|
|
10
|
+
const actionName = namePositional ?? nameOption;
|
|
11
|
+
if (!actionName) {
|
|
12
|
+
console.log("Please specify the name of the action to generate.");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const project = buildTsMorphProject(projectDir);
|
|
16
|
+
await generatePieceAction({
|
|
17
|
+
pieceDir: piece,
|
|
18
|
+
actionName,
|
|
19
|
+
requireReactor
|
|
20
|
+
}, project);
|
|
21
|
+
await project.save();
|
|
22
|
+
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
23
|
+
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { startGeneratePieceAction };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=generate-piece-action-DbxrzfKY.mjs.map
|
|
29
|
+
//# debugId=f49d0352-90e3-5961-b001-c9dfb74af954
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-piece-action-DbxrzfKY.mjs","sources":["../src/services/generate-piece-action.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceAction,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceActionArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceAction(\n args: GeneratePieceActionArgs,\n projectDir: string,\n) {\n const {\n namePositional,\n name: nameOption,\n piece,\n requireReactor,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const actionName = namePositional ?? nameOption;\n if (!actionName) {\n console.log(\"Please specify the name of the action to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceAction(\n { pieceDir: piece, actionName, requireReactor },\n project,\n );\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,yBACpB,MACA,YACA;CACA,MAAM,EACJ,gBACA,MAAM,YACN,OACA,gBACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,aAAa,kBAAkB;CACrC,IAAI,CAAC,YAAY;EACf,QAAQ,IAAI,oDAAoD;EAChE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,oBACJ;EAAE,UAAU;EAAO;EAAY;CAAe,GAC9C,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"f49d0352-90e3-5961-b001-c9dfb74af954"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94b307ac-d424-5f25-b521-b085d75090f1")}catch(e){}}();
|
|
3
|
+
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
4
|
+
import { detectFeatures, generatePieceTrigger, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
5
|
+
import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
|
|
6
|
+
//#region src/services/generate-piece-trigger.ts
|
|
7
|
+
async function startGeneratePieceTrigger(args, projectDir) {
|
|
8
|
+
const { namePositional, name: nameOption, piece, strategy, requireReactor, debug } = args;
|
|
9
|
+
if (debug) console.log({ args });
|
|
10
|
+
const triggerName = namePositional ?? nameOption;
|
|
11
|
+
if (!triggerName) {
|
|
12
|
+
console.log("Please specify the name of the trigger to generate.");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const project = buildTsMorphProject(projectDir);
|
|
16
|
+
await generatePieceTrigger({
|
|
17
|
+
pieceDir: piece,
|
|
18
|
+
triggerName,
|
|
19
|
+
strategy,
|
|
20
|
+
requireReactor
|
|
21
|
+
}, project);
|
|
22
|
+
await project.save();
|
|
23
|
+
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
24
|
+
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { startGeneratePieceTrigger };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=generate-piece-trigger-CqVOcL9g.mjs.map
|
|
30
|
+
//# debugId=94b307ac-d424-5f25-b521-b085d75090f1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-piece-trigger-CqVOcL9g.mjs","sources":["../src/services/generate-piece-trigger.ts"],"sourcesContent":["import {\n detectFeatures,\n generatePieceTrigger,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { GeneratePieceTriggerArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGeneratePieceTrigger(\n args: GeneratePieceTriggerArgs,\n projectDir: string,\n) {\n const {\n namePositional,\n name: nameOption,\n piece,\n strategy,\n requireReactor,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const triggerName = namePositional ?? nameOption;\n if (!triggerName) {\n console.log(\"Please specify the name of the trigger to generate.\");\n return;\n }\n const project = buildTsMorphProject(projectDir);\n await generatePieceTrigger(\n { pieceDir: piece, triggerName, strategy, requireReactor },\n project,\n );\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;AASA,eAAsB,0BACpB,MACA,YACA;CACA,MAAM,EACJ,gBACA,MAAM,YACN,OACA,UACA,gBACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,cAAc,kBAAkB;CACtC,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,qDAAqD;EACjE;CACF;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,MAAM,qBACJ;EAAE,UAAU;EAAO;EAAa;EAAU;CAAe,GACzD,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"94b307ac-d424-5f25-b521-b085d75090f1"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4c9267c1-f9f5-5d39-a420-380970da035c")}catch(e){}}();
|
|
3
|
+
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
3
4
|
import { dirname } from "node:path";
|
|
4
5
|
import { detectFeatures, generateAllProcessors, generateProcessor, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
5
6
|
import { buildTsMorphProject, getProcessorMetadata } from "@powerhousedao/codegen/utils";
|
|
@@ -18,23 +19,29 @@ async function startGenerateProcessor(args, projectDir) {
|
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
if (all) await generateAllProcessors(project);
|
|
21
|
-
else if (document)
|
|
22
|
-
|
|
22
|
+
else if (document) {
|
|
23
|
+
const doc = await getDocument(document);
|
|
24
|
+
await generateProcessorFromDocument(doc, project);
|
|
25
|
+
} else if (processorName) await generateProcessor({
|
|
23
26
|
processorName,
|
|
24
27
|
processorApps,
|
|
25
28
|
processorType,
|
|
26
29
|
documentTypes
|
|
27
30
|
}, project);
|
|
28
|
-
else if (dir)
|
|
29
|
-
|
|
31
|
+
else if (dir) {
|
|
32
|
+
const processorDirName = dirname(dir);
|
|
33
|
+
const processorArgs = getProcessorMetadata(project, processorDirName);
|
|
34
|
+
await generateProcessor(processorArgs, project);
|
|
35
|
+
} else {
|
|
30
36
|
console.log("Please specify one of `name`, `document`, `dir`, `all`, or `extract`.");
|
|
31
37
|
return;
|
|
32
38
|
}
|
|
33
39
|
await project.save();
|
|
34
|
-
await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
40
|
+
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
41
|
+
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
35
42
|
}
|
|
36
43
|
//#endregion
|
|
37
44
|
export { startGenerateProcessor };
|
|
38
45
|
|
|
39
|
-
//# sourceMappingURL=generate-processor-
|
|
40
|
-
//# debugId=
|
|
46
|
+
//# sourceMappingURL=generate-processor-DBtTkgo5.mjs.map
|
|
47
|
+
//# debugId=4c9267c1-f9f5-5d39-a420-380970da035c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-processor-DBtTkgo5.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllProcessors(project);\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = dirname(dir);\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;AAqBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,OAAO;EAC9C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,sBAAsB,OAAO;MAC9B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,8BAA8B,KAAK,OAAO;CAClD,OAAO,IAAI,eACT,MAAM,kBACJ;EACE;EACA;EACA;EACA;CACF,GACA,OACF;MACK,IAAI,KAAK;EACd,MAAM,mBAAmB,QAAQ,GAAG;EACpC,MAAM,gBAAgB,qBAAqB,SAAS,gBAAgB;EACpE,MAAM,kBAAkB,eAAe,OAAO;CAChD,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"4c9267c1-f9f5-5d39-a420-380970da035c"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e6f7e480-790a-5892-8662-eb9ba2632ed4")}catch(e){}}();
|
|
3
|
+
import { t as installAddedDependencies } from "./install-added-dependencies-DVSbzler.mjs";
|
|
3
4
|
import { dirname } from "node:path";
|
|
4
5
|
import { detectFeatures, generateAllSubgraphs, generateSubgraph, syncFeatureDependencies } from "@powerhousedao/codegen";
|
|
5
6
|
import { buildTsMorphProject, getSubgraphMetadata } from "@powerhousedao/codegen/utils";
|
|
@@ -18,8 +19,10 @@ async function startGenerateSubgraph(args, projectDir) {
|
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
if (all) await generateAllSubgraphs(project);
|
|
21
|
-
else if (document)
|
|
22
|
-
|
|
22
|
+
else if (document) {
|
|
23
|
+
const doc = await getDocument(document);
|
|
24
|
+
await generateSubgraphFromDocument(doc, project);
|
|
25
|
+
} else if (name) await generateSubgraph(name, project);
|
|
23
26
|
else if (dir) {
|
|
24
27
|
const { subgraphName } = getSubgraphMetadata(project, dirname(dir));
|
|
25
28
|
if (!subgraphName) throw new Error(`Failed to get data for subgraph in dir "${dir}"`);
|
|
@@ -29,10 +32,11 @@ async function startGenerateSubgraph(args, projectDir) {
|
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
31
34
|
await project.save();
|
|
32
|
-
await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
35
|
+
const added = await syncFeatureDependencies(detectFeatures(projectDir), projectDir);
|
|
36
|
+
await installAddedDependencies(added, projectDir, args.skipInstall);
|
|
33
37
|
}
|
|
34
38
|
//#endregion
|
|
35
39
|
export { startGenerateSubgraph };
|
|
36
40
|
|
|
37
|
-
//# sourceMappingURL=generate-subgraph-
|
|
38
|
-
//# debugId=
|
|
41
|
+
//# sourceMappingURL=generate-subgraph-Dm27O59o.mjs.map
|
|
42
|
+
//# debugId=e6f7e480-790a-5892-8662-eb9ba2632ed4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-subgraph-Dm27O59o.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getSubgraphMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { dirname } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n await generateAllSubgraphs(project);\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n await generateSubgraphFromDocument(doc, project);\n } else if (name) {\n await generateSubgraph(name, project);\n } else if (dir) {\n const { subgraphName } = getSubgraphMetadata(project, dirname(dir));\n if (!subgraphName) {\n throw new Error(`Failed to get data for subgraph in dir \"${dir}\"`);\n }\n await generateSubgraph(subgraphName, project);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":[],"mappings":";;;;;;;;AAqBA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,yBAAyB,OAAO;EAC7C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,IAAI,KACF,MAAM,qBAAqB,OAAO;MAC7B,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,6BAA6B,KAAK,OAAO;CACjD,OAAO,IAAI,MACT,MAAM,iBAAiB,MAAM,OAAO;MAC/B,IAAI,KAAK;EACd,MAAM,EAAE,iBAAiB,oBAAoB,SAAS,QAAQ,GAAG,CAAC;EAClE,IAAI,CAAC,cACH,MAAM,IAAI,MAAM,2CAA2C,IAAI,EAAE;EAEnE,MAAM,iBAAiB,cAAc,OAAO;CAC9C,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAM,yBAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"e6f7e480-790a-5892-8662-eb9ba2632ed4"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e721e7b0-56d6-5f1e-8748-fa042911cc0d")}catch(e){}}();
|
|
3
3
|
import { handleMutuallyExclusiveOptions, parsePackageManager, parseTag } from "@powerhousedao/shared/clis";
|
|
4
4
|
import { createProject } from "@powerhousedao/codegen";
|
|
5
|
-
import chalk from "chalk";
|
|
6
5
|
import { kebabCase } from "change-case";
|
|
7
6
|
import enquirer from "enquirer";
|
|
7
|
+
import chalk from "chalk";
|
|
8
8
|
import { clean, valid } from "semver";
|
|
9
9
|
import { createVetraDocument, getVetraDocuments } from "@powerhousedao/common/utils";
|
|
10
10
|
//#region src/utils/validate-remote-drive.ts
|
|
@@ -127,5 +127,5 @@ async function startInit(args) {
|
|
|
127
127
|
//#endregion
|
|
128
128
|
export { startInit };
|
|
129
129
|
|
|
130
|
-
//# sourceMappingURL=init-
|
|
131
|
-
//# debugId=
|
|
130
|
+
//# sourceMappingURL=init-CIEMyAug.mjs.map
|
|
131
|
+
//# debugId=e721e7b0-56d6-5f1e-8748-fa042911cc0d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-
|
|
1
|
+
{"version":3,"file":"init-CIEMyAug.mjs","sources":["../src/utils/validate-remote-drive.ts","../src/services/init.ts"],"sourcesContent":["import {\n createVetraDocument,\n getVetraDocuments,\n} from \"@powerhousedao/common/utils\";\n\n/**\n * Sets up a remote drive for initialization by validating and creating\n * a Vetra document if needed.\n * Returns true if setup succeeds, false if it should stop execution.\n */\nexport async function setupRemoteDrive(\n remoteDriveUrl: string,\n): Promise<boolean> {\n try {\n // Parse driveId from URL\n const driveId = remoteDriveUrl.split(\"/\").pop();\n\n if (!remoteDriveUrl || remoteDriveUrl.trim() === \"\") {\n console.error(\"❌ Remote drive URL is required\");\n return false;\n }\n\n // Construct GraphQL endpoint from base URL, preserving any subpath\n // prefix (e.g. when the reactor is served behind a proxy at /api/reactor).\n const url = new URL(remoteDriveUrl);\n const basePath = url.pathname.replace(/\\/d\\/[^/]+\\/?$/, \"\");\n const graphqlEndpoint = `${url.protocol}//${url.host}${basePath}/graphql`;\n\n let documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.log(\n \"No vetra package document found in the provided drive, creating one...\",\n );\n try {\n await createVetraDocument(graphqlEndpoint, driveId!, \"vetra-package\");\n\n // Re-fetch documents after creation\n documents = await getVetraDocuments(graphqlEndpoint, driveId!);\n\n if (documents.length === 0) {\n console.error(\n \"❌ Failed to create vetra package document in the remote drive\",\n );\n return false;\n }\n\n console.log(\"✅ Vetra package document created successfully\");\n } catch (createError) {\n console.error(\n \"❌ Failed to create vetra package document:\",\n createError,\n );\n return false;\n }\n }\n\n if (documents.length > 1) {\n console.warn(\n \"⚠️ Multiple vetra package documents were found in the provided remote drive, this might be an error in your remote drive\",\n );\n }\n\n const hasGithubUrl = documents.some((doc) => doc.githubUrl);\n\n if (hasGithubUrl) {\n console.error(\n \"❌ The remote drive provided already has been configured with a github url, please use the checkout command instead: ph checkout --remote-drive <remote drive url>\",\n );\n return false;\n }\n\n return true;\n } catch (error) {\n console.error(\"❌ Unable to fetch remote drive info:\", error);\n return false;\n }\n}\n","import { createProject } from \"@powerhousedao/codegen\";\nimport {\n handleMutuallyExclusiveOptions,\n parsePackageManager,\n parseTag,\n} from \"@powerhousedao/shared/clis\";\nimport chalk from \"chalk\";\nimport { kebabCase } from \"change-case\";\nimport enquirer from \"enquirer\";\nimport { clean, valid } from \"semver\";\nimport type { InitArgs } from \"../types.js\";\nimport { setupRemoteDrive } from \"../utils/validate-remote-drive.js\";\n\nexport async function startInit(args: InitArgs) {\n const {\n namePositional,\n nameOption,\n packageManager,\n npm,\n pnpm,\n yarn,\n bun,\n tag,\n version,\n dev,\n staging,\n rc,\n remoteDrive,\n clone,\n } = args;\n\n let name = namePositional ?? nameOption;\n if (!name) {\n const { prompt } = enquirer;\n\n const result = await prompt<{ name: string }>([\n {\n type: \"input\",\n name: \"name\",\n message: \"What is the project name?\",\n required: true,\n result: (value) => kebabCase(value),\n },\n ]);\n name = result.name;\n }\n if (!name) {\n throw new Error(\"You must provide a name for your project.\");\n }\n\n if (version !== undefined && !valid(clean(version))) {\n throw new Error(`Invalid version: ${version}`);\n }\n\n handleMutuallyExclusiveOptions(\n {\n tag,\n version,\n dev,\n staging,\n rc,\n },\n \"versioning strategy\",\n );\n\n handleMutuallyExclusiveOptions(\n {\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n },\n \"package manager\",\n );\n\n const parsedPackageManager =\n parsePackageManager({\n npm,\n pnpm,\n yarn,\n bun,\n packageManager,\n }) ?? \"npm\";\n\n const parsedTag = parseTag({\n tag,\n dev,\n staging,\n rc,\n });\n\n if (clone && (tag || version || dev || staging || rc)) {\n console.log(\n chalk.yellow(\n \"⚠️ --clone is set; --version/--tag/--dev/--staging/--rc are ignored (the cloned project's dependency set is authoritative).\",\n ),\n );\n }\n\n try {\n if (remoteDrive) {\n console.log(chalk.blue(\"\\n⏳ Setting up remote drive...\\n\"));\n await setupRemoteDrive(remoteDrive);\n console.log(chalk.green(\"\\n✅ Remote drive set up.\"));\n }\n\n console.log(chalk.bold(\"\\n🚀 Initializing a new project...\\n\"));\n await createProject({\n ...args,\n name,\n packageManager: parsedPackageManager,\n tag: parsedTag,\n });\n\n if (remoteDrive) {\n console.log();\n console.log(\"To link your project to GitHub:\");\n console.log();\n console.log(\" 1. Create a new repository on GitHub\");\n console.log(` 2. cd ${name}`);\n console.log(\" 3. git add . && git commit -m 'Initial commit'\");\n console.log(\" 4. git remote add origin <your-github-url>\");\n console.log(` 5. git push -u origin main`);\n console.log();\n }\n } catch (error) {\n console.error(\"\\n❌ Failed to initialize project: \\n\");\n throw error;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAUA,eAAsB,iBACpB,gBACkB;CAClB,IAAI;EAEF,MAAM,UAAU,eAAe,MAAM,GAAG,CAAC,CAAC,IAAI;EAE9C,IAAI,CAAC,kBAAkB,eAAe,KAAK,MAAM,IAAI;GACnD,QAAQ,MAAM,gCAAgC;GAC9C,OAAO;EACT;EAIA,MAAM,MAAM,IAAI,IAAI,cAAc;EAClC,MAAM,WAAW,IAAI,SAAS,QAAQ,kBAAkB,EAAE;EAC1D,MAAM,kBAAkB,GAAG,IAAI,SAAS,IAAI,IAAI,OAAO,SAAS;EAEhE,IAAI,YAAY,MAAM,kBAAkB,iBAAiB,OAAQ;EAEjE,IAAI,UAAU,WAAW,GAAG;GAC1B,QAAQ,IACN,wEACF;GACA,IAAI;IACF,MAAM,oBAAoB,iBAAiB,SAAU,eAAe;IAGpE,YAAY,MAAM,kBAAkB,iBAAiB,OAAQ;IAE7D,IAAI,UAAU,WAAW,GAAG;KAC1B,QAAQ,MACN,+DACF;KACA,OAAO;IACT;IAEA,QAAQ,IAAI,+CAA+C;GAC7D,SAAS,aAAa;IACpB,QAAQ,MACN,8CACA,WACF;IACA,OAAO;GACT;EACF;EAEA,IAAI,UAAU,SAAS,GACrB,QAAQ,KACN,2HACF;EAKF,IAFqB,UAAU,MAAM,QAAQ,IAAI,SAElC,GAAG;GAChB,QAAQ,MACN,mKACF;GACA,OAAO;EACT;EAEA,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,MAAM,wCAAwC,KAAK;EAC3D,OAAO;CACT;AACF;;;AChEA,eAAsB,UAAU,MAAgB;CAC9C,MAAM,EACJ,gBACA,YACA,gBACA,KACA,MACA,MACA,KACA,KACA,SACA,KACA,SACA,IACA,aACA,UACE;CAEJ,IAAI,OAAO,kBAAkB;CAC7B,IAAI,CAAC,MAAM;EACT,MAAM,EAAE,WAAW;EAWnB,QAAO,MATc,OAAyB,CAC5C;GACE,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS,UAAU,UAAU,KAAK;EACpC,CACF,CAAC,EAAA,CACa;CAChB;CACA,IAAI,CAAC,MACH,MAAM,IAAI,MAAM,2CAA2C;CAG7D,IAAI,YAAY,KAAA,KAAa,CAAC,MAAM,MAAM,OAAO,CAAC,GAChD,MAAM,IAAI,MAAM,oBAAoB,SAAS;CAG/C,+BACE;EACE;EACA;EACA;EACA;EACA;CACF,GACA,qBACF;CAEA,+BACE;EACE;EACA;EACA;EACA;EACA;CACF,GACA,iBACF;CAEA,MAAM,uBACJ,oBAAoB;EAClB;EACA;EACA;EACA;EACA;CACF,CAAC,KAAK;CAER,MAAM,YAAY,SAAS;EACzB;EACA;EACA;EACA;CACF,CAAC;CAED,IAAI,UAAU,OAAO,WAAW,OAAO,WAAW,KAChD,QAAQ,IACN,MAAM,OACJ,8HACF,CACF;CAGF,IAAI;EACF,IAAI,aAAa;GACf,QAAQ,IAAI,MAAM,KAAK,kCAAkC,CAAC;GAC1D,MAAM,iBAAiB,WAAW;GAClC,QAAQ,IAAI,MAAM,MAAM,0BAA0B,CAAC;EACrD;EAEA,QAAQ,IAAI,MAAM,KAAK,sCAAsC,CAAC;EAC9D,MAAM,cAAc;GAClB,GAAG;GACH;GACA,gBAAgB;GAChB,KAAK;EACP,CAAC;EAED,IAAI,aAAa;GACf,QAAQ,IAAI;GACZ,QAAQ,IAAI,iCAAiC;GAC7C,QAAQ,IAAI;GACZ,QAAQ,IAAI,wCAAwC;GACpD,QAAQ,IAAI,WAAW,MAAM;GAC7B,QAAQ,IAAI,kDAAkD;GAC9D,QAAQ,IAAI,8CAA8C;GAC1D,QAAQ,IAAI,8BAA8B;GAC1C,QAAQ,IAAI;EACd;CACF,SAAS,OAAO;EACd,QAAQ,MAAM,sCAAsC;EACpD,MAAM;CACR;AACF","debug_id":"e721e7b0-56d6-5f1e-8748-fa042911cc0d"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { s as getProjectInfo } from "./utils-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="72240fd3-971a-5d5f-a8ae-1c658ec39584")}catch(e){}}();
|
|
3
|
+
import { s as getProjectInfo } from "./utils-CvmDmCVd.mjs";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
//#region src/services/inspect.ts
|
|
6
6
|
function startInspect(args) {
|
|
@@ -36,6 +36,13 @@ function startInspect(args) {
|
|
|
36
36
|
console.log(`- ${subgraph.name} (${subgraph.id})`);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
if (manifest.pieces) {
|
|
40
|
+
console.log("\nPieces:");
|
|
41
|
+
manifest.pieces.forEach((piece) => {
|
|
42
|
+
const version = piece.version ? ` v${piece.version}` : "";
|
|
43
|
+
console.log(`- ${piece.name} (${piece.id})${version}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
39
46
|
} catch (e) {
|
|
40
47
|
if (args.debug) console.error(e);
|
|
41
48
|
else console.log("No manifest found in the package");
|
|
@@ -44,5 +51,5 @@ function startInspect(args) {
|
|
|
44
51
|
//#endregion
|
|
45
52
|
export { startInspect };
|
|
46
53
|
|
|
47
|
-
//# sourceMappingURL=inspect-
|
|
48
|
-
//# debugId=
|
|
54
|
+
//# sourceMappingURL=inspect-BpCB0TPo.mjs.map
|
|
55
|
+
//# debugId=72240fd3-971a-5d5f-a8ae-1c658ec39584
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect-BpCB0TPo.mjs","sources":["../src/services/inspect.ts"],"sourcesContent":["import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport fs from \"node:fs\";\nimport type { InspectArgs } from \"../types.js\";\nimport { getProjectInfo } from \"../utils.js\";\nexport function startInspect(args: InspectArgs) {\n if (args.debug) {\n console.log(\">>> command arguments\", args);\n }\n\n const projectInfo = getProjectInfo(args.debug);\n const { packageName } = args;\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", projectInfo);\n }\n\n try {\n const loadManifest = (path: string) =>\n JSON.parse(fs.readFileSync(path, \"utf-8\")) as Manifest;\n const manifest = loadManifest(\n `${process.cwd()}/node_modules/${packageName}/dist/powerhouse.manifest.json`,\n );\n\n console.log(manifest.name);\n if (manifest.documentModels) {\n console.log(\"\\nDocument Models:\");\n manifest.documentModels.forEach((model) => {\n console.log(`- ${model.name} (${model.id})`);\n });\n }\n\n if (manifest.editors) {\n console.log(\"\\nEditors:\");\n manifest.editors.forEach((editor) => {\n console.log(`- ${editor.name} (${editor.id})`);\n });\n }\n\n if (manifest.processors) {\n console.log(\"\\nProcessors:\");\n manifest.processors.forEach((processor) => {\n console.log(`- ${processor.name} (${processor.id})`);\n });\n }\n\n if (manifest.subgraphs) {\n console.log(\"\\nSubgraphs:\");\n manifest.subgraphs.forEach((subgraph) => {\n console.log(`- ${subgraph.name} (${subgraph.id})`);\n });\n }\n\n if (manifest.pieces) {\n console.log(\"\\nPieces:\");\n manifest.pieces.forEach((piece) => {\n const version = piece.version ? ` v${piece.version}` : \"\";\n console.log(`- ${piece.name} (${piece.id})${version}`);\n });\n }\n } catch (e) {\n if (args.debug) {\n console.error(e);\n } else {\n console.log(\"No manifest found in the package\");\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAIA,SAAgB,aAAa,MAAmB;CAC9C,IAAI,KAAK,OACP,QAAQ,IAAI,yBAAyB,IAAI;CAG3C,MAAM,cAAc,eAAe,KAAK,KAAK;CAC7C,MAAM,EAAE,gBAAgB;CAExB,IAAI,KAAK,OACP,QAAQ,IAAI,qBAAqB,WAAW;CAG9C,IAAI;EACF,MAAM,gBAAgB,SACpB,KAAK,MAAM,GAAG,aAAa,MAAM,OAAO,CAAC;EAC3C,MAAM,WAAW,aACf,GAAG,QAAQ,IAAI,EAAE,gBAAgB,YAAY,+BAC/C;EAEA,QAAQ,IAAI,SAAS,IAAI;EACzB,IAAI,SAAS,gBAAgB;GAC3B,QAAQ,IAAI,oBAAoB;GAChC,SAAS,eAAe,SAAS,UAAU;IACzC,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,EAAE;GAC7C,CAAC;EACH;EAEA,IAAI,SAAS,SAAS;GACpB,QAAQ,IAAI,YAAY;GACxB,SAAS,QAAQ,SAAS,WAAW;IACnC,QAAQ,IAAI,KAAK,OAAO,KAAK,IAAI,OAAO,GAAG,EAAE;GAC/C,CAAC;EACH;EAEA,IAAI,SAAS,YAAY;GACvB,QAAQ,IAAI,eAAe;GAC3B,SAAS,WAAW,SAAS,cAAc;IACzC,QAAQ,IAAI,KAAK,UAAU,KAAK,IAAI,UAAU,GAAG,EAAE;GACrD,CAAC;EACH;EAEA,IAAI,SAAS,WAAW;GACtB,QAAQ,IAAI,cAAc;GAC1B,SAAS,UAAU,SAAS,aAAa;IACvC,QAAQ,IAAI,KAAK,SAAS,KAAK,IAAI,SAAS,GAAG,EAAE;GACnD,CAAC;EACH;EAEA,IAAI,SAAS,QAAQ;GACnB,QAAQ,IAAI,WAAW;GACvB,SAAS,OAAO,SAAS,UAAU;IACjC,MAAM,UAAU,MAAM,UAAU,KAAK,MAAM,YAAY;IACvD,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,GAAG,GAAG,SAAS;GACvD,CAAC;EACH;CACF,SAAS,GAAG;EACV,IAAI,KAAK,OACP,QAAQ,MAAM,CAAC;OAEf,QAAQ,IAAI,kCAAkC;CAElD;AACF","debug_id":"72240fd3-971a-5d5f-a8ae-1c658ec39584"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94ff9d9a-8051-5d68-9574-45469dd39a97")}catch(e){}}();
|
|
3
|
+
import { boolean, flag, optional } from "cmd-ts";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { detect, resolveCommand } from "package-manager-detector";
|
|
6
|
+
//#region src/utils/install-added-dependencies.ts
|
|
7
|
+
const skipInstallArgs = { skipInstall: flag({
|
|
8
|
+
type: optional(boolean),
|
|
9
|
+
long: "skip-install",
|
|
10
|
+
description: "Don't install the dependencies the command adds to package.json"
|
|
11
|
+
}) };
|
|
12
|
+
async function installAddedDependencies(added, projectDir, skipInstall) {
|
|
13
|
+
if (added.length === 0) return;
|
|
14
|
+
const agent = (await detect({ cwd: projectDir }))?.agent ?? "npm";
|
|
15
|
+
const resolved = resolveCommand(agent, "install", []);
|
|
16
|
+
if (!resolved) return;
|
|
17
|
+
const printed = [resolved.command, ...resolved.args].join(" ");
|
|
18
|
+
if (skipInstall) {
|
|
19
|
+
console.log(`Run \`${printed}\` to install them.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
console.log(`Installing with \`${printed}\`...`);
|
|
23
|
+
if (spawnSync(resolved.command, resolved.args, {
|
|
24
|
+
cwd: projectDir,
|
|
25
|
+
stdio: "inherit",
|
|
26
|
+
shell: process.platform === "win32"
|
|
27
|
+
}).status !== 0) console.warn(`Install failed. Run \`${printed}\` in ${projectDir} to install them.`);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { skipInstallArgs as n, installAddedDependencies as t };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=install-added-dependencies-DVSbzler.mjs.map
|
|
33
|
+
//# debugId=94ff9d9a-8051-5d68-9574-45469dd39a97
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-added-dependencies-DVSbzler.mjs","sources":["../src/utils/install-added-dependencies.ts"],"sourcesContent":["import { boolean, flag, optional } from \"cmd-ts\";\nimport { spawnSync } from \"node:child_process\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\n\nexport const skipInstallArgs = {\n skipInstall: flag({\n type: optional(boolean),\n long: \"skip-install\",\n description:\n \"Don't install the dependencies the command adds to package.json\",\n }),\n};\n\n// Installs what a generate command just added to package.json. A failed\n// install doesn't fail the command: the files are written, so say what to run.\nexport async function installAddedDependencies(\n added: readonly string[],\n projectDir: string,\n skipInstall?: boolean,\n) {\n if (added.length === 0) return;\n const agent = (await detect({ cwd: projectDir }))?.agent ?? \"npm\";\n const resolved = resolveCommand(agent, \"install\", []);\n if (!resolved) return;\n const printed = [resolved.command, ...resolved.args].join(\" \");\n if (skipInstall) {\n console.log(`Run \\`${printed}\\` to install them.`);\n return;\n }\n console.log(`Installing with \\`${printed}\\`...`);\n const result = spawnSync(resolved.command, resolved.args, {\n cwd: projectDir,\n stdio: \"inherit\",\n shell: process.platform === \"win32\",\n });\n if (result.status !== 0) {\n console.warn(\n `Install failed. Run \\`${printed}\\` in ${projectDir} to install them.`,\n );\n }\n}\n"],"names":[],"mappings":";;;;;;AAIA,MAAa,kBAAkB,EAC7B,aAAa,KAAK;CAChB,MAAM,SAAS,OAAO;CACtB,MAAM;CACN,aACE;AACJ,CAAC,EACH;AAIA,eAAsB,yBACpB,OACA,YACA,aACA;CACA,IAAI,MAAM,WAAW,GAAG;CACxB,MAAM,SAAS,MAAM,OAAO,EAAE,KAAK,WAAW,CAAC,EAAA,EAAI,SAAS;CAC5D,MAAM,WAAW,eAAe,OAAO,WAAW,CAAC,CAAC;CACpD,IAAI,CAAC,UAAU;CACf,MAAM,UAAU,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG;CAC7D,IAAI,aAAa;EACf,QAAQ,IAAI,SAAS,QAAQ,oBAAoB;EACjD;CACF;CACA,QAAQ,IAAI,qBAAqB,QAAQ,MAAM;CAM/C,IALe,UAAU,SAAS,SAAS,SAAS,MAAM;EACxD,KAAK;EACL,OAAO;EACP,OAAO,QAAQ,aAAa;CAC9B,CACS,CAAC,CAAC,WAAW,GACpB,QAAQ,KACN,yBAAyB,QAAQ,QAAQ,WAAW,kBACtD;AAEJ","debug_id":"94ff9d9a-8051-5d68-9574-45469dd39a97"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { execSync } from "node:child_process";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4afdc43b-be1c-56cd-ad65-d3a49f8979d3")}catch(e){}}();
|
|
4
3
|
import { readFileSync } from "node:fs";
|
|
5
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { execSync } from "node:child_process";
|
|
6
6
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
7
7
|
import { fetchPackageVersionFromNpmRegistry, injectPnpmAllowBuilds } from "@powerhousedao/shared/clis";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
@@ -79,5 +79,5 @@ async function startMigrate({ versionPositional, version, force, debug }) {
|
|
|
79
79
|
//#endregion
|
|
80
80
|
export { startMigrate };
|
|
81
81
|
|
|
82
|
-
//# sourceMappingURL=migrate-
|
|
83
|
-
//# debugId=
|
|
82
|
+
//# sourceMappingURL=migrate-DK4HK7Dn.mjs.map
|
|
83
|
+
//# debugId=4afdc43b-be1c-56cd-ad65-d3a49f8979d3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-
|
|
1
|
+
{"version":3,"file":"migrate-DK4HK7Dn.mjs","sources":["../src/services/migrate.ts"],"sourcesContent":["import {\n fetchPackageVersionFromNpmRegistry,\n injectPnpmAllowBuilds,\n} from \"@powerhousedao/shared/clis\";\nimport { execSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { detect, resolveCommand } from \"package-manager-detector\";\nimport type { MigrateArgs } from \"../types.js\";\n\nfunction getBundledPhCliVersion(): string | undefined {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 5; i++) {\n try {\n const pkg = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as { name?: string; version?: string };\n if (pkg.name === \"@powerhousedao/ph-cli\") return pkg.version;\n } catch {\n // keep walking\n }\n dir = dirname(dir);\n }\n}\n\nexport function resolveCodegenVersion(\n codegenMod: Record<string, unknown>,\n): string | undefined {\n const getter = codegenMod.getCodegenVersion;\n if (typeof getter === \"function\") {\n const v = (getter as () => unknown)();\n if (typeof v === \"string\") return v;\n }\n return undefined;\n}\n\nexport function assertCodegenMatchesBundled(args: {\n codegenVersion: string | undefined;\n bundledVersion: string | undefined;\n force: boolean;\n}): void {\n const { codegenVersion, bundledVersion, force } = args;\n if (force) return;\n if (!codegenVersion) {\n throw new Error(\n `@powerhousedao/codegen is older than this ph-cli expects (no version export). ` +\n `Reinstall ph-cli to bring a matching codegen, or re-run with --force.`,\n );\n }\n if (bundledVersion && codegenVersion !== bundledVersion) {\n throw new Error(\n `@powerhousedao/codegen@${codegenVersion} does not match ph-cli@${bundledVersion}. ` +\n `Reinstall to align versions, or re-run with --force.`,\n );\n }\n}\n\nexport async function startMigrate({\n versionPositional,\n version,\n force,\n debug,\n}: MigrateArgs) {\n const requested = versionPositional ?? version;\n if (debug) console.log(`[migrate] requested version: ${requested}`);\n\n let targetVersion: string | undefined;\n try {\n targetVersion = await fetchPackageVersionFromNpmRegistry(\n `@powerhousedao/ph-cli@${requested}`,\n );\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n if (!force) {\n throw new Error(\n `Failed to resolve \"${requested}\" from the npm registry: ${reason}\\nRe-run with --force to migrate using the installed version.`,\n { cause: error },\n );\n }\n if (debug) {\n console.log(\n `[migrate] failed to resolve target version, --force is set, falling back to bundled codegen: ${reason}`,\n );\n }\n }\n\n const bundledVersion = getBundledPhCliVersion();\n if (debug) {\n console.log(\n `[migrate] resolved target version: ${targetVersion ?? \"(unknown)\"}`,\n );\n console.log(\n `[migrate] current ph-cli version: ${bundledVersion ?? \"(unknown)\"}`,\n );\n }\n\n if (!targetVersion || force || targetVersion === bundledVersion) {\n if (debug) console.log(`[migrate] running migrate from bundled codegen`);\n const codegenMod = await import(\"@powerhousedao/codegen\");\n const codegenVersion = resolveCodegenVersion(\n codegenMod as unknown as Record<string, unknown>,\n );\n assertCodegenMatchesBundled({\n codegenVersion,\n bundledVersion,\n force: Boolean(force),\n });\n console.log(\n `Running migrate with @powerhousedao/codegen@${codegenVersion ?? \"unknown\"}`,\n );\n await codegenMod.migrate(targetVersion ?? requested);\n return;\n }\n\n const agent = (await detect())?.agent ?? \"npm\";\n const resolved = resolveCommand(agent, \"execute\", [\n `@powerhousedao/ph-cli@${targetVersion}`,\n \"migrate\",\n \"--version\",\n targetVersion,\n ...(debug ? [\"--debug\"] : []),\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve execute command for package manager \"${agent}\".`,\n );\n }\n\n injectPnpmAllowBuilds(agent, resolved);\n\n const command = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (debug) {\n console.log(`[migrate] detected package manager: ${agent}`);\n console.log(`[migrate] re-executing: ${command}`);\n }\n execSync(command, { stdio: \"inherit\" });\n}\n"],"names":[],"mappings":";;;;;;;;;AAWA,SAAS,yBAA6C;CACpD,IAAI,MAAM,QAAQ,cAAc,YAAY,GAAG,CAAC;CAChD,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,IAAI;GACF,MAAM,MAAM,KAAK,MACf,aAAa,KAAK,KAAK,cAAc,GAAG,MAAM,CAChD;GACA,IAAI,IAAI,SAAS,yBAAyB,OAAO,IAAI;EACvD,QAAQ,CAER;EACA,MAAM,QAAQ,GAAG;CACnB;AACF;AAEA,SAAgB,sBACd,YACoB;CACpB,MAAM,SAAS,WAAW;CAC1B,IAAI,OAAO,WAAW,YAAY;EAChC,MAAM,IAAK,OAAyB;EACpC,IAAI,OAAO,MAAM,UAAU,OAAO;CACpC;AAEF;AAEA,SAAgB,4BAA4B,MAInC;CACP,MAAM,EAAE,gBAAgB,gBAAgB,UAAU;CAClD,IAAI,OAAO;CACX,IAAI,CAAC,gBACH,MAAM,IAAI,MACR,qJAEF;CAEF,IAAI,kBAAkB,mBAAmB,gBACvC,MAAM,IAAI,MACR,0BAA0B,eAAe,yBAAyB,eAAe,uDAEnF;AAEJ;AAEA,eAAsB,aAAa,EACjC,mBACA,SACA,OACA,SACc;CACd,MAAM,YAAY,qBAAqB;CACvC,IAAI,OAAO,QAAQ,IAAI,gCAAgC,WAAW;CAElE,IAAI;CACJ,IAAI;EACF,gBAAgB,MAAM,mCACpB,yBAAyB,WAC3B;CACF,SAAS,OAAO;EACd,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACpE,IAAI,CAAC,OACH,MAAM,IAAI,MACR,sBAAsB,UAAU,2BAA2B,OAAO,gEAClE,EAAE,OAAO,MAAM,CACjB;EAEF,IAAI,OACF,QAAQ,IACN,gGAAgG,QAClG;CAEJ;CAEA,MAAM,iBAAiB,uBAAuB;CAC9C,IAAI,OAAO;EACT,QAAQ,IACN,sCAAsC,iBAAiB,aACzD;EACA,QAAQ,IACN,qCAAqC,kBAAkB,aACzD;CACF;CAEA,IAAI,CAAC,iBAAiB,SAAS,kBAAkB,gBAAgB;EAC/D,IAAI,OAAO,QAAQ,IAAI,gDAAgD;EACvE,MAAM,aAAa,MAAM,OAAO;EAChC,MAAM,iBAAiB,sBACrB,UACF;EACA,4BAA4B;GAC1B;GACA;GACA,OAAO,QAAQ,KAAK;EACtB,CAAC;EACD,QAAQ,IACN,+CAA+C,kBAAkB,WACnE;EACA,MAAM,WAAW,QAAQ,iBAAiB,SAAS;EACnD;CACF;CAEA,MAAM,SAAS,MAAM,OAAO,EAAA,EAAI,SAAS;CACzC,MAAM,WAAW,eAAe,OAAO,WAAW;EAChD,yBAAyB;EACzB;EACA;EACA;EACA,GAAI,QAAQ,CAAC,SAAS,IAAI,CAAC;CAC7B,CAAC;CACD,IAAI,CAAC,UACH,MAAM,IAAI,MACR,0DAA0D,MAAM,GAClE;CAGF,sBAAsB,OAAO,QAAQ;CAErC,MAAM,UAAU,GAAG,SAAS,QAAQ,GAAG,SAAS,KAAK,KAAK,GAAG;CAC7D,IAAI,OAAO;EACT,QAAQ,IAAI,uCAAuC,OAAO;EAC1D,QAAQ,IAAI,2BAA2B,SAAS;CAClD;CACA,SAAS,SAAS,EAAE,OAAO,UAAU,CAAC;AACxC","debug_id":"4afdc43b-be1c-56cd-ad65-d3a49f8979d3"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { t as getRenown } from "./auth-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d0d0a6bc-dc22-5a36-9c82-560310b04535")}catch(e){}}();
|
|
3
|
+
import { t as getRenown } from "./auth-BFUq7CvE.mjs";
|
|
4
4
|
import { generateAccessToken } from "@renown/sdk/node";
|
|
5
5
|
//#region src/services/registry-auth.ts
|
|
6
6
|
/**
|
|
@@ -21,5 +21,5 @@ async function mintRegistryAuthToken(registryUrl, expiresInSeconds) {
|
|
|
21
21
|
//#endregion
|
|
22
22
|
export { mintRegistryAuthToken };
|
|
23
23
|
|
|
24
|
-
//# sourceMappingURL=registry-auth-
|
|
25
|
-
//# debugId=
|
|
24
|
+
//# sourceMappingURL=registry-auth-Bm5AR-fB.mjs.map
|
|
25
|
+
//# debugId=d0d0a6bc-dc22-5a36-9c82-560310b04535
|