@powerhousedao/ph-cli 6.2.3-dev.34 → 6.2.3-dev.35
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/{build-sO3PcZxl.mjs → build-Di0SwHGs.mjs} +5 -5
- package/dist/{build-sO3PcZxl.mjs.map → build-Di0SwHGs.mjs.map} +1 -1
- package/dist/build-Dk9HoX9_.mjs +4 -0
- package/dist/cli.mjs +43 -14
- package/dist/cli.mjs.map +1 -1
- package/dist/{connect-build-BMaR9w4G.mjs → connect-build-2dTdDm81.mjs} +5 -5
- package/dist/{connect-build-BMaR9w4G.mjs.map → connect-build-2dTdDm81.mjs.map} +1 -1
- package/dist/{connect-config-_kiSMsbG.mjs → connect-config-DGfPEeP8.mjs} +4 -4
- package/dist/{connect-config-_kiSMsbG.mjs.map → connect-config-DGfPEeP8.mjs.map} +1 -1
- package/dist/{migrate-B6QBYDNX.mjs → migrate-DK4HK7Dn.mjs} +5 -5
- package/dist/{migrate-B6QBYDNX.mjs.map → migrate-DK4HK7Dn.mjs.map} +1 -1
- package/dist/{switchboard-reset-Ctegiqdm.mjs → switchboard-reset-CX_Lzw3O.mjs} +4 -4
- package/dist/{switchboard-reset-Ctegiqdm.mjs.map → switchboard-reset-CX_Lzw3O.mjs.map} +1 -1
- package/dist/{vetra-s8gWslse.mjs → vetra-CQSUBUvg.mjs} +5 -5
- package/dist/{vetra-s8gWslse.mjs.map → vetra-CQSUBUvg.mjs.map} +1 -1
- package/package.json +11 -11
- package/dist/build-CTvPQFMi.mjs +0 -4
|
@@ -1,12 +1,12 @@
|
|
|
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]="624706a1-e5cd-5084-9837-3d41b2eb84cb")}catch(e){}}();
|
|
3
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
3
5
|
import { execSync } from "node:child_process";
|
|
4
6
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
5
7
|
import { browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, findBundledSharedDeps } from "@powerhousedao/shared/build-config";
|
|
6
8
|
import { assertPiecesOutDir, buildPieces, expandEntryGlobs, pieceListPath, planPieces, syncDistManifest } from "@powerhousedao/shared/build-pieces";
|
|
7
9
|
import { EXTERNALIZABLE_SHARED_SPECIFIERS, findSharedImports } from "@powerhousedao/shared/connect";
|
|
8
|
-
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
10
10
|
import { readPackage } from "read-pkg";
|
|
11
11
|
import { build } from "tsdown";
|
|
12
12
|
//#region src/services/build.ts
|
|
@@ -162,5 +162,5 @@ function readDistBrowserFiles(dir) {
|
|
|
162
162
|
//#endregion
|
|
163
163
|
export { runBuild as n, assertManifestNameMatchesPackage as t };
|
|
164
164
|
|
|
165
|
-
//# sourceMappingURL=build-
|
|
166
|
-
//# debugId=
|
|
165
|
+
//# sourceMappingURL=build-Di0SwHGs.mjs.map
|
|
166
|
+
//# debugId=624706a1-e5cd-5084-9837-3d41b2eb84cb
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-sO3PcZxl.mjs","sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserEntry,\n buildBrowserBuildConfig,\n buildNodeBuildConfig,\n findBundledSharedDeps,\n} from \"@powerhousedao/shared/build-config\";\nimport type { BuiltPiece } from \"@powerhousedao/shared/build-pieces\";\nimport {\n assertPiecesOutDir,\n buildPieces,\n expandEntryGlobs,\n pieceListPath,\n planPieces,\n syncDistManifest,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n findSharedImports,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n} from \"@powerhousedao/shared/connect\";\nimport { execSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { detect, resolveCommand, type Agent } from \"package-manager-detector\";\nimport { readPackage } from \"read-pkg\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\n/**\n * A Powerhouse package's `powerhouse.manifest.json` \"name\" must match its\n * `package.json` \"name\" — Connect and the registry resolve installed versions\n * by treating the manifest name as the npm package name, so a mismatch silently\n * breaks resolution. Fail the build early if they diverge. No-op when the\n * project has no manifest (nothing to compare).\n */\nexport async function assertManifestNameMatchesPackage(projectPath: string) {\n const manifestPath = join(projectPath, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n\n const { name: packageName } = await readPackage({ cwd: projectPath });\n\n let manifestName: unknown;\n try {\n manifestName = (\n JSON.parse(readFileSync(manifestPath, \"utf-8\")) as { name?: unknown }\n ).name;\n } catch {\n throw new Error(\n `Failed to parse \"powerhouse.manifest.json\" at ${manifestPath}. Make sure it is valid JSON.`,\n );\n }\n\n if (manifestName !== packageName) {\n throw new Error(\n `Package name mismatch — \"package.json\" and \"powerhouse.manifest.json\" must have the same \"name\":\\n` +\n ` package.json \"name\": ${JSON.stringify(packageName)}\\n` +\n ` powerhouse.manifest.json \"name\": ${JSON.stringify(manifestName)}\\n\\n` +\n `Update one so they match, then run the build again.`,\n );\n }\n}\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n const projectRoot = process.cwd();\n\n // Fail fast if the manifest name and package.json name have drifted apart.\n await assertManifestNameMatchesPackage(projectRoot);\n\n const target = {\n projectRoot,\n outDir,\n pieces: planPieces(projectRoot, outDir),\n };\n // Before any bundler runs: an out-dir a host will never read from is worth\n // nothing built, and the failure names what the contract is.\n assertPiecesOutDir(target);\n const sharedDeps = !args.noSharedDeps;\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Before any bundler runs, so declining leaves nothing half built.\n const typesOk = emitTypes(agent, outDir);\n if (!typesOk && !args.ignoreTypeErrors) {\n await confirmBuildDespiteTypeErrors();\n }\n\n await tsdownBuild({\n ...buildBrowserBuildConfig({ sharedDeps }),\n outDir: join(outDir, \"browser\"),\n });\n\n // Advisory: a shared dep the source imports but the output no longer\n // references as a bare import was inlined despite the external set.\n if (sharedDeps) {\n const imported = findSharedImportsInSources(projectRoot, browserEntry);\n const bundled = findBundledSharedDeps(\n imported,\n readDistBrowserFiles(join(outDir, \"browser\")),\n );\n if (bundled.length > 0) {\n console.warn(\n `⚠ shared deps bundled instead of externalized: ${bundled.join(\", \")} — check your neverBundle config`,\n );\n }\n }\n\n await tsdownBuild({\n ...buildNodeBuildConfig({ sharedDeps }),\n outDir: join(outDir, \"node\"),\n });\n\n // After the node build: it cleans <outDir>/node, where the pieces land. The\n // built list is the gate, so a `bundle:` entry is validated with no piece dir.\n let built: BuiltPiece[] = [];\n if (existsSync(pieceListPath(target))) {\n const pkg = await readPackage({ cwd: projectRoot });\n built = await buildPieces(\n target,\n {\n name: pkg.name,\n version: pkg.version,\n license: typeof pkg.license === \"string\" ? pkg.license : undefined,\n },\n { bundle: tsdownBuild },\n );\n }\n syncDistManifest(target, built);\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n\n // Last, so it is the line a finished build leaves on screen.\n if (!typesOk) console.warn(`\\n${UNSAFE_BUILD_WARNING}`);\n}\n\n// Runs tsc, which checks the project and writes its declarations either way.\n// Returns whether it reported no type errors.\nfunction emitTypes(agent: Agent, outDir: string): boolean {\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\", \"--build\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Type-checking and emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nconst TYPE_ERROR_RISK =\n \"A package built with type errors can load and still fail at runtime.\";\n\nconst UNSAFE_BUILD_WARNING =\n \"⚠ Built despite type errors. \" +\n TYPE_ERROR_RISK +\n \" Fix them before you publish or deploy it.\";\n\nasync function confirmBuildDespiteTypeErrors(): Promise<void> {\n const hint =\n \"Fix them and build again. --ignore-type-errors skips this check, at the risk of shipping that failure.\";\n if (!isInteractive()) {\n console.error(\n `\\n✘ tsc reported the type errors above. ${TYPE_ERROR_RISK}\\n${hint}`,\n );\n process.exit(1);\n }\n const enquirer = await import(\"enquirer\");\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `tsc reported the type errors above. ${TYPE_ERROR_RISK} Build anyway?`,\n initial: false,\n });\n confirmed = answer.confirmed;\n } catch {\n // Ctrl-C at the prompt is a decline.\n confirmed = false;\n }\n if (!confirmed) {\n console.error(`Build cancelled. ${hint}`);\n process.exit(1);\n }\n}\n\n/**\n * Every shared specifier imported from the entry sources; the post-build\n * scan compares these against the built output.\n *\n * Scoped to the specifiers the build actually externalizes: a specifier the\n * vendor does not publish (the bare `@powerhousedao/shared` root, an\n * unvendored subpath) is deliberately bundled, so reporting it as \"bundled\n * instead of externalized\" would be a false alarm.\n */\nfunction findSharedImportsInSources(root: string, globs: string[]): string[] {\n const found = new Set<string>();\n for (const file of expandEntryGlobs(root, globs)) {\n const src = readFileSync(file, \"utf8\");\n for (const spec of findSharedImports(\n src,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n )) {\n found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * The built JS outputs of a browser build (entry files and chunks).\n */\nfunction readDistBrowserFiles(\n dir: string,\n): { path: string; content: string }[] {\n const out: { path: string; content: string }[] = [];\n if (!existsSync(dir)) return out;\n const walk = (d: string) => {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n const p = join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (e.isFile() && e.name.endsWith(\".js\")) {\n out.push({ path: p, content: readFileSync(p, \"utf8\") });\n }\n }\n };\n walk(dir);\n return out;\n}\n"],"names":["tsdownBuild"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,iCAAiC,aAAqB;CAC1E,MAAM,eAAe,KAAK,aAAa,0BAA0B;CACjE,IAAI,CAAC,WAAW,YAAY,GAAG;CAE/B,MAAM,EAAE,MAAM,gBAAgB,MAAM,YAAY,EAAE,KAAK,YAAY,CAAC;CAEpE,IAAI;CACJ,IAAI;EACF,eACE,KAAK,MAAM,aAAa,cAAc,OAAO,CAAC,CAAC,CAC/C;CACJ,QAAQ;EACN,MAAM,IAAI,MACR,iDAAiD,aAAa,8BAChE;CACF;CAEA,IAAI,iBAAiB,aACnB,MAAM,IAAI,MACR,wIACwC,KAAK,UAAU,WAAW,EAAE,uCAC5B,KAAK,UAAU,YAAY,EAAE,wDAEvE;AAEJ;AAEA,eAAsB,SAAS,MAAiB;CAC9C,MAAM,EAAE,WAAW;CACnB,MAAM,cAAc,QAAQ,IAAI;CAGhC,MAAM,iCAAiC,WAAW;CAElD,MAAM,SAAS;EACb;EACA;EACA,QAAQ,WAAW,aAAa,MAAM;CACxC;CAGA,mBAAmB,MAAM;CACzB,MAAM,aAAa,CAAC,KAAK;CAGzB,MAA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A2C,CAAC;CAClD,IAAI,CAAC,WAAW,GAAG,GAAG,OAAO;CAC7B,MAAM,QAAQ,MAAc;EAC1B,KAAK,MAAM,KAAK,YAAY,GAAG,EAAE,eAAe,KAAK,CAAC,GAAG;GACvD,MAAM,IAAI,KAAK,GAAG,EAAE,IAAI;GACxB,IAAI,EAAE,YAAY,GAAG,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,KAAK,EAAE,KAAK,SAAS,KAAK,GAC1C,IAAI,KAAK;IAAE,MAAM;IAAG,SAAS,aAAa,GAAG,MAAM;GAAE,CAAC;EAE1D;CACF;CACA,KAAK,GAAG;CACR,OAAO;AACT","debug_id":"50b5ce1d-8048-5eb0-bcaf-e4e24228a0c0"}
|
|
1
|
+
{"version":3,"file":"build-Di0SwHGs.mjs","sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserEntry,\n buildBrowserBuildConfig,\n buildNodeBuildConfig,\n findBundledSharedDeps,\n} from \"@powerhousedao/shared/build-config\";\nimport type { BuiltPiece } from \"@powerhousedao/shared/build-pieces\";\nimport {\n assertPiecesOutDir,\n buildPieces,\n expandEntryGlobs,\n pieceListPath,\n planPieces,\n syncDistManifest,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n findSharedImports,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n} from \"@powerhousedao/shared/connect\";\nimport { execSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { detect, resolveCommand, type Agent } from \"package-manager-detector\";\nimport { readPackage } from \"read-pkg\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\n/**\n * A Powerhouse package's `powerhouse.manifest.json` \"name\" must match its\n * `package.json` \"name\" — Connect and the registry resolve installed versions\n * by treating the manifest name as the npm package name, so a mismatch silently\n * breaks resolution. Fail the build early if they diverge. No-op when the\n * project has no manifest (nothing to compare).\n */\nexport async function assertManifestNameMatchesPackage(projectPath: string) {\n const manifestPath = join(projectPath, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n\n const { name: packageName } = await readPackage({ cwd: projectPath });\n\n let manifestName: unknown;\n try {\n manifestName = (\n JSON.parse(readFileSync(manifestPath, \"utf-8\")) as { name?: unknown }\n ).name;\n } catch {\n throw new Error(\n `Failed to parse \"powerhouse.manifest.json\" at ${manifestPath}. Make sure it is valid JSON.`,\n );\n }\n\n if (manifestName !== packageName) {\n throw new Error(\n `Package name mismatch — \"package.json\" and \"powerhouse.manifest.json\" must have the same \"name\":\\n` +\n ` package.json \"name\": ${JSON.stringify(packageName)}\\n` +\n ` powerhouse.manifest.json \"name\": ${JSON.stringify(manifestName)}\\n\\n` +\n `Update one so they match, then run the build again.`,\n );\n }\n}\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n const projectRoot = process.cwd();\n\n // Fail fast if the manifest name and package.json name have drifted apart.\n await assertManifestNameMatchesPackage(projectRoot);\n\n const target = {\n projectRoot,\n outDir,\n pieces: planPieces(projectRoot, outDir),\n };\n // Before any bundler runs: an out-dir a host will never read from is worth\n // nothing built, and the failure names what the contract is.\n assertPiecesOutDir(target);\n const sharedDeps = !args.noSharedDeps;\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Before any bundler runs, so declining leaves nothing half built.\n const typesOk = emitTypes(agent, outDir);\n if (!typesOk && !args.ignoreTypeErrors) {\n await confirmBuildDespiteTypeErrors();\n }\n\n await tsdownBuild({\n ...buildBrowserBuildConfig({ sharedDeps }),\n outDir: join(outDir, \"browser\"),\n });\n\n // Advisory: a shared dep the source imports but the output no longer\n // references as a bare import was inlined despite the external set.\n if (sharedDeps) {\n const imported = findSharedImportsInSources(projectRoot, browserEntry);\n const bundled = findBundledSharedDeps(\n imported,\n readDistBrowserFiles(join(outDir, \"browser\")),\n );\n if (bundled.length > 0) {\n console.warn(\n `⚠ shared deps bundled instead of externalized: ${bundled.join(\", \")} — check your neverBundle config`,\n );\n }\n }\n\n await tsdownBuild({\n ...buildNodeBuildConfig({ sharedDeps }),\n outDir: join(outDir, \"node\"),\n });\n\n // After the node build: it cleans <outDir>/node, where the pieces land. The\n // built list is the gate, so a `bundle:` entry is validated with no piece dir.\n let built: BuiltPiece[] = [];\n if (existsSync(pieceListPath(target))) {\n const pkg = await readPackage({ cwd: projectRoot });\n built = await buildPieces(\n target,\n {\n name: pkg.name,\n version: pkg.version,\n license: typeof pkg.license === \"string\" ? pkg.license : undefined,\n },\n { bundle: tsdownBuild },\n );\n }\n syncDistManifest(target, built);\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n\n // Last, so it is the line a finished build leaves on screen.\n if (!typesOk) console.warn(`\\n${UNSAFE_BUILD_WARNING}`);\n}\n\n// Runs tsc, which checks the project and writes its declarations either way.\n// Returns whether it reported no type errors.\nfunction emitTypes(agent: Agent, outDir: string): boolean {\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\", \"--build\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Type-checking and emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nconst TYPE_ERROR_RISK =\n \"A package built with type errors can load and still fail at runtime.\";\n\nconst UNSAFE_BUILD_WARNING =\n \"⚠ Built despite type errors. \" +\n TYPE_ERROR_RISK +\n \" Fix them before you publish or deploy it.\";\n\nasync function confirmBuildDespiteTypeErrors(): Promise<void> {\n const hint =\n \"Fix them and build again. --ignore-type-errors skips this check, at the risk of shipping that failure.\";\n if (!isInteractive()) {\n console.error(\n `\\n✘ tsc reported the type errors above. ${TYPE_ERROR_RISK}\\n${hint}`,\n );\n process.exit(1);\n }\n const enquirer = await import(\"enquirer\");\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `tsc reported the type errors above. ${TYPE_ERROR_RISK} Build anyway?`,\n initial: false,\n });\n confirmed = answer.confirmed;\n } catch {\n // Ctrl-C at the prompt is a decline.\n confirmed = false;\n }\n if (!confirmed) {\n console.error(`Build cancelled. ${hint}`);\n process.exit(1);\n }\n}\n\n/**\n * Every shared specifier imported from the entry sources; the post-build\n * scan compares these against the built output.\n *\n * Scoped to the specifiers the build actually externalizes: a specifier the\n * vendor does not publish (the bare `@powerhousedao/shared` root, an\n * unvendored subpath) is deliberately bundled, so reporting it as \"bundled\n * instead of externalized\" would be a false alarm.\n */\nfunction findSharedImportsInSources(root: string, globs: string[]): string[] {\n const found = new Set<string>();\n for (const file of expandEntryGlobs(root, globs)) {\n const src = readFileSync(file, \"utf8\");\n for (const spec of findSharedImports(\n src,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n )) {\n found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * The built JS outputs of a browser build (entry files and chunks).\n */\nfunction readDistBrowserFiles(\n dir: string,\n): { path: string; content: string }[] {\n const out: { path: string; content: string }[] = [];\n if (!existsSync(dir)) return out;\n const walk = (d: string) => {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n const p = join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (e.isFile() && e.name.endsWith(\".js\")) {\n out.push({ path: p, content: readFileSync(p, \"utf8\") });\n }\n }\n };\n walk(dir);\n return out;\n}\n"],"names":["tsdownBuild"],"mappings":";;;;;;;;;;;;;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
|
+
!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]="6e95c7bd-f58b-524c-b87a-112c42a5b719")}catch(e){}}();
|
|
4
|
+
//# debugId=6e95c7bd-f58b-524c-b87a-112c42a5b719
|
package/dist/cli.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!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
|
+
!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]="adfc754d-b98f-5eb1-9873-7e473fff27c0")}catch(e){}}();
|
|
4
4
|
import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
|
|
5
5
|
import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
|
|
6
6
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
7
|
-
import { boolean, command, flag, multioption, oneOf, option, optional, positional, run, string, subcommands } from "cmd-ts";
|
|
7
|
+
import { boolean, command, extendType, flag, multioption, oneOf, option, optional, positional, run, string, subcommands } from "cmd-ts";
|
|
8
8
|
import { AGENTS, accessTokenArgs, buildArgs, connectBuildArgs, connectConfigArgs, connectPreviewArgs, connectStudioArgs, debugArgs, initArgs, inspectArgs, installArgs, listArgs, loginArgs, migrateArgs, phCliHelpCommands, publishArgs, registryLoginArgs, switchboardArgs, uninstallArgs, unpublishArgs, vetraArgs } from "@powerhousedao/shared/clis/args";
|
|
9
9
|
import { DEFAULT_EXPIRY_SECONDS } from "@powerhousedao/shared/clis/constants";
|
|
10
|
-
import
|
|
11
|
-
import path from "path";
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import path$1 from "path";
|
|
12
13
|
import { execSync } from "node:child_process";
|
|
13
14
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
14
15
|
import { execSync as execSync$1 } from "child_process";
|
|
@@ -16,7 +17,7 @@ import { createInterface } from "node:readline/promises";
|
|
|
16
17
|
import { bold, yellow } from "colorette";
|
|
17
18
|
//#region src/get-version.ts
|
|
18
19
|
function getVersion() {
|
|
19
|
-
return "6.2.3-dev.
|
|
20
|
+
return "6.2.3-dev.35";
|
|
20
21
|
}
|
|
21
22
|
//#endregion
|
|
22
23
|
//#region src/utils/constants.ts
|
|
@@ -123,7 +124,7 @@ can load and still fail at runtime, so don't publish it.`,
|
|
|
123
124
|
handler: async (args) => {
|
|
124
125
|
if (args.debug) console.log(args);
|
|
125
126
|
try {
|
|
126
|
-
const { runBuild } = await import("./build-
|
|
127
|
+
const { runBuild } = await import("./build-Dk9HoX9_.mjs");
|
|
127
128
|
await runBuild(args);
|
|
128
129
|
} catch (error) {
|
|
129
130
|
console.error(error);
|
|
@@ -170,7 +171,7 @@ Build has no read mode; passing only <key> without <value> errors out (use \`ph
|
|
|
170
171
|
args: connectBuildArgs,
|
|
171
172
|
handler: async (args) => {
|
|
172
173
|
if (args.debug) console.log(args);
|
|
173
|
-
const { runConnectBuild } = await import("./connect-build-
|
|
174
|
+
const { runConnectBuild } = await import("./connect-build-2dTdDm81.mjs");
|
|
174
175
|
await runConnectBuild(args);
|
|
175
176
|
process.exit(0);
|
|
176
177
|
}
|
|
@@ -207,7 +208,7 @@ Writes go to:
|
|
|
207
208
|
`,
|
|
208
209
|
args: connectConfigArgs,
|
|
209
210
|
handler: async (args) => {
|
|
210
|
-
const { runConnectConfig } = await import("./connect-config-
|
|
211
|
+
const { runConnectConfig } = await import("./connect-config-DGfPEeP8.mjs");
|
|
211
212
|
await runConnectConfig(args);
|
|
212
213
|
}
|
|
213
214
|
});
|
|
@@ -238,6 +239,34 @@ const generateAllCmd = command({
|
|
|
238
239
|
}
|
|
239
240
|
});
|
|
240
241
|
//#endregion
|
|
242
|
+
//#region src/utils/fs-args.ts
|
|
243
|
+
const ExistingPath = extendType(string, {
|
|
244
|
+
displayName: "path",
|
|
245
|
+
description: "An existing path",
|
|
246
|
+
from(str) {
|
|
247
|
+
const resolved = path.resolve(str);
|
|
248
|
+
if (!fs.existsSync(resolved)) return Promise.reject(/* @__PURE__ */ new Error("Path doesn't exist"));
|
|
249
|
+
return Promise.resolve(resolved);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
/** A directory, or the directory of a given file. */
|
|
253
|
+
const Directory = extendType(ExistingPath, {
|
|
254
|
+
displayName: "dir",
|
|
255
|
+
description: "A path to a directory or a file within a directory",
|
|
256
|
+
from(resolved) {
|
|
257
|
+
return Promise.resolve(fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved));
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
/** An existing file. */
|
|
261
|
+
const File = extendType(ExistingPath, {
|
|
262
|
+
displayName: "file",
|
|
263
|
+
description: "A file in the file system",
|
|
264
|
+
from(resolved) {
|
|
265
|
+
if (!fs.statSync(resolved).isFile()) return Promise.reject(/* @__PURE__ */ new Error("Provided path is not a file"));
|
|
266
|
+
return Promise.resolve(resolved);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
//#endregion
|
|
241
270
|
//#region src/utils/comma-separated.ts
|
|
242
271
|
/** Splits comma-separated values so `-t "a,b"` means the same as `-t a -t b`
|
|
243
272
|
* instead of yielding the single value `"a,b"`, which matches nothing. */
|
|
@@ -405,8 +434,8 @@ const generateMigrationFileCmd = command({
|
|
|
405
434
|
handler: async ({ migrationFile, schemaFile }) => {
|
|
406
435
|
const { generateDBSchema } = await import("@powerhousedao/codegen");
|
|
407
436
|
await generateDBSchema({
|
|
408
|
-
migrationFile: path.join(process.cwd(), migrationFile),
|
|
409
|
-
schemaFile: schemaFile ? path.join(process.cwd(), schemaFile) : void 0
|
|
437
|
+
migrationFile: path$1.join(process.cwd(), migrationFile),
|
|
438
|
+
schemaFile: schemaFile ? path$1.join(process.cwd(), schemaFile) : void 0
|
|
410
439
|
});
|
|
411
440
|
process.exit(0);
|
|
412
441
|
}
|
|
@@ -955,7 +984,7 @@ const migrate = command({
|
|
|
955
984
|
description: "Run migrations",
|
|
956
985
|
handler: async (args) => {
|
|
957
986
|
if (args.debug) console.log(args);
|
|
958
|
-
const { startMigrate } = await import("./migrate-
|
|
987
|
+
const { startMigrate } = await import("./migrate-DK4HK7Dn.mjs");
|
|
959
988
|
await startMigrate(args);
|
|
960
989
|
process.exit(0);
|
|
961
990
|
}
|
|
@@ -1130,7 +1159,7 @@ This command:
|
|
|
1130
1159
|
const { basePath, dbPath, migrate, migrateStatus, reset, yes } = args;
|
|
1131
1160
|
if (basePath) process.env.BASE_PATH = basePath;
|
|
1132
1161
|
if (reset) {
|
|
1133
|
-
const { resetSwitchboardDatabase } = await import("./switchboard-reset-
|
|
1162
|
+
const { resetSwitchboardDatabase } = await import("./switchboard-reset-CX_Lzw3O.mjs");
|
|
1134
1163
|
await resetSwitchboardDatabase({
|
|
1135
1164
|
dbPath,
|
|
1136
1165
|
yes
|
|
@@ -1332,7 +1361,7 @@ it never replaces the Vetra drive.
|
|
|
1332
1361
|
args: vetraArgs,
|
|
1333
1362
|
handler: async (args) => {
|
|
1334
1363
|
if (args.debug) console.log(args);
|
|
1335
|
-
const { startVetra } = await import("./vetra-
|
|
1364
|
+
const { startVetra } = await import("./vetra-CQSUBUvg.mjs");
|
|
1336
1365
|
await startVetra(args);
|
|
1337
1366
|
}
|
|
1338
1367
|
}),
|
|
@@ -1460,4 +1489,4 @@ await main().catch(async (error) => {
|
|
|
1460
1489
|
export {};
|
|
1461
1490
|
|
|
1462
1491
|
//# sourceMappingURL=cli.mjs.map
|
|
1463
|
-
//# debugId=
|
|
1492
|
+
//# debugId=adfc754d-b98f-5eb1-9873-7e473fff27c0
|