@powerhousedao/codegen 6.0.0-dev.135 → 6.0.0-dev.137
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-DyZN9JYf.mjs → file-builders-DRzXbZTI.mjs} +183 -183
- package/dist/file-builders-DRzXbZTI.mjs.map +1 -0
- package/dist/{index-CPl7k91J.d.mts → index-CHAnPBj2.d.mts} +26 -26
- package/dist/index-CHAnPBj2.d.mts.map +1 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/src/file-builders/index.d.mts +2 -2
- package/dist/src/file-builders/index.mjs +3 -3
- package/dist/src/templates/index.d.mts +48 -48
- package/dist/src/templates/index.d.mts.map +1 -1
- package/dist/src/templates/index.mjs +2 -2
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/dist/src/utils/index.mjs.map +1 -1
- package/dist/{templates-CKdxigVj.mjs → templates-DBvz_qPL.mjs} +522 -522
- package/dist/templates-DBvz_qPL.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/file-builders-DyZN9JYf.mjs.map +0 -1
- package/dist/index-CPl7k91J.d.mts.map +0 -1
- package/dist/templates-CKdxigVj.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as documentModelHooksFileTemplate, Bt as appDriveContentsFileTemplate, D as documentModelSrcIndexFileTemplate, E as documentModelSrcUtilsTemplate, F as documentModelPhFactoriesFileTemplate, Ft as folderTreeFileTemplate, G as documentModelGenControllerFileTemplate, H as documentModelDocumentTypeTemplate, I as documentModelOperationsModuleOperationsFileTemplate, It as appFoldersFileTemplate, J as documentEditorModuleFileTemplate, K as documentModelGenActionsFileTemplate, L as documentModelOperationsModuleErrorFileTemplate, Lt as appFilesFileTemplate, M as documentModelGenTypesTemplate, Mt as appEditorFileTemplate, N as documentModelSchemaIndexTemplate, Nt as appConfigFileTemplate, O as documentModelModuleFileTemplate, P as documentModelGenReducerFileTemplate, Pt as driveExplorerNavigationBreadcrumbsFileTemplate, R as documentModelOperationsModuleCreatorsFileTemplate, Rt as emptyStateFileTemplate, S as makeActionImportNames, T as documentModelTestFileTemplate, U as documentModelDocumentSchemaFileTemplate, V as documentModelGenIndexFileTemplate, Vt as createDocumentFileTemplate, W as documentModelGenCreatorsFileTemplate, X as docsFromCliHelpTemplate, Y as documentEditorEditorFileTemplate, _ as analyticsFactoryTemplate, a as subgraphLibFileTemplate, b as upgradeManifestTemplate, c as relationalDbProcessorTemplate, d as relationalDbFactoryTemplate, g as analyticsIndexTemplate, h as analyticsProcessorTemplate, i as customSubgraphSchemaTemplate, j as documentModelGenUtilsTemplate, k as documentModelIndexTemplate, l as relationalDbMigrationsTemplate, lt as packageJsonTemplate, m as factoryBuildersTemplate, n as documentModelSubgraphSchemaTemplate, o as subgraphIndexFileTemplate, q as documentModelRootActionsFileTemplate, r as customSubgraphResolversTemplate, s as relationalDbSchemaTemplate, t as documentModelSubgraphResolversTemplate, u as relationalDbIndexTemplate, v as documentModelUtilsTemplate, w as makeTestCaseForAction, y as upgradeTransitionTemplate, z as documentModelOperationModuleActionsFileTemplate, zt as driveExplorerFileTemplate } from "./templates-DBvz_qPL.mjs";
|
|
2
2
|
import { getDocumentModelDirName, getDocumentModelOperationsModuleVariableNames, getDocumentModelVariableNames, getEditorVariableNames } from "./src/name-builders/index.mjs";
|
|
3
3
|
import { applyGraphQLTypePrefixes, buildObjectLiteral, buildTsMorphProject, ensureDirectoriesExist, extractTypeNames, formatSourceFileWithPrettier, getDocumentTypeMetadata, getInitialStates, getObjectLiteral, getOrCreateDirectory, getOrCreateSourceFile, getPreviousVersionSourceFile, getVariableDeclarationByTypeName } from "./src/utils/index.mjs";
|
|
4
4
|
import { VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, directoryExists, fileExists, makeVersionedDependencies } from "@powerhousedao/shared/clis";
|
|
@@ -311,47 +311,8 @@ const generateSchemas = async (inDir, { watch = false, skipFormat = false, write
|
|
|
311
311
|
}));
|
|
312
312
|
};
|
|
313
313
|
//#endregion
|
|
314
|
-
//#region src/file-builders/boilerplate/package.json.ts
|
|
315
|
-
async function buildBoilerplatePackageJson(args) {
|
|
316
|
-
const { name, tag, version, workspace } = args;
|
|
317
|
-
return packageJsonTemplate(name, await makeVersionedDependencies({
|
|
318
|
-
names: VERSIONED_DEPENDENCIES,
|
|
319
|
-
tag,
|
|
320
|
-
version
|
|
321
|
-
}), await makeVersionedDependencies({
|
|
322
|
-
names: VERSIONED_DEV_DEPENDENCIES,
|
|
323
|
-
tag,
|
|
324
|
-
version
|
|
325
|
-
}));
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/file-builders/clis/generate-cli-docs.ts
|
|
329
|
-
function getCommandHelpInfo(entry) {
|
|
330
|
-
return {
|
|
331
|
-
name: entry.name,
|
|
332
|
-
description: entry.command.description ?? "",
|
|
333
|
-
helpTopics: entry.command.helpTopics?.() ?? []
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function getCommandsHelpInfo(entries) {
|
|
337
|
-
return entries.map(getCommandHelpInfo);
|
|
338
|
-
}
|
|
339
|
-
function makeCliDocsFromHelp(args) {
|
|
340
|
-
const { cliDescription, docsIntroduction, docsTitle, entries } = args;
|
|
341
|
-
return stripVTControlCharacters(docsFromCliHelpTemplate({
|
|
342
|
-
cliDescription,
|
|
343
|
-
docsIntroduction,
|
|
344
|
-
docsTitle,
|
|
345
|
-
commandsHelpInfo: getCommandsHelpInfo(entries)
|
|
346
|
-
}));
|
|
347
|
-
}
|
|
348
|
-
async function writeCliDocsMarkdownFile(args) {
|
|
349
|
-
const { filePath, ...restArgs } = args;
|
|
350
|
-
await writeFile(filePath, makeCliDocsFromHelp(restArgs), { encoding: "utf-8" });
|
|
351
|
-
}
|
|
352
|
-
//#endregion
|
|
353
314
|
//#region src/file-builders/editor-common.ts
|
|
354
|
-
/** Generates the `module.ts` file for a document editor or
|
|
315
|
+
/** Generates the `module.ts` file for a document editor or app */
|
|
355
316
|
function makeEditorModuleFile({ project, editorDirPath, editorName, documentModelId, editorId, legacyMultipleDocumentTypes }) {
|
|
356
317
|
if (documentModelId && !!legacyMultipleDocumentTypes) throw new Error("Cannot specify both documentModelId and legacyMultipleDocumentTypes");
|
|
357
318
|
const { sourceFile } = getOrCreateSourceFile(project, path$1.join(editorDirPath, "module.ts"));
|
|
@@ -525,6 +486,185 @@ function makeUpgradeManifestsExport({ project, modulesDirPath, outputFilePath, v
|
|
|
525
486
|
(outputSourceFile.addVariableStatement(variableStatementInput).getDeclarations().at(0)?.getInitializerIfKind(SyntaxKind.ArrayLiteralExpression))?.addElements(manifests.map((m) => m.aliasedName), { useNewLines: true });
|
|
526
487
|
}
|
|
527
488
|
//#endregion
|
|
489
|
+
//#region src/file-builders/app.ts
|
|
490
|
+
/** Generates a app with the configs for `allowedDocumentModelIds` and `isDragAndDropEnabled` */
|
|
491
|
+
async function tsMorphGenerateApp({ projectDir, editorDir, editorName, editorId, allowedDocumentModelIds, isDragAndDropEnabled }) {
|
|
492
|
+
const documentModelsDirPath = path$1.join(projectDir, "document-models");
|
|
493
|
+
const documentModelsSourceFilesPath = path$1.join(documentModelsDirPath, "/**/*");
|
|
494
|
+
const editorsDirPath = path$1.join(projectDir, "editors");
|
|
495
|
+
const editorSourceFilesPath = path$1.join(editorsDirPath, "/**/*");
|
|
496
|
+
const editorDirPath = path$1.join(editorsDirPath, editorDir);
|
|
497
|
+
const editorComponentsDirPath = path$1.join(editorDirPath, "components");
|
|
498
|
+
const project = buildTsMorphProject(projectDir);
|
|
499
|
+
await ensureDirectoriesExist(project, documentModelsDirPath, editorsDirPath, editorDirPath, editorComponentsDirPath);
|
|
500
|
+
project.addSourceFilesAtPaths(documentModelsSourceFilesPath);
|
|
501
|
+
project.addSourceFilesAtPaths(editorSourceFilesPath);
|
|
502
|
+
await makeNavigationBreadcrumbsFile({
|
|
503
|
+
project,
|
|
504
|
+
editorComponentsDirPath
|
|
505
|
+
});
|
|
506
|
+
await makeCreateDocumentFile({
|
|
507
|
+
project,
|
|
508
|
+
editorComponentsDirPath
|
|
509
|
+
});
|
|
510
|
+
await makeEmptyStateFile({
|
|
511
|
+
project,
|
|
512
|
+
editorComponentsDirPath
|
|
513
|
+
});
|
|
514
|
+
await makeFoldersFile({
|
|
515
|
+
project,
|
|
516
|
+
editorComponentsDirPath
|
|
517
|
+
});
|
|
518
|
+
await makeFolderTreeFile({
|
|
519
|
+
project,
|
|
520
|
+
editorComponentsDirPath
|
|
521
|
+
});
|
|
522
|
+
await makeFilesFile({
|
|
523
|
+
project,
|
|
524
|
+
editorComponentsDirPath
|
|
525
|
+
});
|
|
526
|
+
await makeDriveExplorerFile({
|
|
527
|
+
project,
|
|
528
|
+
editorComponentsDirPath
|
|
529
|
+
});
|
|
530
|
+
await makeDriveContentsFile({
|
|
531
|
+
project,
|
|
532
|
+
editorComponentsDirPath
|
|
533
|
+
});
|
|
534
|
+
await makeAppComponent({
|
|
535
|
+
project,
|
|
536
|
+
editorDirPath
|
|
537
|
+
});
|
|
538
|
+
await makeAppConfigFile({
|
|
539
|
+
project,
|
|
540
|
+
allowedDocumentModelIds,
|
|
541
|
+
isDragAndDropEnabled,
|
|
542
|
+
editorDirPath
|
|
543
|
+
});
|
|
544
|
+
makeEditorModuleFile({
|
|
545
|
+
project,
|
|
546
|
+
editorName,
|
|
547
|
+
editorId,
|
|
548
|
+
editorDirPath,
|
|
549
|
+
documentModelId: "powerhouse/document-drive"
|
|
550
|
+
});
|
|
551
|
+
await makeEditorsModulesFile(project, projectDir);
|
|
552
|
+
await project.save();
|
|
553
|
+
}
|
|
554
|
+
async function makeAppComponent({ project, editorDirPath }) {
|
|
555
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorDirPath, "editor.tsx"));
|
|
556
|
+
if (alreadyExists) {
|
|
557
|
+
const editorFunction = sourceFile.getFunction("Editor");
|
|
558
|
+
if (editorFunction) {
|
|
559
|
+
if (!editorFunction.isDefaultExport()) editorFunction.setIsDefaultExport(true);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const template = appEditorFileTemplate();
|
|
564
|
+
sourceFile.replaceWithText(template);
|
|
565
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
566
|
+
}
|
|
567
|
+
async function makeAppConfigFile({ project, editorDirPath, allowedDocumentModelIds, isDragAndDropEnabled }) {
|
|
568
|
+
const { sourceFile } = getOrCreateSourceFile(project, path$1.join(editorDirPath, "config.ts"));
|
|
569
|
+
const allowedDocumentTypesString = JSON.stringify(allowedDocumentModelIds);
|
|
570
|
+
const template = appConfigFileTemplate({
|
|
571
|
+
isDragAndDropEnabledString: isDragAndDropEnabled ? "true" : "false",
|
|
572
|
+
allowedDocumentTypesString
|
|
573
|
+
});
|
|
574
|
+
sourceFile.replaceWithText(template);
|
|
575
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
576
|
+
}
|
|
577
|
+
async function makeDriveContentsFile({ project, editorComponentsDirPath }) {
|
|
578
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "DriveContents.tsx"));
|
|
579
|
+
if (alreadyExists) return;
|
|
580
|
+
const template = appDriveContentsFileTemplate();
|
|
581
|
+
sourceFile.replaceWithText(template);
|
|
582
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
583
|
+
}
|
|
584
|
+
async function makeNavigationBreadcrumbsFile({ project, editorComponentsDirPath }) {
|
|
585
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "NavigationBreadcrumbs.tsx"));
|
|
586
|
+
if (alreadyExists) return;
|
|
587
|
+
sourceFile.replaceWithText(driveExplorerNavigationBreadcrumbsFileTemplate());
|
|
588
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
589
|
+
}
|
|
590
|
+
async function makeFoldersFile({ project, editorComponentsDirPath }) {
|
|
591
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "Folders.tsx"));
|
|
592
|
+
if (alreadyExists) return;
|
|
593
|
+
const template = appFoldersFileTemplate();
|
|
594
|
+
sourceFile.replaceWithText(template);
|
|
595
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
596
|
+
}
|
|
597
|
+
async function makeFilesFile({ project, editorComponentsDirPath }) {
|
|
598
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "Files.tsx"));
|
|
599
|
+
if (alreadyExists) return;
|
|
600
|
+
const template = appFilesFileTemplate();
|
|
601
|
+
sourceFile.replaceWithText(template);
|
|
602
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
603
|
+
}
|
|
604
|
+
async function makeDriveExplorerFile({ project, editorComponentsDirPath }) {
|
|
605
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "DriveExplorer.tsx"));
|
|
606
|
+
if (alreadyExists) return;
|
|
607
|
+
sourceFile.replaceWithText(driveExplorerFileTemplate);
|
|
608
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
609
|
+
}
|
|
610
|
+
async function makeFolderTreeFile({ project, editorComponentsDirPath }) {
|
|
611
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "FolderTree.tsx"));
|
|
612
|
+
if (alreadyExists) return;
|
|
613
|
+
sourceFile.replaceWithText(folderTreeFileTemplate);
|
|
614
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
615
|
+
}
|
|
616
|
+
async function makeEmptyStateFile({ project, editorComponentsDirPath }) {
|
|
617
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "EmptyState.tsx"));
|
|
618
|
+
if (alreadyExists) return;
|
|
619
|
+
sourceFile.replaceWithText(emptyStateFileTemplate);
|
|
620
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
621
|
+
}
|
|
622
|
+
async function makeCreateDocumentFile({ project, editorComponentsDirPath }) {
|
|
623
|
+
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "CreateDocument.tsx"));
|
|
624
|
+
if (alreadyExists) return;
|
|
625
|
+
sourceFile.replaceWithText(createDocumentFileTemplate);
|
|
626
|
+
await formatSourceFileWithPrettier(sourceFile);
|
|
627
|
+
}
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/file-builders/boilerplate/package.json.ts
|
|
630
|
+
async function buildBoilerplatePackageJson(args) {
|
|
631
|
+
const { name, tag, version, workspace } = args;
|
|
632
|
+
return packageJsonTemplate(name, await makeVersionedDependencies({
|
|
633
|
+
names: VERSIONED_DEPENDENCIES,
|
|
634
|
+
tag,
|
|
635
|
+
version
|
|
636
|
+
}), await makeVersionedDependencies({
|
|
637
|
+
names: VERSIONED_DEV_DEPENDENCIES,
|
|
638
|
+
tag,
|
|
639
|
+
version
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/file-builders/clis/generate-cli-docs.ts
|
|
644
|
+
function getCommandHelpInfo(entry) {
|
|
645
|
+
return {
|
|
646
|
+
name: entry.name,
|
|
647
|
+
description: entry.command.description ?? "",
|
|
648
|
+
helpTopics: entry.command.helpTopics?.() ?? []
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function getCommandsHelpInfo(entries) {
|
|
652
|
+
return entries.map(getCommandHelpInfo);
|
|
653
|
+
}
|
|
654
|
+
function makeCliDocsFromHelp(args) {
|
|
655
|
+
const { cliDescription, docsIntroduction, docsTitle, entries } = args;
|
|
656
|
+
return stripVTControlCharacters(docsFromCliHelpTemplate({
|
|
657
|
+
cliDescription,
|
|
658
|
+
docsIntroduction,
|
|
659
|
+
docsTitle,
|
|
660
|
+
commandsHelpInfo: getCommandsHelpInfo(entries)
|
|
661
|
+
}));
|
|
662
|
+
}
|
|
663
|
+
async function writeCliDocsMarkdownFile(args) {
|
|
664
|
+
const { filePath, ...restArgs } = args;
|
|
665
|
+
await writeFile(filePath, makeCliDocsFromHelp(restArgs), { encoding: "utf-8" });
|
|
666
|
+
}
|
|
667
|
+
//#endregion
|
|
528
668
|
//#region src/file-builders/document-editor.ts
|
|
529
669
|
/** Generates a document editor for the given `documentModelId` (also called `documentType`) */
|
|
530
670
|
async function tsMorphGenerateDocumentEditor({ projectDir, editorDir, editorName, editorId, documentModelId }) {
|
|
@@ -1394,146 +1534,6 @@ async function persistCustomFilesFromPreviousVersion(args) {
|
|
|
1394
1534
|
}
|
|
1395
1535
|
}
|
|
1396
1536
|
//#endregion
|
|
1397
|
-
//#region src/file-builders/drive-editor.ts
|
|
1398
|
-
/** Generates a drive editor with the configs for `allowedDocumentModelIds` and `isDragAndDropEnabled` */
|
|
1399
|
-
async function tsMorphGenerateDriveEditor({ projectDir, editorDir, editorName, editorId, allowedDocumentModelIds, isDragAndDropEnabled }) {
|
|
1400
|
-
const documentModelsDirPath = path$1.join(projectDir, "document-models");
|
|
1401
|
-
const documentModelsSourceFilesPath = path$1.join(documentModelsDirPath, "/**/*");
|
|
1402
|
-
const editorsDirPath = path$1.join(projectDir, "editors");
|
|
1403
|
-
const editorSourceFilesPath = path$1.join(editorsDirPath, "/**/*");
|
|
1404
|
-
const editorDirPath = path$1.join(editorsDirPath, editorDir);
|
|
1405
|
-
const editorComponentsDirPath = path$1.join(editorDirPath, "components");
|
|
1406
|
-
const project = buildTsMorphProject(projectDir);
|
|
1407
|
-
await ensureDirectoriesExist(project, documentModelsDirPath, editorsDirPath, editorDirPath, editorComponentsDirPath);
|
|
1408
|
-
project.addSourceFilesAtPaths(documentModelsSourceFilesPath);
|
|
1409
|
-
project.addSourceFilesAtPaths(editorSourceFilesPath);
|
|
1410
|
-
await makeNavigationBreadcrumbsFile({
|
|
1411
|
-
project,
|
|
1412
|
-
editorComponentsDirPath
|
|
1413
|
-
});
|
|
1414
|
-
await makeCreateDocumentFile({
|
|
1415
|
-
project,
|
|
1416
|
-
editorComponentsDirPath
|
|
1417
|
-
});
|
|
1418
|
-
await makeEmptyStateFile({
|
|
1419
|
-
project,
|
|
1420
|
-
editorComponentsDirPath
|
|
1421
|
-
});
|
|
1422
|
-
await makeFoldersFile({
|
|
1423
|
-
project,
|
|
1424
|
-
editorComponentsDirPath
|
|
1425
|
-
});
|
|
1426
|
-
await makeFolderTreeFile({
|
|
1427
|
-
project,
|
|
1428
|
-
editorComponentsDirPath
|
|
1429
|
-
});
|
|
1430
|
-
await makeFilesFile({
|
|
1431
|
-
project,
|
|
1432
|
-
editorComponentsDirPath
|
|
1433
|
-
});
|
|
1434
|
-
await makeDriveExplorerFile({
|
|
1435
|
-
project,
|
|
1436
|
-
editorComponentsDirPath
|
|
1437
|
-
});
|
|
1438
|
-
await makeDriveContentsFile({
|
|
1439
|
-
project,
|
|
1440
|
-
editorComponentsDirPath
|
|
1441
|
-
});
|
|
1442
|
-
await makeDriveEditorComponent({
|
|
1443
|
-
project,
|
|
1444
|
-
editorDirPath
|
|
1445
|
-
});
|
|
1446
|
-
await makeDriveEditorConfigFile({
|
|
1447
|
-
project,
|
|
1448
|
-
allowedDocumentModelIds,
|
|
1449
|
-
isDragAndDropEnabled,
|
|
1450
|
-
editorDirPath
|
|
1451
|
-
});
|
|
1452
|
-
makeEditorModuleFile({
|
|
1453
|
-
project,
|
|
1454
|
-
editorName,
|
|
1455
|
-
editorId,
|
|
1456
|
-
editorDirPath,
|
|
1457
|
-
documentModelId: "powerhouse/document-drive"
|
|
1458
|
-
});
|
|
1459
|
-
await makeEditorsModulesFile(project, projectDir);
|
|
1460
|
-
await project.save();
|
|
1461
|
-
}
|
|
1462
|
-
async function makeDriveEditorComponent({ project, editorDirPath }) {
|
|
1463
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorDirPath, "editor.tsx"));
|
|
1464
|
-
if (alreadyExists) {
|
|
1465
|
-
const editorFunction = sourceFile.getFunction("Editor");
|
|
1466
|
-
if (editorFunction) {
|
|
1467
|
-
if (!editorFunction.isDefaultExport()) editorFunction.setIsDefaultExport(true);
|
|
1468
|
-
return;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
const template = driveEditorEditorFileTemplate();
|
|
1472
|
-
sourceFile.replaceWithText(template);
|
|
1473
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1474
|
-
}
|
|
1475
|
-
async function makeDriveEditorConfigFile({ project, editorDirPath, allowedDocumentModelIds, isDragAndDropEnabled }) {
|
|
1476
|
-
const { sourceFile } = getOrCreateSourceFile(project, path$1.join(editorDirPath, "config.ts"));
|
|
1477
|
-
const allowedDocumentTypesString = JSON.stringify(allowedDocumentModelIds);
|
|
1478
|
-
const template = driveEditorConfigFileTemplate({
|
|
1479
|
-
isDragAndDropEnabledString: isDragAndDropEnabled ? "true" : "false",
|
|
1480
|
-
allowedDocumentTypesString
|
|
1481
|
-
});
|
|
1482
|
-
sourceFile.replaceWithText(template);
|
|
1483
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1484
|
-
}
|
|
1485
|
-
async function makeDriveContentsFile({ project, editorComponentsDirPath }) {
|
|
1486
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "DriveContents.tsx"));
|
|
1487
|
-
if (alreadyExists) return;
|
|
1488
|
-
const template = driveEditorDriveContentsFileTemplate();
|
|
1489
|
-
sourceFile.replaceWithText(template);
|
|
1490
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1491
|
-
}
|
|
1492
|
-
async function makeNavigationBreadcrumbsFile({ project, editorComponentsDirPath }) {
|
|
1493
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "NavigationBreadcrumbs.tsx"));
|
|
1494
|
-
if (alreadyExists) return;
|
|
1495
|
-
sourceFile.replaceWithText(driveExplorerNavigationBreadcrumbsFileTemplate());
|
|
1496
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1497
|
-
}
|
|
1498
|
-
async function makeFoldersFile({ project, editorComponentsDirPath }) {
|
|
1499
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "Folders.tsx"));
|
|
1500
|
-
if (alreadyExists) return;
|
|
1501
|
-
const template = driveEditorFoldersFileTemplate();
|
|
1502
|
-
sourceFile.replaceWithText(template);
|
|
1503
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1504
|
-
}
|
|
1505
|
-
async function makeFilesFile({ project, editorComponentsDirPath }) {
|
|
1506
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "Files.tsx"));
|
|
1507
|
-
if (alreadyExists) return;
|
|
1508
|
-
const template = driveEditorFilesFileTemplate();
|
|
1509
|
-
sourceFile.replaceWithText(template);
|
|
1510
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1511
|
-
}
|
|
1512
|
-
async function makeDriveExplorerFile({ project, editorComponentsDirPath }) {
|
|
1513
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "DriveExplorer.tsx"));
|
|
1514
|
-
if (alreadyExists) return;
|
|
1515
|
-
sourceFile.replaceWithText(driveExplorerFileTemplate);
|
|
1516
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1517
|
-
}
|
|
1518
|
-
async function makeFolderTreeFile({ project, editorComponentsDirPath }) {
|
|
1519
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "FolderTree.tsx"));
|
|
1520
|
-
if (alreadyExists) return;
|
|
1521
|
-
sourceFile.replaceWithText(folderTreeFileTemplate);
|
|
1522
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1523
|
-
}
|
|
1524
|
-
async function makeEmptyStateFile({ project, editorComponentsDirPath }) {
|
|
1525
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "EmptyState.tsx"));
|
|
1526
|
-
if (alreadyExists) return;
|
|
1527
|
-
sourceFile.replaceWithText(emptyStateFileTemplate);
|
|
1528
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1529
|
-
}
|
|
1530
|
-
async function makeCreateDocumentFile({ project, editorComponentsDirPath }) {
|
|
1531
|
-
const { alreadyExists, sourceFile } = getOrCreateSourceFile(project, path$1.join(editorComponentsDirPath, "CreateDocument.tsx"));
|
|
1532
|
-
if (alreadyExists) return;
|
|
1533
|
-
sourceFile.replaceWithText(createDocumentFileTemplate);
|
|
1534
|
-
await formatSourceFileWithPrettier(sourceFile);
|
|
1535
|
-
}
|
|
1536
|
-
//#endregion
|
|
1537
1537
|
//#region src/file-builders/subgraph.ts
|
|
1538
1538
|
async function tsMorphGenerateSubgraph(args) {
|
|
1539
1539
|
const { subgraphsDir, subgraphName, documentModel } = args;
|
|
@@ -1648,6 +1648,6 @@ async function makeSubgraphsIndexFile({ projectDir }) {
|
|
|
1648
1648
|
await project.save();
|
|
1649
1649
|
}
|
|
1650
1650
|
//#endregion
|
|
1651
|
-
export { tsMorphGenerateProcessor as C, scalarsValidation as S,
|
|
1651
|
+
export { tsMorphGenerateProcessor as C, scalarsValidation as S, makeEditorModuleFile as _, getCommandHelpInfo as a, generateTypesAndZodSchemasFromGraphql as b, writeCliDocsMarkdownFile as c, makeDocumentModelModulesFile as d, makeEditorsModulesFile as f, makeLegacyIndexFile as g, makeUpgradeManifestsFile as h, tsMorphGenerateDocumentEditor as i, buildBoilerplatePackageJson as l, makeUpgradeManifestsExport as m, tsMorphGenerateSubgraph as n, getCommandsHelpInfo as o, makeModulesFile as p, tsMorphGenerateDocumentModel as r, makeCliDocsFromHelp as s, makeSubgraphsIndexFile as t, tsMorphGenerateApp as u, generateDocumentModelZodSchemas as v, scalars as x, generateSchemas as y };
|
|
1652
1652
|
|
|
1653
|
-
//# sourceMappingURL=file-builders-
|
|
1653
|
+
//# sourceMappingURL=file-builders-DRzXbZTI.mjs.map
|