@baseplate-dev/project-builder-server 0.3.3 → 0.3.4
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/actions/diff/diff-project.action.d.ts +73 -0
- package/dist/actions/diff/diff-project.action.d.ts.map +1 -0
- package/dist/actions/diff/diff-project.action.js +103 -0
- package/dist/actions/diff/diff-project.action.js.map +1 -0
- package/dist/actions/diff/index.d.ts +2 -0
- package/dist/actions/diff/index.d.ts.map +1 -0
- package/dist/actions/diff/index.js +2 -0
- package/dist/actions/diff/index.js.map +1 -0
- package/dist/actions/index.d.ts +7 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +7 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/registry.d.ts +270 -0
- package/dist/actions/registry.d.ts.map +1 -0
- package/dist/actions/registry.js +23 -0
- package/dist/actions/registry.js.map +1 -0
- package/dist/actions/snapshot/index.d.ts +5 -0
- package/dist/actions/snapshot/index.d.ts.map +1 -0
- package/dist/actions/snapshot/index.js +5 -0
- package/dist/actions/snapshot/index.js.map +1 -0
- package/dist/actions/snapshot/snapshot-add.action.d.ts +16 -0
- package/dist/actions/snapshot/snapshot-add.action.d.ts.map +1 -0
- package/dist/actions/snapshot/snapshot-add.action.js +80 -0
- package/dist/actions/snapshot/snapshot-add.action.js.map +1 -0
- package/dist/actions/snapshot/snapshot-remove.action.d.ts +15 -0
- package/dist/actions/snapshot/snapshot-remove.action.d.ts.map +1 -0
- package/dist/actions/snapshot/snapshot-remove.action.js +75 -0
- package/dist/actions/snapshot/snapshot-remove.action.js.map +1 -0
- package/dist/actions/snapshot/snapshot-save.action.d.ts +15 -0
- package/dist/actions/snapshot/snapshot-save.action.d.ts.map +1 -0
- package/dist/actions/snapshot/snapshot-save.action.js +82 -0
- package/dist/actions/snapshot/snapshot-save.action.js.map +1 -0
- package/dist/actions/snapshot/snapshot-show.action.d.ts +43 -0
- package/dist/actions/snapshot/snapshot-show.action.d.ts.map +1 -0
- package/dist/actions/snapshot/snapshot-show.action.js +136 -0
- package/dist/actions/snapshot/snapshot-show.action.js.map +1 -0
- package/dist/actions/sync/index.d.ts +2 -0
- package/dist/actions/sync/index.d.ts.map +1 -0
- package/dist/actions/sync/index.js +2 -0
- package/dist/actions/sync/index.js.map +1 -0
- package/dist/actions/sync/sync-project.action.d.ts +14 -0
- package/dist/actions/sync/sync-project.action.d.ts.map +1 -0
- package/dist/actions/sync/sync-project.action.js +94 -0
- package/dist/actions/sync/sync-project.action.js.map +1 -0
- package/dist/actions/template-extractor/discover-generators.action.d.ts +49 -0
- package/dist/actions/template-extractor/discover-generators.action.d.ts.map +1 -0
- package/dist/actions/template-extractor/discover-generators.action.js +57 -0
- package/dist/actions/template-extractor/discover-generators.action.js.map +1 -0
- package/dist/actions/template-extractor/extract-templates.action.d.ts +14 -0
- package/dist/actions/template-extractor/extract-templates.action.d.ts.map +1 -0
- package/dist/actions/template-extractor/extract-templates.action.js +60 -0
- package/dist/actions/template-extractor/extract-templates.action.js.map +1 -0
- package/dist/actions/template-extractor/generate-templates.action.d.ts +12 -0
- package/dist/actions/template-extractor/generate-templates.action.d.ts.map +1 -0
- package/dist/actions/template-extractor/generate-templates.action.js +58 -0
- package/dist/actions/template-extractor/generate-templates.action.js.map +1 -0
- package/dist/actions/template-extractor/index.d.ts +4 -0
- package/dist/actions/template-extractor/index.d.ts.map +1 -0
- package/dist/actions/template-extractor/index.js +4 -0
- package/dist/actions/template-extractor/index.js.map +1 -0
- package/dist/actions/templates/configure-raw-template.action.d.ts +16 -0
- package/dist/actions/templates/configure-raw-template.action.d.ts.map +1 -0
- package/dist/actions/templates/configure-raw-template.action.js +50 -0
- package/dist/actions/templates/configure-raw-template.action.js.map +1 -0
- package/dist/actions/templates/configure-text-template.action.d.ts +27 -0
- package/dist/actions/templates/configure-text-template.action.d.ts.map +1 -0
- package/dist/actions/templates/configure-text-template.action.js +64 -0
- package/dist/actions/templates/configure-text-template.action.js.map +1 -0
- package/dist/actions/templates/configure-ts-template.action.d.ts +18 -0
- package/dist/actions/templates/configure-ts-template.action.d.ts.map +1 -0
- package/dist/actions/templates/configure-ts-template.action.js +58 -0
- package/dist/actions/templates/configure-ts-template.action.js.map +1 -0
- package/dist/actions/templates/delete-template.action.d.ts +15 -0
- package/dist/actions/templates/delete-template.action.d.ts.map +1 -0
- package/dist/actions/templates/delete-template.action.js +49 -0
- package/dist/actions/templates/delete-template.action.js.map +1 -0
- package/dist/actions/templates/index.d.ts +7 -0
- package/dist/actions/templates/index.d.ts.map +1 -0
- package/dist/actions/templates/index.js +7 -0
- package/dist/actions/templates/index.js.map +1 -0
- package/dist/actions/templates/list-templates.action.d.ts +35 -0
- package/dist/actions/templates/list-templates.action.d.ts.map +1 -0
- package/dist/actions/templates/list-templates.action.js +63 -0
- package/dist/actions/templates/list-templates.action.js.map +1 -0
- package/dist/actions/templates/show-template-metadata.action.d.ts +17 -0
- package/dist/actions/templates/show-template-metadata.action.d.ts.map +1 -0
- package/dist/actions/templates/show-template-metadata.action.js +57 -0
- package/dist/actions/templates/show-template-metadata.action.js.map +1 -0
- package/dist/actions/types.d.ts +60 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +9 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/actions/utils/cli.d.ts +12 -0
- package/dist/actions/utils/cli.d.ts.map +1 -0
- package/dist/actions/utils/cli.js +14 -0
- package/dist/actions/utils/cli.js.map +1 -0
- package/dist/actions/utils/index.d.ts +6 -0
- package/dist/actions/utils/index.d.ts.map +1 -0
- package/dist/actions/utils/index.js +6 -0
- package/dist/actions/utils/index.js.map +1 -0
- package/dist/actions/utils/project-discovery.d.ts +22 -0
- package/dist/actions/utils/project-discovery.d.ts.map +1 -0
- package/dist/actions/utils/project-discovery.js +78 -0
- package/dist/actions/utils/project-discovery.js.map +1 -0
- package/dist/actions/utils/project-id.d.ts +7 -0
- package/dist/actions/utils/project-id.d.ts.map +1 -0
- package/dist/actions/utils/project-id.js +15 -0
- package/dist/actions/utils/project-id.js.map +1 -0
- package/dist/actions/utils/projects.d.ts +9 -0
- package/dist/actions/utils/projects.d.ts.map +1 -0
- package/dist/actions/utils/projects.js +16 -0
- package/dist/actions/utils/projects.js.map +1 -0
- package/dist/actions/utils/run-in-worker.d.ts +13 -0
- package/dist/actions/utils/run-in-worker.d.ts.map +1 -0
- package/dist/actions/utils/run-in-worker.js +78 -0
- package/dist/actions/utils/run-in-worker.js.map +1 -0
- package/dist/actions/utils/trpc.d.ts +16 -0
- package/dist/actions/utils/trpc.d.ts.map +1 -0
- package/dist/actions/utils/trpc.js +19 -0
- package/dist/actions/utils/trpc.js.map +1 -0
- package/dist/actions/utils/worker-script.d.ts +28 -0
- package/dist/actions/utils/worker-script.d.ts.map +1 -0
- package/dist/actions/utils/worker-script.js +55 -0
- package/dist/actions/utils/worker-script.js.map +1 -0
- package/dist/api/context.d.ts.map +1 -1
- package/dist/api/trpc.d.ts.map +1 -1
- package/dist/constants/server.d.ts +1 -1
- package/dist/constants/server.js +1 -1
- package/dist/dev-server/api/router.d.ts +325 -0
- package/dist/dev-server/api/router.d.ts.map +1 -0
- package/dist/dev-server/api/router.js +40 -0
- package/dist/dev-server/api/router.js.map +1 -0
- package/dist/dev-server/api/trpc.d.ts +20 -0
- package/dist/dev-server/api/trpc.d.ts.map +1 -0
- package/dist/dev-server/api/trpc.js +18 -0
- package/dist/dev-server/api/trpc.js.map +1 -0
- package/dist/dev-server/auth-plugin.d.ts +6 -0
- package/dist/dev-server/auth-plugin.d.ts.map +1 -0
- package/dist/dev-server/auth-plugin.js +43 -0
- package/dist/dev-server/auth-plugin.js.map +1 -0
- package/dist/dev-server/get-or-create-config.d.ts +18 -0
- package/dist/dev-server/get-or-create-config.d.ts.map +1 -0
- package/dist/dev-server/get-or-create-config.js +76 -0
- package/dist/dev-server/get-or-create-config.js.map +1 -0
- package/dist/dev-server/index.d.ts +4 -0
- package/dist/dev-server/index.d.ts.map +1 -0
- package/dist/dev-server/index.js +3 -0
- package/dist/dev-server/index.js.map +1 -0
- package/dist/dev-server/mcp/fastify.d.ts +8 -0
- package/dist/dev-server/mcp/fastify.d.ts.map +1 -0
- package/dist/dev-server/mcp/fastify.js +80 -0
- package/dist/dev-server/mcp/fastify.js.map +1 -0
- package/dist/dev-server/mcp/server.d.ts +15 -0
- package/dist/dev-server/mcp/server.d.ts.map +1 -0
- package/dist/dev-server/mcp/server.js +120 -0
- package/dist/dev-server/mcp/server.js.map +1 -0
- package/dist/dev-server/mcp/stdio.d.ts +4 -0
- package/dist/dev-server/mcp/stdio.d.ts.map +1 -0
- package/dist/dev-server/mcp/stdio.js +15 -0
- package/dist/dev-server/mcp/stdio.js.map +1 -0
- package/dist/dev-server/server.d.ts +18 -0
- package/dist/dev-server/server.d.ts.map +1 -0
- package/dist/dev-server/server.js +91 -0
- package/dist/dev-server/server.js.map +1 -0
- package/dist/diff/diff-project.d.ts +37 -20
- package/dist/diff/diff-project.d.ts.map +1 -1
- package/dist/diff/diff-project.js +89 -79
- package/dist/diff/diff-project.js.map +1 -1
- package/dist/fastify-plugins/graceful-shutdown.d.ts.map +1 -0
- package/dist/fastify-plugins/graceful-shutdown.js.map +1 -0
- package/dist/server/builder-service-manager.d.ts +9 -8
- package/dist/server/builder-service-manager.d.ts.map +1 -1
- package/dist/server/builder-service-manager.js +4 -10
- package/dist/server/builder-service-manager.js.map +1 -1
- package/dist/server/server.js +1 -1
- package/dist/server/server.js.map +1 -1
- package/dist/service/builder-service.d.ts +3 -4
- package/dist/service/builder-service.d.ts.map +1 -1
- package/dist/service/builder-service.js +7 -3
- package/dist/service/builder-service.js.map +1 -1
- package/dist/template-extractor/discover-generators.d.ts.map +1 -1
- package/dist/template-extractor/discover-generators.js +1 -1
- package/dist/template-extractor/discover-generators.js.map +1 -1
- package/dist/templates/configure/configure-raw-template.d.ts +13 -0
- package/dist/templates/configure/configure-raw-template.d.ts.map +1 -0
- package/dist/templates/configure/configure-raw-template.js +26 -0
- package/dist/templates/configure/configure-raw-template.js.map +1 -0
- package/dist/templates/configure/configure-text-template.d.ts +18 -0
- package/dist/templates/configure/configure-text-template.d.ts.map +1 -0
- package/dist/templates/configure/configure-text-template.js +48 -0
- package/dist/templates/configure/configure-text-template.js.map +1 -0
- package/dist/templates/configure/configure-ts-template.d.ts +15 -0
- package/dist/templates/configure/configure-ts-template.d.ts.map +1 -0
- package/dist/templates/configure/configure-ts-template.js +44 -0
- package/dist/templates/configure/configure-ts-template.js.map +1 -0
- package/dist/templates/configure/index.d.ts +5 -0
- package/dist/templates/configure/index.d.ts.map +1 -0
- package/dist/templates/configure/index.js +4 -0
- package/dist/templates/configure/index.js.map +1 -0
- package/dist/templates/configure/types.d.ts +7 -0
- package/dist/templates/configure/types.d.ts.map +1 -0
- package/dist/templates/configure/types.js +2 -0
- package/dist/templates/configure/types.js.map +1 -0
- package/dist/templates/delete/delete-template.d.ts +16 -0
- package/dist/templates/delete/delete-template.d.ts.map +1 -0
- package/dist/templates/delete/delete-template.js +45 -0
- package/dist/templates/delete/delete-template.js.map +1 -0
- package/dist/templates/list/list-templates.d.ts +22 -0
- package/dist/templates/list/list-templates.d.ts.map +1 -0
- package/dist/templates/list/list-templates.js +29 -0
- package/dist/templates/list/list-templates.js.map +1 -0
- package/dist/templates/show/show-template-metadata.d.ts +19 -0
- package/dist/templates/show/show-template-metadata.d.ts.map +1 -0
- package/dist/templates/show/show-template-metadata.js +37 -0
- package/dist/templates/show/show-template-metadata.js.map +1 -0
- package/dist/templates/utils/extractor-config.d.ts +18 -0
- package/dist/templates/utils/extractor-config.d.ts.map +1 -0
- package/dist/templates/utils/extractor-config.js +55 -0
- package/dist/templates/utils/extractor-config.js.map +1 -0
- package/dist/templates/utils/infer-exports-from-ts-file.d.ts +10 -0
- package/dist/templates/utils/infer-exports-from-ts-file.d.ts.map +1 -0
- package/dist/templates/utils/infer-exports-from-ts-file.js +87 -0
- package/dist/templates/utils/infer-exports-from-ts-file.js.map +1 -0
- package/dist/templates/utils/resolve-file-path.d.ts +15 -0
- package/dist/templates/utils/resolve-file-path.d.ts.map +1 -0
- package/dist/templates/utils/resolve-file-path.js +48 -0
- package/dist/templates/utils/resolve-file-path.js.map +1 -0
- package/dist/templates/utils/resolve-generator.d.ts +8 -0
- package/dist/templates/utils/resolve-generator.d.ts.map +1 -0
- package/dist/templates/utils/resolve-generator.js +26 -0
- package/dist/templates/utils/resolve-generator.js.map +1 -0
- package/dist/templates/utils/template-metadata.d.ts +14 -0
- package/dist/templates/utils/template-metadata.d.ts.map +1 -0
- package/dist/templates/utils/template-metadata.js +54 -0
- package/dist/templates/utils/template-metadata.js.map +1 -0
- package/package.json +17 -12
- package/dist/server/graceful-shutdown.d.ts.map +0 -1
- package/dist/server/graceful-shutdown.js.map +0 -1
- /package/dist/{server → fastify-plugins}/graceful-shutdown.d.ts +0 -0
- /package/dist/{server → fastify-plugins}/graceful-shutdown.js +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { mapValues } from 'es-toolkit';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { updateExtractorTemplate } from '../utils/extractor-config.js';
|
|
4
|
+
import { resolveFilePath } from '../utils/resolve-file-path.js';
|
|
5
|
+
import { resolveGenerator } from '../utils/resolve-generator.js';
|
|
6
|
+
import { updateTemplateMetadata } from '../utils/template-metadata.js';
|
|
7
|
+
/**
|
|
8
|
+
* Configure a text template with variables for substitution
|
|
9
|
+
*/
|
|
10
|
+
export async function configureTextTemplate(input, { logger, plugins, projects }) {
|
|
11
|
+
const { filePath, project: projectNameOrId, generator, templateName, variables, group, } = input;
|
|
12
|
+
// Resolve file path to project and package info
|
|
13
|
+
const { absolutePath, project, projectRelativePath } = resolveFilePath(filePath, projects, projectNameOrId);
|
|
14
|
+
// Resolve generator directory
|
|
15
|
+
const generatorDirectory = await resolveGenerator(project.directory, plugins, generator, logger);
|
|
16
|
+
// Simple validation to make sure the variables exist inside the file
|
|
17
|
+
const templateContents = await readFile(absolutePath, 'utf8');
|
|
18
|
+
for (const [variable, { value }] of Object.entries(variables ?? {})) {
|
|
19
|
+
if (value === '') {
|
|
20
|
+
throw new Error(`Variable ${variable} must have a value`);
|
|
21
|
+
}
|
|
22
|
+
if (!templateContents.includes(value)) {
|
|
23
|
+
throw new Error(`Variable ${variable} with value ${value} not found in template ${absolutePath}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Update template metadata
|
|
27
|
+
await updateTemplateMetadata(absolutePath, generator, templateName, variables &&
|
|
28
|
+
{
|
|
29
|
+
variables: mapValues(variables, (v) => v.value),
|
|
30
|
+
});
|
|
31
|
+
// Configure the template
|
|
32
|
+
const templateConfig = {
|
|
33
|
+
group: group ?? undefined,
|
|
34
|
+
};
|
|
35
|
+
if (variables) {
|
|
36
|
+
templateConfig.variables = mapValues(variables, (v) => ({
|
|
37
|
+
description: v.description,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
await updateExtractorTemplate(generatorDirectory, templateName, 'text', templateConfig);
|
|
41
|
+
return {
|
|
42
|
+
message: `Successfully configured text template '${templateName}' for file '${projectRelativePath}' in project '${project.name}'`,
|
|
43
|
+
templateName,
|
|
44
|
+
absolutePath,
|
|
45
|
+
generatorDirectory,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=configure-text-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-text-template.js","sourceRoot":"","sources":["../../../src/templates/configure/configure-text-template.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAA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,CACxC,CAAC;IAEF,yBAAyB;IACzB,MAAM,cAAc,GAAkC;QACpD,KAAK,EAAE,KAAK,IAAI,SAAS;KAC1B,CAAC;IAEF,IAAI,SAAS,EAAE,CAAC;QACd,cAAc,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,WAAW,EAAE,CAAC,CAAC,WAAW;SAC3B,CAAC,CAAC,CAAC;IACN,CAAC;IAED,MAAM,uBAAuB,CAC3B,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,cAAc,CACf,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,0CAA0C,YAAY,eAAe,mBAAmB,iBAAiB,OAAO,CAAC,IAAI,GAAG;QACjI,YAAY;QACZ,YAAY;QACZ,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ServiceActionContext } from '#src/actions/types.js';
|
|
2
|
+
import type { ConfigureTemplateResult } from './types.js';
|
|
3
|
+
export interface ConfigureTsTemplateInput {
|
|
4
|
+
filePath: string;
|
|
5
|
+
project?: string;
|
|
6
|
+
generator: string;
|
|
7
|
+
templateName: string;
|
|
8
|
+
projectExports?: string[];
|
|
9
|
+
group?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Configure a TypeScript template with project exports and validation
|
|
13
|
+
*/
|
|
14
|
+
export declare function configureTsTemplate(input: ConfigureTsTemplateInput, { logger, plugins, projects }: ServiceActionContext): Promise<ConfigureTemplateResult>;
|
|
15
|
+
//# sourceMappingURL=configure-ts-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-ts-template.d.ts","sourceRoot":"","sources":["../../../src/templates/configure/configure-ts-template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAQ1D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,EAC/B,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAClD,OAAO,CAAC,uBAAuB,CAAC,CA6DlC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { updateExtractorTemplate } from '../utils/extractor-config.js';
|
|
2
|
+
import { inferExportsFromTsFile } from '../utils/infer-exports-from-ts-file.js';
|
|
3
|
+
import { resolveFilePath } from '../utils/resolve-file-path.js';
|
|
4
|
+
import { resolveGenerator } from '../utils/resolve-generator.js';
|
|
5
|
+
import { updateTemplateMetadata } from '../utils/template-metadata.js';
|
|
6
|
+
/**
|
|
7
|
+
* Configure a TypeScript template with project exports and validation
|
|
8
|
+
*/
|
|
9
|
+
export async function configureTsTemplate(input, { logger, plugins, projects }) {
|
|
10
|
+
const { filePath, project: projectNameOrId, generator, templateName, projectExports: projectExportsList = [], group, } = input;
|
|
11
|
+
// Resolve file path to project and package info
|
|
12
|
+
const { absolutePath, project, projectRelativePath } = resolveFilePath(filePath, projects, projectNameOrId);
|
|
13
|
+
// Validate exports if provided
|
|
14
|
+
const projectExports = {};
|
|
15
|
+
if (projectExportsList.length > 0) {
|
|
16
|
+
const availableExports = inferExportsFromTsFile(absolutePath);
|
|
17
|
+
for (const exportName of projectExportsList) {
|
|
18
|
+
const exportInfo = availableExports.get(exportName);
|
|
19
|
+
if (exportInfo) {
|
|
20
|
+
projectExports[exportName] = exportInfo;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new Error(`Export ${exportName} not found in ${absolutePath}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Resolve generator directory
|
|
28
|
+
const generatorDirectory = await resolveGenerator(project.directory, plugins, generator, logger);
|
|
29
|
+
// Update template metadata
|
|
30
|
+
await updateTemplateMetadata(absolutePath, generator, templateName);
|
|
31
|
+
// Configure the template
|
|
32
|
+
const templateConfig = {
|
|
33
|
+
projectExports: Object.keys(projectExports).length > 0 ? projectExports : undefined,
|
|
34
|
+
group: group ?? undefined,
|
|
35
|
+
};
|
|
36
|
+
await updateExtractorTemplate(generatorDirectory, templateName, 'ts', templateConfig);
|
|
37
|
+
return {
|
|
38
|
+
message: `Successfully configured TypeScript template '${templateName}' for file '${projectRelativePath}' in project '${project.name}'`,
|
|
39
|
+
templateName,
|
|
40
|
+
absolutePath,
|
|
41
|
+
generatorDirectory,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=configure-ts-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-ts-template.js","sourceRoot":"","sources":["../../../src/templates/configure/configure-ts-template.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAWvE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAA+B,EAC/B,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAwB;IAEnD,MAAM,EACJ,QAAQ,EACR,OAAO,EAAE,eAAe,EACxB,SAAS,EACT,YAAY,EACZ,cAAc,EAAE,kBAAkB,GAAG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Ae,mBAAmB,iBAAiB,OAAO,CAAC,IAAI,GAAG;QACvI,YAAY;QACZ,YAAY;QACZ,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/configure/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/configure/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/templates/configure/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/templates/configure/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ServiceActionContext } from '#src/actions/types.js';
|
|
2
|
+
export interface DeleteTemplateInput {
|
|
3
|
+
filePath: string;
|
|
4
|
+
project?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DeleteTemplateResult {
|
|
7
|
+
message: string;
|
|
8
|
+
templateName: string;
|
|
9
|
+
absolutePath: string;
|
|
10
|
+
generatorDirectory: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Delete a template by looking up its metadata from the file path
|
|
14
|
+
*/
|
|
15
|
+
export declare function deleteTemplate(input: DeleteTemplateInput, { logger, plugins, projects }: ServiceActionContext): Promise<DeleteTemplateResult>;
|
|
16
|
+
//# sourceMappingURL=delete-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-template.d.ts","sourceRoot":"","sources":["../../../src/templates/delete/delete-template.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAalE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,mBAAmB,EAC1B,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAClD,OAAO,CAAC,oBAAoB,CAAC,CA0D/B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { handleFileNotFoundError } from '@baseplate-dev/utils/node';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { readExtractorConfig, removeExtractorTemplate, } from '../utils/extractor-config.js';
|
|
5
|
+
import { resolveFilePath } from '../utils/resolve-file-path.js';
|
|
6
|
+
import { resolveGenerator } from '../utils/resolve-generator.js';
|
|
7
|
+
import { readTemplateMetadataForFile, removeTemplateMetadata, } from '../utils/template-metadata.js';
|
|
8
|
+
/**
|
|
9
|
+
* Delete a template by looking up its metadata from the file path
|
|
10
|
+
*/
|
|
11
|
+
export async function deleteTemplate(input, { logger, plugins, projects }) {
|
|
12
|
+
const { filePath, project: projectNameOrId } = input;
|
|
13
|
+
// Resolve file path to project and package info
|
|
14
|
+
const { absolutePath, project, projectRelativePath } = resolveFilePath(filePath, projects, projectNameOrId);
|
|
15
|
+
// Read template metadata for this file
|
|
16
|
+
const templateInfo = await readTemplateMetadataForFile(absolutePath);
|
|
17
|
+
const { template: templateName, generator } = templateInfo;
|
|
18
|
+
// Resolve generator directory
|
|
19
|
+
const generatorDirectory = await resolveGenerator(project.directory, plugins, generator, logger);
|
|
20
|
+
// Verify template exists in extractor.json
|
|
21
|
+
const config = await readExtractorConfig(generatorDirectory);
|
|
22
|
+
if (!config || !(templateName in config.templates)) {
|
|
23
|
+
throw new Error(`Template '${templateName}' not found in generator at ${generatorDirectory}`);
|
|
24
|
+
}
|
|
25
|
+
const templateConfig = config.templates[templateName];
|
|
26
|
+
const templatePath = templateConfig.sourceFile;
|
|
27
|
+
// Remove from extractor.json
|
|
28
|
+
await removeExtractorTemplate(generatorDirectory, templateName);
|
|
29
|
+
// Clean up the actual template file if it exists and has a sourceFile path
|
|
30
|
+
if (templatePath) {
|
|
31
|
+
const templateFilePath = path.join(generatorDirectory, 'templates', templatePath);
|
|
32
|
+
await fs.unlink(templateFilePath).catch(handleFileNotFoundError);
|
|
33
|
+
}
|
|
34
|
+
// Remove template metadata
|
|
35
|
+
await removeTemplateMetadata(absolutePath);
|
|
36
|
+
// Delete the generated file itself
|
|
37
|
+
await fs.unlink(absolutePath).catch(handleFileNotFoundError);
|
|
38
|
+
return {
|
|
39
|
+
message: `Successfully deleted template '${templateName}' and file '${projectRelativePath}' from project '${project.name}'`,
|
|
40
|
+
templateName,
|
|
41
|
+
absolutePath,
|
|
42
|
+
generatorDirectory,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=delete-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-template.js","sourceRoot":"","sources":["../../../src/templates/delete/delete-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE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IACtD,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC;IAE/C,6BAA6B;IAC7B,MAAM,uBAAuB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;IAEhE,2EAA2E;IAC3E,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,kBAAkB,EAClB,WAAW,EACX,YAAY,CACb,CAAC;QACF,MAAM,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACnE,CAAC;IAED,2BAA2B;IAC3B,MAAM,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAE3C,mCAAmC;IACnC,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE7D,OAAO;QACL,OAAO,EAAE,kCAAkC,YAAY,eAAe,mBAAmB,mBAAmB,OAAO,CAAC,IAAI,GAAG;QAC3H,YAAY;QACZ,YAAY;QACZ,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TemplateConfig } from '@baseplate-dev/sync';
|
|
2
|
+
export interface ListTemplatesInput {
|
|
3
|
+
generatorDirectory: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TemplateInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
sourceFile?: string;
|
|
9
|
+
group?: string;
|
|
10
|
+
kind?: string;
|
|
11
|
+
config: TemplateConfig;
|
|
12
|
+
}
|
|
13
|
+
export interface ListTemplatesOutput {
|
|
14
|
+
generatorName: string;
|
|
15
|
+
templates: TemplateInfo[];
|
|
16
|
+
templateCount: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* List all templates in a generator's extractor.json
|
|
20
|
+
*/
|
|
21
|
+
export declare function listTemplates({ generatorDirectory, }: ListTemplatesInput): Promise<ListTemplatesOutput>;
|
|
22
|
+
//# sourceMappingURL=list-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-templates.d.ts","sourceRoot":"","sources":["../../../src/templates/list/list-templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,EAClC,kBAAkB,GACnB,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgCnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readExtractorConfig } from '../utils/extractor-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* List all templates in a generator's extractor.json
|
|
4
|
+
*/
|
|
5
|
+
export async function listTemplates({ generatorDirectory, }) {
|
|
6
|
+
const config = await readExtractorConfig(generatorDirectory);
|
|
7
|
+
if (!config) {
|
|
8
|
+
throw new Error(`No extractor.json found in ${generatorDirectory}`);
|
|
9
|
+
}
|
|
10
|
+
const templates = [];
|
|
11
|
+
for (const [name, templateConfig] of Object.entries(config.templates)) {
|
|
12
|
+
templates.push({
|
|
13
|
+
name,
|
|
14
|
+
type: templateConfig.type,
|
|
15
|
+
sourceFile: templateConfig.sourceFile,
|
|
16
|
+
group: templateConfig.group,
|
|
17
|
+
kind: templateConfig.kind,
|
|
18
|
+
config: templateConfig,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
// Sort templates by name for consistent output
|
|
22
|
+
templates.sort((a, b) => a.name.localeCompare(b.name));
|
|
23
|
+
return {
|
|
24
|
+
generatorName: config.name,
|
|
25
|
+
templates,
|
|
26
|
+
templateCount: templates.length,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=list-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-templates.js","sourceRoot":"","sources":["../../../src/templates/list/list-templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAqBnE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,kBAAkB,GACC;IACnB,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAE7D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,8BAA8B,kBAAkB,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACtE,SAAS,CAAC,IAAI,CAAC;YACb,IAAI;YACJ,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,UAAU,EAAE,cAAc,CAAC,UAAU;YACrC,KAAK,EAAG,cAA0C,CAAC,KAEtC;YACb,IAAI,EAAG,cAA0C,CAAC,IAErC;YACb,MAAM,EAAE,cAAc;SACvB,CAAC,CAAC;IACL,CAAC;IAED,+CAA+C;IAC/C,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvD,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,IAAI;QAC1B,SAAS;QACT,aAAa,EAAE,SAAS,CAAC,MAAM;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ServiceActionContext } from '#src/actions/types.js';
|
|
2
|
+
export interface ShowTemplateMetadataInput {
|
|
3
|
+
filePath: string;
|
|
4
|
+
project?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ShowTemplateMetadataResult {
|
|
7
|
+
message: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
absolutePath: string;
|
|
10
|
+
templateName: string;
|
|
11
|
+
generator: string;
|
|
12
|
+
instanceData?: Record<string, unknown>;
|
|
13
|
+
hasMetadata: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Show template metadata for a specific file
|
|
17
|
+
*/
|
|
18
|
+
export declare function showTemplateMetadata(input: ShowTemplateMetadataInput, { projects }: ServiceActionContext): Promise<ShowTemplateMetadataResult>;
|
|
19
|
+
//# sourceMappingURL=show-template-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-template-metadata.d.ts","sourceRoot":"","sources":["../../../src/templates/show/show-template-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAKlE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,EAChC,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GACjC,OAAO,CAAC,0BAA0B,CAAC,CAoCrC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { resolveFilePath } from '../utils/resolve-file-path.js';
|
|
2
|
+
import { readTemplateMetadataForFile } from '../utils/template-metadata.js';
|
|
3
|
+
/**
|
|
4
|
+
* Show template metadata for a specific file
|
|
5
|
+
*/
|
|
6
|
+
export async function showTemplateMetadata(input, { projects }) {
|
|
7
|
+
const { filePath, project: projectNameOrId } = input;
|
|
8
|
+
// Resolve file path to project and package info
|
|
9
|
+
const { absolutePath, project, projectRelativePath } = resolveFilePath(filePath, projects, projectNameOrId);
|
|
10
|
+
try {
|
|
11
|
+
// Read template metadata for this file
|
|
12
|
+
const templateInfo = await readTemplateMetadataForFile(absolutePath);
|
|
13
|
+
const { template: templateName, generator, instanceData } = templateInfo;
|
|
14
|
+
return {
|
|
15
|
+
message: `Template metadata found for '${projectRelativePath}' in project '${project.name}'`,
|
|
16
|
+
filePath: projectRelativePath,
|
|
17
|
+
absolutePath,
|
|
18
|
+
templateName,
|
|
19
|
+
generator,
|
|
20
|
+
instanceData,
|
|
21
|
+
hasMetadata: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// File has no template metadata
|
|
26
|
+
return {
|
|
27
|
+
message: `No template metadata found for '${projectRelativePath}' in project '${project.name}'`,
|
|
28
|
+
filePath: projectRelativePath,
|
|
29
|
+
absolutePath,
|
|
30
|
+
templateName: '',
|
|
31
|
+
generator: '',
|
|
32
|
+
instanceData: undefined,
|
|
33
|
+
hasMetadata: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=show-template-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-template-metadata.js","sourceRoot":"","sources":["../../../src/templates/show/show-template-metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAiB5E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAgC,EAChC,EAAE,QAAQ,EAAwB;IAElC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAErD,gDAAgD;IAChD,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,eAAe,CACpE,QAAQ,EACR,QAAQ,EACR,eAAe,CAChB,CAAC;IAEF,IAAI,CAAC;QACH,uCAAuC;QACvC,MAAM,YAAY,GAAG,MAAM,2BAA2B,CAAC,YAAY,CAAC,CAAC;QACrE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC;QAEzE,OAAO;YACL,OAAO,EAAE,gCAAgC,mBAAmB,iBAAiB,OAAO,CAAC,IAAI,GAAG;YAC5F,QAAQ,EAAE,mBAAmB;YAC7B,YAAY;YACZ,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,gCAAgC;QAChC,OAAO;YACL,OAAO,EAAE,mCAAmC,mBAAmB,iBAAiB,OAAO,CAAC,IAAI,GAAG;YAC/F,QAAQ,EAAE,mBAAmB;YAC7B,YAAY;YACZ,YAAY,EAAE,EAAE;YAChB,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,SAAS;YACvB,WAAW,EAAE,KAAK;SACnB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExtractorConfig, TemplateConfig } from '@baseplate-dev/sync';
|
|
2
|
+
/**
|
|
3
|
+
* Read extractor.json configuration from a generator directory
|
|
4
|
+
*/
|
|
5
|
+
export declare function readExtractorConfig(generatorDirectory: string): Promise<ExtractorConfig | undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* Write extractor.json configuration to a generator directory
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeExtractorConfig(generatorDirectory: string, config: ExtractorConfig): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Update a template configuration in extractor.json
|
|
12
|
+
*/
|
|
13
|
+
export declare function updateExtractorTemplate(generatorDirectory: string, templateName: string, templateType?: string, overwriteConfig?: Partial<TemplateConfig>, defaultConfig?: Partial<TemplateConfig>): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Remove a template configuration from extractor.json
|
|
16
|
+
*/
|
|
17
|
+
export declare function removeExtractorTemplate(generatorDirectory: string, templateName: string): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=extractor-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor-config.d.ts","sourceRoot":"","sources":["../../../src/templates/utils/extractor-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAe3E;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAStC;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,MAAM,EACpB,YAAY,SAAO,EACnB,eAAe,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,EACzC,aAAa,GAAE,OAAO,CAAC,cAAc,CAAM,GAC1C,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { EXTRACTOR_CONFIG_FILENAME, extractorConfigSchema, sortExtractorConfigKeys, } from '@baseplate-dev/sync';
|
|
2
|
+
import { stringifyPrettyCompact } from '@baseplate-dev/utils';
|
|
3
|
+
import { handleFileNotFoundError, readJsonWithSchema, } from '@baseplate-dev/utils/node';
|
|
4
|
+
import { writeFile } from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Read extractor.json configuration from a generator directory
|
|
8
|
+
*/
|
|
9
|
+
export async function readExtractorConfig(generatorDirectory) {
|
|
10
|
+
const extractorPath = path.join(generatorDirectory, EXTRACTOR_CONFIG_FILENAME);
|
|
11
|
+
return readJsonWithSchema(extractorPath, extractorConfigSchema).catch(handleFileNotFoundError);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Write extractor.json configuration to a generator directory
|
|
15
|
+
*/
|
|
16
|
+
export async function writeExtractorConfig(generatorDirectory, config) {
|
|
17
|
+
const extractorPath = path.join(generatorDirectory, EXTRACTOR_CONFIG_FILENAME);
|
|
18
|
+
const sortedConfig = sortExtractorConfigKeys(config);
|
|
19
|
+
await writeFile(extractorPath, `${stringifyPrettyCompact(sortedConfig)}\n`);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Update a template configuration in extractor.json
|
|
23
|
+
*/
|
|
24
|
+
export async function updateExtractorTemplate(generatorDirectory, templateName, templateType = 'ts', overwriteConfig, defaultConfig = {}) {
|
|
25
|
+
const config = await readExtractorConfig(generatorDirectory);
|
|
26
|
+
if (!config) {
|
|
27
|
+
throw new Error(`No extractor.json found in ${generatorDirectory}`);
|
|
28
|
+
}
|
|
29
|
+
// Update or add the template configuration
|
|
30
|
+
const existingTemplate = templateName in config.templates ? config.templates[templateName] : {};
|
|
31
|
+
const existingTemplateTyped = existingTemplate;
|
|
32
|
+
config.templates[templateName] = {
|
|
33
|
+
...defaultConfig, // Apply default config if provided
|
|
34
|
+
type: templateType,
|
|
35
|
+
sourceFile: existingTemplateTyped.sourceFile || '', // Preserve existing or default to empty string
|
|
36
|
+
fileOptions: { kind: 'singleton' },
|
|
37
|
+
...existingTemplate, // Preserve existing properties
|
|
38
|
+
...overwriteConfig, // Apply any additional template config
|
|
39
|
+
};
|
|
40
|
+
await writeExtractorConfig(generatorDirectory, config);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Remove a template configuration from extractor.json
|
|
44
|
+
*/
|
|
45
|
+
export async function removeExtractorTemplate(generatorDirectory, templateName) {
|
|
46
|
+
const config = await readExtractorConfig(generatorDirectory);
|
|
47
|
+
if (!config) {
|
|
48
|
+
throw new Error(`No extractor.json found in ${generatorDirectory}`);
|
|
49
|
+
}
|
|
50
|
+
// Remove the template configuration
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
52
|
+
delete config.templates[templateName];
|
|
53
|
+
await writeExtractorConfig(generatorDirectory, config);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=extractor-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor-config.js","sourceRoot":"","sources":["../../../src/templates/utils/extractor-config.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,KAA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G,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;QAClC,GAAG,gBAAgB,EAAE,+BAA+B;QACpD,GAAG,eAAe,EAAE,uCAAuC;KAC5D,CAAC;IAEF,MAAM,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,kBAA0B,EAC1B,YAAoB;IAEpB,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAE7D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,8BAA8B,kBAAkB,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,oCAAoC;IACpC,gEAAgE;IAChE,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAEtC,MAAM,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TsFileExportInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
isDefault?: boolean;
|
|
4
|
+
isTypeOnly?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Extracts all available exports from a TypeScript file
|
|
8
|
+
*/
|
|
9
|
+
export declare function inferExportsFromTsFile(filePath: string): Map<string, TsFileExportInfo>;
|
|
10
|
+
//# sourceMappingURL=infer-exports-from-ts-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-exports-from-ts-file.d.ts","sourceRoot":"","sources":["../../../src/templates/utils/infer-exports-from-ts-file.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CA0F/B"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { enhanceErrorWithContext } from '@baseplate-dev/utils';
|
|
2
|
+
import { Project } from 'ts-morph';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts all available exports from a TypeScript file
|
|
5
|
+
*/
|
|
6
|
+
export function inferExportsFromTsFile(filePath) {
|
|
7
|
+
try {
|
|
8
|
+
const project = new Project();
|
|
9
|
+
const sourceFile = project.addSourceFileAtPath(filePath);
|
|
10
|
+
const availableExports = new Map();
|
|
11
|
+
// Find export declarations
|
|
12
|
+
for (const exportDecl of sourceFile.getExportDeclarations()) {
|
|
13
|
+
for (const namedExport of exportDecl.getNamedExports()) {
|
|
14
|
+
availableExports.set(namedExport.getName(), {
|
|
15
|
+
name: namedExport.getName(),
|
|
16
|
+
isTypeOnly: namedExport.isTypeOnly(),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Find variable declarations that are exported
|
|
21
|
+
for (const varDecl of sourceFile.getVariableDeclarations()) {
|
|
22
|
+
if (varDecl.isExported()) {
|
|
23
|
+
availableExports.set(varDecl.getName(), {
|
|
24
|
+
name: varDecl.getName(),
|
|
25
|
+
isTypeOnly: false,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Find function declarations that are exported
|
|
30
|
+
for (const func of sourceFile.getFunctions()) {
|
|
31
|
+
if (func.isExported()) {
|
|
32
|
+
const name = func.getName();
|
|
33
|
+
if (name) {
|
|
34
|
+
availableExports.set(name, {
|
|
35
|
+
name,
|
|
36
|
+
isTypeOnly: false,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Find class declarations that are exported
|
|
42
|
+
for (const cls of sourceFile.getClasses()) {
|
|
43
|
+
if (cls.isExported()) {
|
|
44
|
+
const name = cls.getName();
|
|
45
|
+
if (name) {
|
|
46
|
+
availableExports.set(name, {
|
|
47
|
+
name,
|
|
48
|
+
isTypeOnly: false,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Find interface declarations that are exported
|
|
54
|
+
for (const iface of sourceFile.getInterfaces()) {
|
|
55
|
+
if (iface.isExported()) {
|
|
56
|
+
availableExports.set(iface.getName(), {
|
|
57
|
+
name: iface.getName(),
|
|
58
|
+
isTypeOnly: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Find type declarations that are exported
|
|
63
|
+
for (const typeAlias of sourceFile.getTypeAliases()) {
|
|
64
|
+
if (typeAlias.isExported()) {
|
|
65
|
+
availableExports.set(typeAlias.getName(), {
|
|
66
|
+
name: typeAlias.getName(),
|
|
67
|
+
isTypeOnly: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Check for default export
|
|
72
|
+
const defaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
73
|
+
if (defaultExportSymbol) {
|
|
74
|
+
const name = defaultExportSymbol.getName();
|
|
75
|
+
availableExports.set(name, {
|
|
76
|
+
name,
|
|
77
|
+
isDefault: true,
|
|
78
|
+
isTypeOnly: false,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return availableExports;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw enhanceErrorWithContext(error, `Failed to extract exports from ${filePath}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=infer-exports-from-ts-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infer-exports-from-ts-file.js","sourceRoot":"","sources":["../../../src/templates/utils/infer-exports-from-ts-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAA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AE,IAAI;gBACf,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,uBAAuB,CAC3B,KAAK,EACL,kCAAkC,QAAQ,EAAE,CAC7C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProjectInfo } from '../../api/projects.js';
|
|
2
|
+
interface ResolvedFilePath {
|
|
3
|
+
/** The absolute file path */
|
|
4
|
+
absolutePath: string;
|
|
5
|
+
/** The relative path from the project directory */
|
|
6
|
+
projectRelativePath: string;
|
|
7
|
+
/** The project that contains this file */
|
|
8
|
+
project: ProjectInfo;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a file path (absolute or relative) to project and package information
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveFilePath(filePath: string, projects: ProjectInfo[], project?: string): ResolvedFilePath;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=resolve-file-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-file-path.d.ts","sourceRoot":"","sources":["../../../src/templates/utils/resolve-file-path.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,UAAU,gBAAgB;IACxB,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,0CAA0C;IAC1C,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,gBAAgB,CAYlB"}
|