@powerhousedao/codegen 6.0.0-dev.52 → 6.0.0-dev.54

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.
Files changed (28) hide show
  1. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +5 -5
  2. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +5 -5
  3. package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +4 -4
  4. package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +4 -4
  5. package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +7 -7
  6. package/dist/src/codegen/__tests__/utils.js +2 -2
  7. package/dist/src/codegen/generate.js +8 -8
  8. package/dist/src/file-builders/document-model/document-model.js +2 -2
  9. package/dist/src/file-builders/document-model/gen-dir.js +9 -9
  10. package/dist/src/file-builders/document-model/src-dir.js +3 -3
  11. package/dist/src/file-builders/document-model/tests-dir.js +3 -3
  12. package/dist/src/file-builders/processors/processor.js +5 -5
  13. package/dist/src/file-builders/processors/types.d.ts +1 -1
  14. package/dist/src/name-builders/get-variable-names.d.ts +1 -1
  15. package/dist/src/name-builders/get-variable-names.js +4 -4
  16. package/dist/src/templates/cli-docs/docs-from-cli-help.js +2 -2
  17. package/dist/src/templates/document-model/gen/actions.js +5 -5
  18. package/dist/src/templates/document-model/gen/creators.js +4 -4
  19. package/dist/src/templates/document-model/gen/index.js +2 -2
  20. package/dist/src/templates/document-model/gen/reducer.js +3 -3
  21. package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +4 -4
  22. package/dist/src/ts-morph-generator/core/ReducerGenerator.js +3 -3
  23. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +1 -1
  24. package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
  25. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js +5 -5
  26. package/dist/src/ts-morph-generator/utilities/DirectoryManager.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +19 -21
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- const { paramCase, pascalCase, camelCase } = require("change-case");
2
+ const { kebabCase, pascalCase, camelCase } = require("change-case");
3
3
  function documentModelToString(documentModel) {
4
4
  return JSON.stringify(
5
5
  {
@@ -33,7 +33,7 @@ module.exports = {
33
33
  const documentType = documentModel.name;
34
34
  const documentTypeId = documentModel.id;
35
35
  const rootDir = args.rootDir;
36
- const paramCaseDocumentType = paramCase(documentType);
36
+ const kebabCaseDocumentType = kebabCase(documentType);
37
37
  const pascalCaseDocumentType = pascalCase(documentType);
38
38
  const camelCaseDocumentType = camelCase(documentType);
39
39
  const documentTypeVariableName = `${camelCaseDocumentType}DocumentType`;
@@ -46,7 +46,7 @@ module.exports = {
46
46
  const actionsTypeName = `${actionTypeName}s`;
47
47
  const actionsName = camelCase(actionsTypeName);
48
48
  const packageName = args.packageName;
49
- const documentModelDir = `${packageName}/document-models/${paramCaseDocumentType}`;
49
+ const documentModelDir = `${packageName}/document-models/${kebabCaseDocumentType}`;
50
50
  const stateSchemaName = `${stateName}Schema`;
51
51
  const phDocumentSchemaName = `${phDocumentTypeName}Schema`;
52
52
  const isPhStateOfTypeFunctionName = `is${stateName}`;
@@ -69,7 +69,7 @@ module.exports = {
69
69
  documentTypeId,
70
70
  documentType,
71
71
  camelCaseDocumentType,
72
- paramCaseDocumentType,
72
+ kebabCaseDocumentType,
73
73
  pascalCaseDocumentType,
74
74
  stateName,
75
75
  globalStateName,
@@ -89,7 +89,7 @@ module.exports = {
89
89
  extension: documentModel.extension,
90
90
  modules: latestSpec.modules.map((m) => ({
91
91
  ...m,
92
- name: paramCase(m.name),
92
+ name: kebabCase(m.name),
93
93
  })),
94
94
  fileExtension: documentModel.extension || "",
95
95
  hasLocalSchema: latestSpec.state.local.schema !== "",
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- const { paramCase, pascalCase } = require("change-case");
2
+ const { kebabCase, pascalCase } = require("change-case");
3
3
 
4
4
  module.exports = {
5
5
  params: ({ args }) => {
@@ -50,17 +50,17 @@ module.exports = {
50
50
  const phDocumentTypeName = `${pascalCaseDocumentType}Document`;
51
51
  const isPhDocumentOfTypeFunctionName = `is${phDocumentTypeName}`;
52
52
  const assertIsPhDocumentOfTypeFunctionName = `assertIs${phDocumentTypeName}`;
53
- const paramCaseDocumentType = paramCase(documentType);
53
+ const kebabCaseDocumentType = kebabCase(documentType);
54
54
  const packageName = args.packageName;
55
- const documentModelDir = `${packageName}/document-models/${paramCaseDocumentType}`;
55
+ const documentModelDir = `${packageName}/document-models/${kebabCaseDocumentType}`;
56
56
  return {
57
57
  rootDir: args.rootDir,
58
58
  documentType: documentModel.name,
59
- module: paramCase(args.module),
59
+ module: kebabCase(args.module),
60
60
  actions,
61
61
  errors,
62
62
  pascalCaseDocumentType,
63
- paramCaseDocumentType,
63
+ kebabCaseDocumentType,
64
64
  packageName,
65
65
  documentModelDir,
66
66
  phDocumentTypeName,
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- const { paramCase, pascalCase, camelCase } = require("change-case");
2
+ const { kebabCase, pascalCase, camelCase } = require("change-case");
3
3
 
4
4
  /**
5
5
  * Extract type names from a GraphQL schema.
@@ -85,8 +85,8 @@ module.exports = {
85
85
  const phDocumentTypeName = `${pascalCaseDocumentType}Document`;
86
86
  const documentTypeVariableName = `${camelCaseDocumentType}DocumentType`;
87
87
  const packageName = args.packageName;
88
- const paramCaseDocumentType = paramCase(documentType);
89
- const documentModelDir = `${packageName}/document-models/${paramCaseDocumentType}`;
88
+ const kebabCaseDocumentType = kebabCase(documentType);
89
+ const documentModelDir = `${packageName}/document-models/${kebabCaseDocumentType}`;
90
90
 
91
91
  const stateSchema = latestSpec.state.global.schema;
92
92
  const stateTypeNames = extractTypeNames(stateSchema);
@@ -107,7 +107,7 @@ module.exports = {
107
107
  ),
108
108
  modules: latestSpec.modules.map((m) => ({
109
109
  ...m,
110
- name: paramCase(m.name),
110
+ name: kebabCase(m.name),
111
111
  operations: m.operations.map((op) => ({
112
112
  ...op,
113
113
  schema: applyGraphQLTypePrefixes(op.schema, pascalCaseDocumentType, stateTypeNames),
@@ -1,4 +1,4 @@
1
- const { pascalCase, paramCase } = require("change-case");
1
+ const { pascalCase, kebabCase } = require("change-case");
2
2
  const path = require("path");
3
3
 
4
4
  // @ts-check
@@ -6,10 +6,10 @@ module.exports = {
6
6
  params: ({ args }) => {
7
7
  const name = args.name;
8
8
  const rootDir = args.rootDir;
9
- const driveEditorDirName = args.driveEditorDirName || paramCase(args.name);
9
+ const driveEditorDirName = args.driveEditorDirName || kebabCase(args.name);
10
10
  const driveEditorDir = path.join(rootDir, driveEditorDirName);
11
11
  const pascalCaseDriveEditorName = pascalCase(name);
12
- const paramCaseDriveEditorName = paramCase(name);
12
+ const kebabCaseDriveEditorName = kebabCase(name);
13
13
 
14
14
  return {
15
15
  rootDir,
@@ -19,7 +19,7 @@ module.exports = {
19
19
  isDragAndDropEnabled: args.isDragAndDropEnabled,
20
20
  allowedDocumentTypes: args.allowedDocumentTypes,
21
21
  pascalCaseDriveEditorName,
22
- paramCaseDriveEditorName,
22
+ kebabCaseDriveEditorName,
23
23
  };
24
24
  },
25
25
  };
@@ -1,6 +1,6 @@
1
1
  const {
2
2
  pascalCase,
3
- paramCase,
3
+ kebabCase,
4
4
  capitalCase,
5
5
  camelCase,
6
6
  } = require("change-case");
@@ -11,7 +11,7 @@ const { join } = require("path");
11
11
  module.exports = {
12
12
  params: ({ args }) => {
13
13
  const rootDir = args.rootDir;
14
- const editorDirName = args.editorDirName || paramCase(args.name);
14
+ const editorDirName = args.editorDirName || kebabCase(args.name);
15
15
  const editorDir = join(rootDir, editorDirName);
16
16
  const documentTypes = args.documentTypes
17
17
  .split(",")
@@ -27,9 +27,9 @@ module.exports = {
27
27
  : undefined;
28
28
  const packageName = args.packageName;
29
29
  const pascalCaseEditorName = pascalCase(args.name);
30
- const paramCaseEditorName = paramCase(args.name);
30
+ const kebabCaseEditorName = kebabCase(args.name);
31
31
  const pascalCaseDocumentType = pascalCase(documentType?.name);
32
- const paramCaseDocumentType = paramCase(documentType?.name);
32
+ const kebabCaseDocumentType = kebabCase(documentType?.name);
33
33
  const camelCaseDocumentType = camelCase(documentType?.name);
34
34
  const documentVariableName = documentType
35
35
  ? `${camelCaseDocumentType}Document`
@@ -38,7 +38,7 @@ module.exports = {
38
38
  ? `${pascalCaseDocumentType}Document`
39
39
  : "Document";
40
40
  const actionTypeName = `${pascalCaseDocumentType}Action`;
41
- const documentModelDir = `${packageName}/document-models/${paramCaseDocumentType}`;
41
+ const documentModelDir = `${packageName}/document-models/${kebabCaseDocumentType}`;
42
42
  const hooksDir = `${packageName}/editors/hooks`;
43
43
  const isDocumentOfTypeFunctionName = `is${phDocumentTypeName}`;
44
44
  const assertIsDocumentOfTypeFunctionName = `assertIs${phDocumentTypeName}`;
@@ -62,9 +62,9 @@ module.exports = {
62
62
  documentModelsDir: args.documentModelsDir,
63
63
  name: args.name,
64
64
  pascalCaseEditorName,
65
- paramCaseEditorName,
65
+ kebabCaseEditorName,
66
66
  pascalCaseDocumentType,
67
- paramCaseDocumentType,
67
+ kebabCaseDocumentType,
68
68
  camelCaseDocumentType,
69
69
  documentVariableName,
70
70
  phDocumentTypeName,
@@ -1,4 +1,4 @@
1
- import { paramCase } from "change-case";
1
+ import { kebabCase } from "change-case";
2
2
  import { copyFile, mkdir, readdir, rm } from "node:fs/promises";
3
3
  import path from "path";
4
4
  import { PURGE_AFTER_TEST } from "./config.js";
@@ -27,7 +27,7 @@ export function getTestDataDir(testDir, testDataDir) {
27
27
  return path.join(testDir, TEST_DATA_DIR, testDataDir);
28
28
  }
29
29
  export function getTestOutDirPath(testName, outDirName) {
30
- return path.join(outDirName, `test-${paramCase(testName)}`);
30
+ return path.join(outDirName, `test-${kebabCase(testName)}`);
31
31
  }
32
32
  export async function resetDirForTest(outDirName) {
33
33
  try {
@@ -1,7 +1,7 @@
1
1
  import { makeDocumentModelModulesFile, makeSubgraphsIndexFile, tsMorphGenerateDocumentEditor, tsMorphGenerateDocumentModel, tsMorphGenerateDriveEditor, } from "@powerhousedao/codegen/file-builders";
2
2
  import { buildTsMorphProject } from "@powerhousedao/codegen/utils";
3
3
  import { fileExists } from "@powerhousedao/common/clis";
4
- import { paramCase } from "change-case";
4
+ import { kebabCase } from "change-case";
5
5
  import fs from "node:fs";
6
6
  import { readdir } from "node:fs/promises";
7
7
  import path, { join } from "node:path";
@@ -96,7 +96,7 @@ export async function generateDocumentModel(args) {
96
96
  await hygenGenerateDocumentModel(documentModelState, dir, packageName, hygenArgs);
97
97
  const specification = documentModelState.specifications[documentModelState.specifications.length - 1];
98
98
  const documentModelsDirPath = path.join(projectDir, "document-models");
99
- const documentModelDirPath = path.join(documentModelsDirPath, paramCase(documentModelState.name));
99
+ const documentModelDirPath = path.join(documentModelsDirPath, kebabCase(documentModelState.name));
100
100
  await generateDocumentModelZodSchemas({
101
101
  documentModelDirPath,
102
102
  specification,
@@ -170,8 +170,8 @@ export async function generateEditor(args) {
170
170
  throw new Error("Multiple document types are not supported yet");
171
171
  }
172
172
  const documentModelId = documentTypes[0];
173
- const editorId = editorIdArg || paramCase(editorName);
174
- const editorDir = editorDirName || paramCase(editorName);
173
+ const editorId = editorIdArg || kebabCase(editorName);
174
+ const editorDir = editorDirName || kebabCase(editorName);
175
175
  await tsMorphGenerateDocumentEditor({
176
176
  packageName,
177
177
  projectDir,
@@ -193,7 +193,7 @@ export async function generateDriveEditor(options) {
193
193
  return hygenGenerateDriveEditor({
194
194
  name,
195
195
  dir,
196
- appId: driveEditorId ?? paramCase(name),
196
+ appId: driveEditorId ?? kebabCase(name),
197
197
  allowedDocumentTypes: allowedDocumentTypes?.join(","),
198
198
  isDragAndDropEnabled: isDragAndDropEnabled ?? true,
199
199
  skipFormat,
@@ -202,9 +202,9 @@ export async function generateDriveEditor(options) {
202
202
  }
203
203
  await tsMorphGenerateDriveEditor({
204
204
  projectDir,
205
- editorDir: driveEditorDirName || paramCase(driveEditorName),
205
+ editorDir: driveEditorDirName || kebabCase(driveEditorName),
206
206
  editorName: driveEditorName,
207
- editorId: driveEditorId ?? paramCase(driveEditorName),
207
+ editorId: driveEditorId ?? kebabCase(driveEditorName),
208
208
  packageName,
209
209
  allowedDocumentModelIds: allowedDocumentTypes ?? [],
210
210
  isDragAndDropEnabled: isDragAndDropEnabled ?? true,
@@ -328,7 +328,7 @@ async function generateFromDocumentModel(args) {
328
328
  const { verbose = config.logLevel === "verbose" ||
329
329
  config.logLevel === "debug" ||
330
330
  config.logLevel === "info", force = false, } = options;
331
- const name = paramCase(documentModelState.name);
331
+ const name = kebabCase(documentModelState.name);
332
332
  const documentModelDir = join(config.documentModelsDir, name);
333
333
  // create document model folder and spec as json
334
334
  fs.mkdirSync(documentModelDir, { recursive: true });
@@ -1,7 +1,7 @@
1
1
  import { getDocumentModelDirName, getDocumentModelVariableNames, } from "@powerhousedao/codegen/name-builders";
2
2
  import { buildTsMorphProject, ensureDirectoriesExist, formatSourceFileWithPrettier, getInitialStates, getOrCreateSourceFile, } from "@powerhousedao/codegen/utils";
3
3
  import { directoryExists, fileExists } from "@powerhousedao/common/clis";
4
- import { paramCase } from "change-case";
4
+ import { kebabCase } from "change-case";
5
5
  import { copyFile, mkdir, readdir, writeFile } from "node:fs/promises";
6
6
  import path from "path";
7
7
  import {} from "ts-morph";
@@ -134,7 +134,7 @@ async function generateDocumentModelForSpec({ project, projectDir, packageName,
134
134
  const { initialGlobalState, initialLocalState } = getInitialStates(specification.state);
135
135
  const hasLocalSchema = specification.state.local.schema !== "";
136
136
  const modules = specification.modules;
137
- const moduleDirPaths = modules.map((module) => path.join(genDirPath, paramCase(module.name)));
137
+ const moduleDirPaths = modules.map((module) => path.join(genDirPath, kebabCase(module.name)));
138
138
  await ensureDirectoriesExist(project, documentModelVersionDirPath, reducersDirPath, testsDirPath, schemaDirPath, ...moduleDirPaths);
139
139
  const fileMakerArgs = {
140
140
  project,
@@ -1,7 +1,7 @@
1
1
  import { getDocumentModelOperationsModuleVariableNames } from "@powerhousedao/codegen/name-builders";
2
2
  import { documentModelDocumentSchemaFileTemplate, documentModelDocumentTypeTemplate, documentModelGenActionsFileTemplate, documentModelGenCreatorsFileTemplate, documentModelGenIndexFileTemplate, documentModelGenReducerFileTemplate, documentModelGenTypesTemplate, documentModelGenUtilsTemplate, documentModelOperationModuleActionsFileTemplate, documentModelOperationsModuleCreatorsFileTemplate, documentModelOperationsModuleErrorFileTemplate, documentModelOperationsModuleOperationsFileTemplate, documentModelPhFactoriesFileTemplate, documentModelSchemaIndexTemplate, } from "@powerhousedao/codegen/templates";
3
3
  import { buildObjectLiteral, formatSourceFileWithPrettier, getOrCreateSourceFile, } from "@powerhousedao/codegen/utils";
4
- import { paramCase, pascalCase } from "change-case";
4
+ import { kebabCase, pascalCase } from "change-case";
5
5
  import path from "path";
6
6
  import { VariableDeclarationKind } from "ts-morph";
7
7
  export async function makeGenDirFiles(fileMakerArgs) {
@@ -140,14 +140,14 @@ async function makeOperationModuleGenActionsFile(args) {
140
140
  const { module } = args;
141
141
  const { actions } = getDocumentModelOperationsModuleVariableNames(module);
142
142
  const pascalCaseModuleName = pascalCase(module.name);
143
- const paramCaseModuleName = paramCase(module.name);
143
+ const kebabCaseModuleName = kebabCase(module.name);
144
144
  const template = documentModelOperationModuleActionsFileTemplate({
145
145
  ...args,
146
146
  actions,
147
147
  pascalCaseModuleName,
148
148
  });
149
149
  const { project, genDirPath } = args;
150
- const dirPath = path.join(genDirPath, paramCaseModuleName);
150
+ const dirPath = path.join(genDirPath, kebabCaseModuleName);
151
151
  const filePath = path.join(dirPath, "actions.ts");
152
152
  const { sourceFile } = getOrCreateSourceFile(project, filePath);
153
153
  sourceFile.replaceWithText(template);
@@ -156,13 +156,13 @@ async function makeOperationModuleGenActionsFile(args) {
156
156
  async function makeOperationModuleGenCreatorsFile(args) {
157
157
  const { module } = args;
158
158
  const moduleVariableNames = getDocumentModelOperationsModuleVariableNames(module);
159
- const paramCaseModuleName = paramCase(module.name);
159
+ const kebabCaseModuleName = kebabCase(module.name);
160
160
  const template = documentModelOperationsModuleCreatorsFileTemplate({
161
161
  ...args,
162
162
  ...moduleVariableNames,
163
163
  });
164
164
  const { project, genDirPath } = args;
165
- const dirPath = path.join(genDirPath, paramCaseModuleName);
165
+ const dirPath = path.join(genDirPath, kebabCaseModuleName);
166
166
  const filePath = path.join(dirPath, "creators.ts");
167
167
  const { sourceFile } = getOrCreateSourceFile(project, filePath);
168
168
  sourceFile.replaceWithText(template);
@@ -171,13 +171,13 @@ async function makeOperationModuleGenCreatorsFile(args) {
171
171
  async function makeOperationModuleGenOperationsFile(args) {
172
172
  const { module } = args;
173
173
  const moduleVariableNames = getDocumentModelOperationsModuleVariableNames(module);
174
- const paramCaseModuleName = paramCase(module.name);
174
+ const kebabCaseModuleName = kebabCase(module.name);
175
175
  const template = documentModelOperationsModuleOperationsFileTemplate({
176
176
  ...args,
177
177
  ...moduleVariableNames,
178
178
  });
179
179
  const { project, genDirPath } = args;
180
- const dirPath = path.join(genDirPath, paramCaseModuleName);
180
+ const dirPath = path.join(genDirPath, kebabCaseModuleName);
181
181
  const filePath = path.join(dirPath, "operations.ts");
182
182
  const { sourceFile } = getOrCreateSourceFile(project, filePath);
183
183
  sourceFile.replaceWithText(template);
@@ -186,13 +186,13 @@ async function makeOperationModuleGenOperationsFile(args) {
186
186
  async function makeOperationModuleGenErrorFile(args) {
187
187
  const { module } = args;
188
188
  const moduleVariableNames = getDocumentModelOperationsModuleVariableNames(module);
189
- const paramCaseModuleName = paramCase(module.name);
189
+ const kebabCaseModuleName = kebabCase(module.name);
190
190
  const template = documentModelOperationsModuleErrorFileTemplate({
191
191
  ...args,
192
192
  ...moduleVariableNames,
193
193
  });
194
194
  const { project, genDirPath } = args;
195
- const dirPath = path.join(genDirPath, paramCaseModuleName);
195
+ const dirPath = path.join(genDirPath, kebabCaseModuleName);
196
196
  const filePath = path.join(dirPath, "error.ts");
197
197
  const { sourceFile } = getOrCreateSourceFile(project, filePath);
198
198
  sourceFile.replaceWithText(template);
@@ -1,7 +1,7 @@
1
1
  import { documentModelSrcIndexFileTemplate, documentModelSrcUtilsTemplate, } from "@powerhousedao/codegen/templates";
2
2
  import { formatSourceFileWithPrettier, getObjectLiteral, getOrCreateSourceFile, getPreviousVersionSourceFile, } from "@powerhousedao/codegen/utils";
3
3
  import { ts } from "@tmpl/core";
4
- import { paramCase, pascalCase } from "change-case";
4
+ import { kebabCase, pascalCase } from "change-case";
5
5
  import path from "path";
6
6
  import { VariableDeclarationKind } from "ts-morph";
7
7
  export async function makeSrcDirFiles(fileMakerArgs) {
@@ -19,9 +19,9 @@ async function makeReducerOperationHandlersForModules(fileMakerArgs) {
19
19
  }
20
20
  }
21
21
  async function makeReducerOperationHandlerForModule({ project, module, version, reducersDirPath, pascalCaseDocumentType, camelCaseDocumentType, versionedDocumentModelPackageImportPath, }) {
22
- const paramCaseModuleName = paramCase(module.name);
22
+ const kebabCaseModuleName = kebabCase(module.name);
23
23
  const pascalCaseModuleName = pascalCase(module.name);
24
- const filePath = path.join(reducersDirPath, `${paramCaseModuleName}.ts`);
24
+ const filePath = path.join(reducersDirPath, `${kebabCaseModuleName}.ts`);
25
25
  const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, filePath);
26
26
  if (!alreadyExists) {
27
27
  const previousVersionFile = getPreviousVersionSourceFile({
@@ -2,7 +2,7 @@ import { getDocumentModelOperationsModuleVariableNames } from "@powerhousedao/co
2
2
  import { documentModelTestFileTemplate, makeActionImportNames, makeTestCaseForAction, } from "@powerhousedao/codegen/templates";
3
3
  import { formatSourceFileWithPrettier, getOrCreateSourceFile, getPreviousVersionSourceFile, } from "@powerhousedao/codegen/utils";
4
4
  import { ts } from "@tmpl/core";
5
- import { camelCase, paramCase, pascalCase } from "change-case";
5
+ import { camelCase, kebabCase, pascalCase } from "change-case";
6
6
  import path from "path";
7
7
  import { SyntaxKind } from "ts-morph";
8
8
  export async function makeTestsDirFiles(fileMakerArgs) {
@@ -16,10 +16,10 @@ async function makeOperationModuleTestFile(args) {
16
16
  const { project, module, version, testsDirPath, documentModelPackageImportPath, versionedDocumentModelPackageImportPath, isPhDocumentOfTypeFunctionName, } = args;
17
17
  const moduleVariableNames = getDocumentModelOperationsModuleVariableNames(module);
18
18
  const { actions } = moduleVariableNames;
19
- const paramCaseModuleName = paramCase(module.name);
19
+ const kebabCaseModuleName = kebabCase(module.name);
20
20
  const pascalCaseModuleName = pascalCase(module.name);
21
21
  const moduleOperationsTypeName = `${pascalCaseModuleName}Operations`;
22
- const filePath = path.join(testsDirPath, `${paramCaseModuleName}.test.ts`);
22
+ const filePath = path.join(testsDirPath, `${kebabCaseModuleName}.test.ts`);
23
23
  const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, filePath);
24
24
  if (!alreadyExists) {
25
25
  const previousVersionSourceFile = getPreviousVersionSourceFile({
@@ -1,17 +1,17 @@
1
1
  import { processorsFactoryTemplate, processorsIndexTemplate, } from "@powerhousedao/codegen/templates";
2
2
  import { buildTsMorphProject, ensureDirectoriesExist, formatSourceFileWithPrettier, getOrCreateSourceFile, } from "@powerhousedao/codegen/utils";
3
- import { camelCase, paramCase, pascalCase } from "change-case";
3
+ import { camelCase, kebabCase, pascalCase } from "change-case";
4
4
  import path from "path";
5
5
  import { ts } from "ts-morph";
6
6
  import { tsMorphGenerateAnalyticsProcessor } from "./analytics.js";
7
7
  import { tsMorphGenerateRelationalDbProcessor } from "./relational-db.js";
8
8
  export async function tsMorphGenerateProcessor(args) {
9
9
  const { processorName, documentTypes, rootDir, processorType, processorApps, } = args;
10
- const paramCaseName = paramCase(processorName);
10
+ const kebabCaseName = kebabCase(processorName);
11
11
  const camelCaseName = camelCase(processorName);
12
12
  const pascalCaseName = pascalCase(processorName);
13
13
  const processorsDirPath = path.join(rootDir, "processors");
14
- const dirPath = path.join(processorsDirPath, paramCaseName);
14
+ const dirPath = path.join(processorsDirPath, kebabCaseName);
15
15
  const sourceFilesPath = path.join(processorsDirPath, "**/*");
16
16
  const project = buildTsMorphProject(rootDir);
17
17
  await ensureDirectoriesExist(project, processorsDirPath, dirPath);
@@ -23,7 +23,7 @@ export async function tsMorphGenerateProcessor(args) {
23
23
  rootDir,
24
24
  camelCaseName,
25
25
  dirPath,
26
- paramCaseName,
26
+ kebabCaseName,
27
27
  pascalCaseName,
28
28
  processorsDirPath,
29
29
  project,
@@ -36,7 +36,7 @@ export async function tsMorphGenerateProcessor(args) {
36
36
  rootDir,
37
37
  camelCaseName,
38
38
  dirPath,
39
- paramCaseName,
39
+ kebabCaseName,
40
40
  pascalCaseName,
41
41
  processorsDirPath,
42
42
  project,
@@ -4,7 +4,7 @@ export type GenerateProcessorArgs = {
4
4
  project: Project;
5
5
  rootDir: string;
6
6
  dirPath: string;
7
- paramCaseName: string;
7
+ kebabCaseName: string;
8
8
  camelCaseName: string;
9
9
  pascalCaseName: string;
10
10
  processorsDirPath: string;
@@ -18,7 +18,7 @@ export declare function getLatestDocumentModelSpec({ specifications, }: Document
18
18
  export declare function getDocumentModelSpecByVersionNumber({ specifications }: DocumentModelGlobalState, version: number): import("document-model").DocumentSpecification;
19
19
  export declare function getLatestDocumentModelSpecVersionNumber(documentModelState: DocumentModelGlobalState): number;
20
20
  export declare function getDocumentModelVariableNames(documentType: string): {
21
- paramCaseDocumentType: string;
21
+ kebabCaseDocumentType: string;
22
22
  pascalCaseDocumentType: string;
23
23
  camelCaseDocumentType: string;
24
24
  documentTypeVariableName: string;
@@ -1,4 +1,4 @@
1
- import { camelCase, paramCase, pascalCase } from "change-case";
1
+ import { camelCase, kebabCase, pascalCase } from "change-case";
2
2
  export function getEditorVariableNames({ documentModelDocumentTypeName, }) {
3
3
  return {
4
4
  documentModelDocumentTypeName,
@@ -17,7 +17,7 @@ export function getEditorVariableNames({ documentModelDocumentTypeName, }) {
17
17
  export function getDocumentModelDirName(documentModelState, existingDirName) {
18
18
  if (existingDirName)
19
19
  return existingDirName;
20
- return paramCase(documentModelState.name);
20
+ return kebabCase(documentModelState.name);
21
21
  }
22
22
  export function getLatestDocumentModelSpec({ specifications, }) {
23
23
  return specifications[specifications.length - 1];
@@ -39,7 +39,7 @@ export function getLatestDocumentModelSpecVersionNumber(documentModelState) {
39
39
  return getLatestDocumentModelSpec(documentModelState).version;
40
40
  }
41
41
  export function getDocumentModelVariableNames(documentType) {
42
- const paramCaseDocumentType = paramCase(documentType);
42
+ const kebabCaseDocumentType = kebabCase(documentType);
43
43
  const pascalCaseDocumentType = pascalCase(documentType);
44
44
  const camelCaseDocumentType = camelCase(documentType);
45
45
  const documentTypeVariableName = `${camelCaseDocumentType}DocumentType`;
@@ -63,7 +63,7 @@ export function getDocumentModelVariableNames(documentType) {
63
63
  const useInSelectedDriveHookName = `use${phDocumentTypeName}sInSelectedDrive`;
64
64
  const useInSelectedFolderHookName = `use${phDocumentTypeName}sInSelectedFolder`;
65
65
  return {
66
- paramCaseDocumentType,
66
+ kebabCaseDocumentType,
67
67
  pascalCaseDocumentType,
68
68
  camelCaseDocumentType,
69
69
  documentTypeVariableName,
@@ -1,4 +1,4 @@
1
- import { capitalCase, paramCase } from "change-case";
1
+ import { capitalCase, kebabCase } from "change-case";
2
2
  function groupHelpTopicsByCategory(helpTopics) {
3
3
  const helpTopicsByCategory = {};
4
4
  for (const helpTopic of helpTopics) {
@@ -15,7 +15,7 @@ function makeTableOfContents(commandsHelpInfo) {
15
15
  const commandNames = commandsHelpInfo.map(({ name }) => name);
16
16
  const tableOfContentsEntries = [];
17
17
  for (const name of commandNames) {
18
- tableOfContentsEntries.push(`- [${capitalCase(name)}](#${paramCase(name)})\n`);
18
+ tableOfContentsEntries.push(`- [${capitalCase(name)}](#${kebabCase(name)})\n`);
19
19
  }
20
20
  return tableOfContentsEntries.join("");
21
21
  }
@@ -1,9 +1,9 @@
1
1
  import { ts } from "@tmpl/core";
2
- import { paramCase, pascalCase } from "change-case";
2
+ import { kebabCase, pascalCase } from "change-case";
3
3
  function makeModuleActionsTypeImport(module, pascalCaseDocumentType) {
4
4
  const pascalCaseModuleName = pascalCase(module.name);
5
- const paramCaseModuleName = paramCase(module.name);
6
- return `import type { ${pascalCaseDocumentType}${pascalCaseModuleName}Action } from "./${paramCaseModuleName}/actions.js";`;
5
+ const kebabCaseModuleName = kebabCase(module.name);
6
+ return `import type { ${pascalCaseDocumentType}${pascalCaseModuleName}Action } from "./${kebabCaseModuleName}/actions.js";`;
7
7
  }
8
8
  function makeModuleActionsTypeImports(modules, pascalCaseDocumentType) {
9
9
  return modules
@@ -11,8 +11,8 @@ function makeModuleActionsTypeImports(modules, pascalCaseDocumentType) {
11
11
  .join("\n");
12
12
  }
13
13
  function makeModuleActionsTypeExport(module) {
14
- const paramCaseModuleName = paramCase(module.name);
15
- return `export * from "./${paramCaseModuleName}/actions.js";`;
14
+ const kebabCaseModuleName = kebabCase(module.name);
15
+ return `export * from "./${kebabCaseModuleName}/actions.js";`;
16
16
  }
17
17
  function makeModuleActionsTypeExports(modules) {
18
18
  return modules.map(makeModuleActionsTypeExport).join("\n");
@@ -1,10 +1,10 @@
1
1
  import { ts } from "@tmpl/core";
2
- import { camelCase, paramCase } from "change-case";
2
+ import { camelCase, kebabCase } from "change-case";
3
3
  function buildModuleCreatorsExport(module) {
4
- const paramCaseModuleName = paramCase(module.name);
4
+ const kebabCaseModuleName = kebabCase(module.name);
5
5
  const camelCaseModuleName = camelCase(module.name);
6
- const moduleCreatorsExport = `export * from "./${paramCaseModuleName}/creators.js";`;
7
- const moduleCreatorsNamespaceExport = `export * as ${camelCaseModuleName}Actions from "./${paramCaseModuleName}/creators.js";`;
6
+ const moduleCreatorsExport = `export * from "./${kebabCaseModuleName}/creators.js";`;
7
+ const moduleCreatorsNamespaceExport = `export * as ${camelCaseModuleName}Actions from "./${kebabCaseModuleName}/creators.js";`;
8
8
  return [moduleCreatorsExport, moduleCreatorsNamespaceExport];
9
9
  }
10
10
  function buildCreatorsExports(modules) {
@@ -1,7 +1,7 @@
1
1
  import { ts } from "@tmpl/core";
2
- import { paramCase } from "change-case";
2
+ import { kebabCase } from "change-case";
3
3
  function buildModuleOperationsExports(module) {
4
- const moduleDirName = paramCase(module.name);
4
+ const moduleDirName = kebabCase(module.name);
5
5
  return `export * from "./${moduleDirName}/operations.js";`;
6
6
  }
7
7
  function buildModulesOperationsExports(modules) {
@@ -1,5 +1,5 @@
1
1
  import { ts } from "@tmpl/core";
2
- import { camelCase, constantCase, paramCase, pascalCase } from "change-case";
2
+ import { camelCase, constantCase, kebabCase, pascalCase } from "change-case";
3
3
  function makePascalCaseOperationName(operation) {
4
4
  if (!operation.name) {
5
5
  throw new Error("Operation is missing name");
@@ -30,8 +30,8 @@ function makeOperationInputSchemaImports(modules) {
30
30
  }
31
31
  function makeModuleOperationsImport(module, camelCaseDocumentType) {
32
32
  const pascalCaseModuleName = pascalCase(module.name);
33
- const paramCaseModuleName = paramCase(module.name);
34
- return `import { ${camelCaseDocumentType}${pascalCaseModuleName}Operations } from "../src/reducers/${paramCaseModuleName}.js";`;
33
+ const kebabCaseModuleName = kebabCase(module.name);
34
+ return `import { ${camelCaseDocumentType}${pascalCaseModuleName}Operations } from "../src/reducers/${kebabCaseModuleName}.js";`;
35
35
  }
36
36
  function makeModulesOperationsImports(modules, camelCaseDocumentType) {
37
37
  return modules
@@ -1,10 +1,10 @@
1
1
  import { DeclarationManager, DirectoryManager, ImportManager, } from "@powerhousedao/codegen";
2
- import { camelCase, paramCase, pascalCase } from "change-case";
2
+ import { camelCase, kebabCase, pascalCase } from "change-case";
3
3
  import { Project } from "ts-morph";
4
4
  import { beforeEach, describe, expect, it } from "vitest";
5
5
  import { ReducerGenerator } from "../core/ReducerGenerator.js";
6
6
  function makeVariableAndTypeNamesFromContext(context) {
7
- const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
7
+ const typeImportPath = `${context.packageName}/document-models/${kebabCase(context.docModel.name)}`;
8
8
  const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
9
9
  const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
10
10
  return { typeImportPath, typeImportName, operationHandlersObjectName };
@@ -86,7 +86,7 @@ describe("ReducerGenerator Integration", () => {
86
86
  // Get the generated file
87
87
  const expectedPath = "/test/document-model/test-doc/src/reducers/test-module.ts";
88
88
  const sourceFile = project.getSourceFile(expectedPath);
89
- const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
89
+ const typeImportPath = `${context.packageName}/document-models/${kebabCase(context.docModel.name)}`;
90
90
  const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
91
91
  expect(sourceFile).toBeDefined();
92
92
  const content = sourceFile.getFullText();
@@ -196,7 +196,7 @@ describe("ReducerGenerator Integration", () => {
196
196
  const filePath = "/test/document-model/test-doc/src/reducers/first-module.ts";
197
197
  let sourceFile = project.getSourceFile(filePath);
198
198
  let content = sourceFile.getFullText();
199
- const typeImportPath = `${context.packageName}/document-models/${paramCase(context.docModel.name)}`;
199
+ const typeImportPath = `${context.packageName}/document-models/${kebabCase(context.docModel.name)}`;
200
200
  const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
201
201
  const operationHandlersObjectName = `${camelCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
202
202
  expect(content).toContain(`import type { ${typeImportName} } from "${typeImportPath}";`);
@@ -1,4 +1,4 @@
1
- import { camelCase, paramCase, pascalCase } from "change-case";
1
+ import { camelCase, kebabCase, pascalCase } from "change-case";
2
2
  import { SyntaxKind, VariableDeclarationKind } from "ts-morph";
3
3
  import { FileGenerator } from "./FileGenerator.js";
4
4
  export class ReducerGenerator extends FileGenerator {
@@ -11,7 +11,7 @@ export class ReducerGenerator extends FileGenerator {
11
11
  const packageName = context.packageName;
12
12
  // Reducer-specific import logic
13
13
  const typeImportName = `${pascalCase(context.docModel.name)}${pascalCase(context.module.name)}Operations`;
14
- const typeImportPath = `${packageName}/document-models/${paramCase(context.docModel.name)}`;
14
+ const typeImportPath = `${packageName}/document-models/${kebabCase(context.docModel.name)}`;
15
15
  // Import management (shared utility)
16
16
  this.importManager.replaceImportByName(sourceFile, typeImportName, typeImportPath, true);
17
17
  // AST logic (specific to reducers)
@@ -56,7 +56,7 @@ export class ReducerGenerator extends FileGenerator {
56
56
  });
57
57
  // Add imports for used errors (only if they're not already imported)
58
58
  if (usedErrors.size > 0) {
59
- const errorImportPath = `../../gen/${paramCase(context.module.name)}/error.js`;
59
+ const errorImportPath = `../../gen/${kebabCase(context.module.name)}/error.js`;
60
60
  const errorClassNames = Array.from(usedErrors);
61
61
  // Check if imports already exist to avoid duplicates
62
62
  const existingImports = sourceFile.getImportDeclarations();
@@ -1,5 +1,5 @@
1
- import type { Project, SourceFile } from "ts-morph";
2
1
  import type { PHProjectDirectories } from "@powerhousedao/codegen";
2
+ import type { Project, SourceFile } from "ts-morph";
3
3
  export declare class DirectoryManager {
4
4
  private directories;
5
5
  constructor(directories?: PHProjectDirectories);