@powerhousedao/codegen 6.1.0-staging.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{file-builders-BGuRLZmo.mjs → file-builders-DlSc6UWM.mjs} +45 -22
- package/dist/{file-builders-BGuRLZmo.mjs.map → file-builders-DlSc6UWM.mjs.map} +1 -1
- package/dist/{index-DGqqrenJ.d.mts → index-DqWWfHAz.d.mts} +15 -2
- package/dist/index-DqWWfHAz.d.mts.map +1 -0
- package/dist/index.d.mts +11 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +267 -170
- package/dist/index.mjs.map +1 -1
- package/dist/src/file-builders/index.d.mts +2 -2
- package/dist/src/file-builders/index.mjs +2 -2
- package/dist/src/name-builders/index.d.mts +1 -1
- package/dist/src/name-builders/index.mjs +1 -1
- package/dist/src/templates/index.d.mts +1 -1
- package/dist/src/templates/index.d.mts.map +1 -1
- package/dist/src/templates/index.mjs +1 -1
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/index-DGqqrenJ.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, PEER_EXTERNAL_DEPENDENCIES, REACTOR_API_PACKAGE, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, directoryExists, externalDevDependencies, fileExists, fileExistsSync, isDirectory, makeVersionedDependenciesMap, packageJsonExports, spawnAsync, writeFileEnsuringDir } from "@powerhousedao/shared/clis";
|
|
1
|
+
import { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_PNPM_OVERRIDES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, PEER_EXTERNAL_DEPENDENCIES, REACTOR_API_PACKAGE, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, directoryExists, externalDevDependencies, fileExists, fileExistsSync, isDirectory, makeVersionedDependenciesMap, packageJsonExports, spawnAsync, writeFileEnsuringDir } from "@powerhousedao/shared/clis";
|
|
2
2
|
import { readdirSync } from "fs";
|
|
3
3
|
import path, { join } from "path";
|
|
4
4
|
import { DocumentModelGlobalStateSchema, ManifestSchema } from "@powerhousedao/shared/document-model";
|
|
@@ -11,11 +11,11 @@ import arg from "arg";
|
|
|
11
11
|
import { format } from "prettier";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
import { loadJsonFile, loadJsonFileSync } from "load-json-file";
|
|
14
|
+
import { writeJsonFile } from "write-json-file";
|
|
14
15
|
import { stripVTControlCharacters } from "node:util";
|
|
15
16
|
import path$1, { join as join$1, relative } from "node:path";
|
|
16
17
|
import { generate } from "@graphql-codegen/cli";
|
|
17
18
|
import { generatorTypeDefs, validationSchema } from "@powerhousedao/document-engineering/graphql";
|
|
18
|
-
import { writeJsonFile } from "write-json-file";
|
|
19
19
|
function isEOL(c) {
|
|
20
20
|
return c === 10 || c === 13;
|
|
21
21
|
}
|
|
@@ -4513,7 +4513,7 @@ const packageJsonTemplate = (projectName, peerDependencies, devDependencies) =>
|
|
|
4513
4513
|
}
|
|
4514
4514
|
}
|
|
4515
4515
|
`.raw;
|
|
4516
|
-
const pnpmWorkspaceTemplate = `allowBuilds:\n${BOILERPLATE_ALLOWED_BUILDS.map((pkg) => ` ${/[@/]/.test(pkg) ? `"${pkg}"` : pkg}: true`).join("\n")}\n`;
|
|
4516
|
+
const pnpmWorkspaceTemplate = `allowBuilds:\n${BOILERPLATE_ALLOWED_BUILDS.map((pkg) => ` ${/[@/]/.test(pkg) ? `"${pkg}"` : pkg}: true`).join("\n")}\noverrides:\n${Object.entries(BOILERPLATE_PNPM_OVERRIDES).map(([pkg, version]) => ` ${/[@/]/.test(pkg) ? `"${pkg}"` : pkg}: "${version}"`).join("\n")}\n`;
|
|
4517
4517
|
//#endregion
|
|
4518
4518
|
//#region src/templates/boilerplate/package.json.legacy.ts
|
|
4519
4519
|
const packageJsonScriptsTemplate = {
|
|
@@ -4580,8 +4580,9 @@ function makeVetraConfigField(vetraDriveUrl) {
|
|
|
4580
4580
|
}
|
|
4581
4581
|
`.raw;
|
|
4582
4582
|
}
|
|
4583
|
-
|
|
4584
|
-
|
|
4583
|
+
function buildPowerhouseConfigTemplate(args) {
|
|
4584
|
+
const vetraConfigField = makeVetraConfigField(args.remoteDrive);
|
|
4585
|
+
return Promise.resolve(json`
|
|
4585
4586
|
{
|
|
4586
4587
|
"documentModelsDir": "./document-models",
|
|
4587
4588
|
"editorsDir": "./editors",
|
|
@@ -4595,9 +4596,9 @@ async function buildPowerhouseConfigTemplate(args) {
|
|
|
4595
4596
|
},
|
|
4596
4597
|
"packages": [
|
|
4597
4598
|
],
|
|
4598
|
-
"packageRegistryUrl": "${DEFAULT_REGISTRY_URL}"${
|
|
4599
|
+
"packageRegistryUrl": "${DEFAULT_REGISTRY_URL}"${vetraConfigField}
|
|
4599
4600
|
}
|
|
4600
|
-
`.raw;
|
|
4601
|
+
`.raw);
|
|
4601
4602
|
}
|
|
4602
4603
|
//#endregion
|
|
4603
4604
|
//#region src/templates/boilerplate/powerhouse.manifest.json.ts
|
|
@@ -4816,8 +4817,9 @@ Next Steps:
|
|
|
4816
4817
|
//#endregion
|
|
4817
4818
|
//#region src/templates/boilerplate/style.css.ts
|
|
4818
4819
|
const styleTemplate = css`
|
|
4819
|
-
@import "tailwindcss";
|
|
4820
4820
|
@import "@powerhousedao/design-system/theme.css";
|
|
4821
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
4822
|
+
@import "tailwindcss";
|
|
4821
4823
|
@import "@powerhousedao/connect/style.css";
|
|
4822
4824
|
|
|
4823
4825
|
@theme {
|
|
@@ -5851,12 +5853,11 @@ const documentModelGenUtilsTemplate = (v) => ts$1`
|
|
|
5851
5853
|
import type {
|
|
5852
5854
|
DocumentModelUtils,
|
|
5853
5855
|
} from "document-model";
|
|
5854
|
-
import {
|
|
5856
|
+
import {
|
|
5855
5857
|
baseCreateDocument,
|
|
5856
5858
|
baseSaveToFileHandle,
|
|
5857
5859
|
baseLoadFromInput,
|
|
5858
5860
|
defaultBaseState,
|
|
5859
|
-
generateId,
|
|
5860
5861
|
} from "document-model";
|
|
5861
5862
|
import { reducer } from './reducer.js';
|
|
5862
5863
|
import { ${v.documentTypeVariableName} } from "./document-type.js";
|
|
@@ -5877,17 +5878,11 @@ export const utils: DocumentModelUtils<${v.phStateName}> = {
|
|
|
5877
5878
|
return { ...defaultBaseState(), global: { ...initialGlobalState, ...state?.global }, local: { ...initialLocalState, ...state?.local } };
|
|
5878
5879
|
},
|
|
5879
5880
|
createDocument(state) {
|
|
5880
|
-
|
|
5881
|
+
return baseCreateDocument(
|
|
5881
5882
|
utils.createState,
|
|
5882
|
-
state
|
|
5883
|
+
state,
|
|
5884
|
+
${v.documentTypeVariableName}
|
|
5883
5885
|
);
|
|
5884
|
-
|
|
5885
|
-
document.header.documentType = ${v.documentTypeVariableName};
|
|
5886
|
-
|
|
5887
|
-
// for backwards compatibility, but this is NOT a valid signed document id
|
|
5888
|
-
document.header.id = generateId();
|
|
5889
|
-
|
|
5890
|
-
return document;
|
|
5891
5886
|
},
|
|
5892
5887
|
saveToFileHandle(document, input) {
|
|
5893
5888
|
return baseSaveToFileHandle(document, input);
|
|
@@ -7255,13 +7250,41 @@ async function writeProjectRootFiles(args, projectDir = process.cwd()) {
|
|
|
7255
7250
|
tag,
|
|
7256
7251
|
version
|
|
7257
7252
|
});
|
|
7258
|
-
await createOrUpdateManifest({ name }, projectDir);
|
|
7259
7253
|
await writeFileEnsuringDir("powerhouse.config.json", await buildPowerhouseConfigTemplate({
|
|
7260
7254
|
tag,
|
|
7261
7255
|
version,
|
|
7262
7256
|
remoteDrive
|
|
7263
7257
|
}));
|
|
7264
7258
|
await writeFileEnsuringDir("package.json", packageJson);
|
|
7259
|
+
await applyProjectCustomizations({
|
|
7260
|
+
name,
|
|
7261
|
+
projectDir
|
|
7262
|
+
});
|
|
7263
|
+
}
|
|
7264
|
+
/**
|
|
7265
|
+
* Per-project customizations applied to a project directory — the parts
|
|
7266
|
+
* `ph init` derives from the project name. Shared by the fresh-scaffold path
|
|
7267
|
+
* ({@link writeProjectRootFiles}) and the `--template` clone path, so future
|
|
7268
|
+
* per-project customizations only need to be added here once.
|
|
7269
|
+
*
|
|
7270
|
+
* Assumes `package.json` already exists in `projectDir`.
|
|
7271
|
+
*/
|
|
7272
|
+
async function applyProjectCustomizations(args) {
|
|
7273
|
+
const { name, projectDir, remoteDrive } = args;
|
|
7274
|
+
const pkgPath = join(projectDir, "package.json");
|
|
7275
|
+
const pkg = await loadJsonFile(pkgPath);
|
|
7276
|
+
pkg.name = name;
|
|
7277
|
+
await writeJsonFile(pkgPath, pkg, { indent: 2 });
|
|
7278
|
+
await createOrUpdateManifest({ name }, projectDir);
|
|
7279
|
+
if (remoteDrive) {
|
|
7280
|
+
const configPath = join(projectDir, "powerhouse.config.json");
|
|
7281
|
+
const config = await loadJsonFile(configPath);
|
|
7282
|
+
config.vetra = {
|
|
7283
|
+
driveId: remoteDrive.split("/").pop() ?? "",
|
|
7284
|
+
driveUrl: remoteDrive
|
|
7285
|
+
};
|
|
7286
|
+
await writeJsonFile(configPath, config, { indent: 2 });
|
|
7287
|
+
}
|
|
7265
7288
|
}
|
|
7266
7289
|
async function writeCIFiles(projectDir = process.cwd()) {
|
|
7267
7290
|
await writeFileEnsuringDir(join(projectDir, ".github/workflows/sync-and-publish.yml"), syncAndPublishWorkflowTemplate);
|
|
@@ -8537,6 +8560,6 @@ async function makeSubgraphsIndexFile(args) {
|
|
|
8537
8560
|
await formatSourceFileWithPrettier(sourceFile);
|
|
8538
8561
|
}
|
|
8539
8562
|
//#endregion
|
|
8540
|
-
export {
|
|
8563
|
+
export { buildObjectLiteral as $, connectEntrypointTemplate as $n, documentModelOperationModuleActionsFileTemplate as $t, writeGeneratedSubgraphsFiles as A, packageJsonScriptsTemplate as An, analyticsIndexTemplate as At, DEFAULT_PROJECT_OPTIONS as B, indexHtmlTemplate as Bn, documentModelSrcUtilsTemplate as Bt, writeAiConfigFiles as C, tsconfigPathsTemplate as Cn, relationalDbMigrationsTemplate as Ct, writeGeneratedEditorsFiles as D, ManifestTemplate as Dn, processorsFactoryTemplate as Dt, writeGeneratedDocumentModelsFiles as E, readmeTemplate as En, processorsIndexTemplate as Et, makeEditorsFile as F, mcpTemplate as Fn, documentModelOperationsModuleTestFileTemplate as Ft, getBooleanPropertyValue as G, editorsIndexTemplate as Gn, documentModelGenUtilsTemplate as Gt, getDefaultProjectOptions as H, syncAndPublishWorkflowTemplate as Hn, documentModelModuleFileTemplate as Ht, makeEditorsIndexFile as I, mainTsxTemplate as In, makeOperationImportNames as It, getProperyAssignmentByName as J, documentModelsIndexTemplate as Jn, documentModelGenReducerFileTemplate as Jt, getObjectLiteral as K, editorsTemplate as Kn, documentModelGenTypesTemplate as Kt, validateDocumentModelState as L, licenseTemplate as Ln, makeOperationsImports as Lt, writeProjectRootFiles as M, exportsTemplate as Mn, documentModelUtilsTemplate as Mt, tsMorphGenerateApp as N, packageJsonTemplate as Nn, upgradeTransitionTemplate as Nt, writeGeneratedProcessorsFiles as O, buildPowerhouseConfigTemplate as On, factoryBuildersTemplate as Ot, makeEditorModuleFile as P, npmrcTemplate as Pn, upgradeManifestTemplate as Pt, loadDocumentModelInDir as Q, dockerfileTemplate as Qn, documentModelOperationsModuleCreatorsFileTemplate as Qt, updateVersionedImports as R, indexTsTemplate as Rn, makeTestCaseForOperation as Rt, applyProjectCustomizations as S, tsConfigTemplate as Sn, relationalDbProcessorTemplate as St, writeCIFiles as T, styleTemplate as Tn, relationalDbFactoryTemplate as Tt, getAllImportModuleSpecifiers as U, geminiSettingsTemplate as Un, documentModelIndexTemplate as Ut, buildTsMorphProject as V, gitIgnoreTemplate as Vn, documentModelSrcIndexFileTemplate as Vt, getAllImportNames as W, eslintConfigTemplate as Wn, documentModelHooksFileTemplate as Wt, getStringPropertyValue as X, switchboardEntrypointTemplate as Xn, documentModelOperationsModuleOperationsFileTemplate as Xt, getStringArrayPropertyElements as Y, documentModelsTemplate as Yn, documentModelPhFactoriesFileTemplate as Yt, getVariableDeclarationByTypeName as Z, nginxConfTemplate as Zn, documentModelOperationsModuleErrorFileTemplate as Zt, getCommandHelpInfo as _, documentModelRootActionsFileTemplate as _n, customSubgraphResolversTemplate as _t, getOrCreateManifestFile as a, getLatestDocumentModelSpec as an, driveExplorerNavigationBreadcrumbsFileTemplate as ar, getSubgraphMetadata as at, writeCliDocsMarkdownFile as b, docsFromCliHelpTemplate as bn, subgraphIndexFileTemplate as bt, operationHasAttachment as c, getActionInputTypeNames as cn, appFilesFileTemplate as cr, getEditorMetadata as ct, tsMorphGenerateDocumentModel as d, documentModelGenIndexFileTemplate as dn, appDriveContentsFileTemplate as dr, runPrettier as dt, getModuleExportType as en, cursorMcpTemplate as er, buildStringLiteral as et, generateDocumentModelZodSchemas as f, documentModelDocumentTypeTemplate as fn, createDocumentFileTemplate as fr, getDocumentTypeMetadata as ft, tsMorphGenerateDocumentEditor as g, documentModelGenActionsFileTemplate as gn, parseConfig as gt, scalarsValidation as h, documentModelGenControllerFileTemplate as hn, parseArgs as ht, createOrUpdateManifest as i, getEditorVariableNames as in, appConfigFileTemplate as ir, getPreviousVersionSourceFile as it, writeModuleFiles as j, pnpmWorkspaceTemplate as jn, analyticsFactoryTemplate as jt, writeGeneratedProjectRootFiles as k, packageJsonExportsTemplate as kn, analyticsProcessorTemplate as kt, operationHasEmptyInput as l, getActionType as ln, emptyStateFileTemplate as lr, formatSafe as lt, scalars as m, documentModelGenCreatorsFileTemplate as mn, configSpec as mt, tsMorphGenerateSubgraph as n, getDocumentModelSpecByVersionNumber as nn, agentsTemplate as nr, getOrCreateDirectory as nt, pruneManifestSection as o, getLatestDocumentModelSpecVersionNumber as on, folderTreeFileTemplate as or, getProcessorMetadata as ot, generateTypesAndZodSchemasFromGraphql as p, documentModelDocumentSchemaFileTemplate as pn, documentModelDocumentTypeMetadata as pt, getObjectProperty as q, upgradeManifestsTemplate as qn, documentModelSchemaIndexTemplate as qt, tsMorphGenerateProcessor as r, getDocumentModelVariableNames as rn, appEditorFileTemplate as rr, getOrCreateSourceFile as rt, makeModulesIndexFile as s, getActionInputName as sn, appFoldersFileTemplate as sr, getAppMetadata as st, makeSubgraphsIndexFile as t, getDocumentModelDirName as tn, claudeSettingsLocalTemplate as tr, ensureDirectoriesExist as tt, operationHasInput as u, getActionTypeName as un, driveExplorerFileTemplate as ur, formatSourceFileWithPrettier as ut, getCommandsHelpInfo as v, documentEditorModuleFileTemplate as vn, customSubgraphSchemaTemplate as vt, writeAllGeneratedProjectFiles as w, subgraphsIndexTemplate as wn, relationalDbIndexTemplate as wt, buildBoilerplatePackageJson as x, vitestConfigTemplate as xn, relationalDbSchemaTemplate as xt, makeCliDocsFromHelp as y, documentEditorEditorFileTemplate as yn, subgraphLibFileTemplate as yt, getInitialStates as z, legacyIndexHtmlTemplate as zn, documentModelTestFileTemplate as zt };
|
|
8541
8564
|
|
|
8542
|
-
//# sourceMappingURL=file-builders-
|
|
8565
|
+
//# sourceMappingURL=file-builders-DlSc6UWM.mjs.map
|