@baseplate-dev/project-builder-cli 0.2.2 → 0.2.3
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/commands/build.js +3 -1
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.js +33 -0
- package/dist/commands/templates.js +18 -0
- package/dist/index.js +2 -0
- package/package.json +9 -8
package/dist/commands/build.js
CHANGED
|
@@ -11,18 +11,20 @@ export function addBuildCommand(program) {
|
|
|
11
11
|
.command('generate [directory]')
|
|
12
12
|
.description('Builds project from project-definition.json in baseplate/ directory')
|
|
13
13
|
.action(async (directory) => {
|
|
14
|
-
const { buildProject } = await import('@baseplate-dev/project-builder-server');
|
|
14
|
+
const { buildProject, SyncMetadataController } = await import('@baseplate-dev/project-builder-server');
|
|
15
15
|
const resolvedDirectory = directory
|
|
16
16
|
? expandPathWithTilde(directory)
|
|
17
17
|
: '.';
|
|
18
18
|
const context = await createSchemaParserContext(resolvedDirectory);
|
|
19
19
|
const userConfig = await getUserConfig();
|
|
20
|
+
const syncMetadataController = new SyncMetadataController(resolvedDirectory, logger);
|
|
20
21
|
await buildProject({
|
|
21
22
|
directory: resolvedDirectory,
|
|
22
23
|
logger,
|
|
23
24
|
context,
|
|
24
25
|
userConfig,
|
|
25
26
|
cliFilePath: process.argv[1],
|
|
27
|
+
syncMetadataController,
|
|
26
28
|
});
|
|
27
29
|
});
|
|
28
30
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createSchemaParserContext } from '#src/services/schema-parser-context.js';
|
|
2
|
+
import { getUserConfig } from '#src/services/user-config.js';
|
|
3
|
+
import { expandPathWithTilde } from '#src/utils/path.js';
|
|
4
|
+
import { logger } from '../services/logger.js';
|
|
5
|
+
/**
|
|
6
|
+
* Adds a diff command to the program.
|
|
7
|
+
* @param program - The program to add the command to.
|
|
8
|
+
*/
|
|
9
|
+
export function addDiffCommand(program) {
|
|
10
|
+
program
|
|
11
|
+
.command('diff [directory]')
|
|
12
|
+
.description('Shows diff between generated output and current working directory')
|
|
13
|
+
.option('--compact', 'Show compact diff format instead of unified diff')
|
|
14
|
+
.option('--app <apps...>', 'Filter by specific app names')
|
|
15
|
+
.option('--glob <patterns...>', 'Filter files by glob patterns')
|
|
16
|
+
.action(async (directory, options) => {
|
|
17
|
+
const { diffProject } = await import('@baseplate-dev/project-builder-server');
|
|
18
|
+
const resolvedDirectory = directory
|
|
19
|
+
? expandPathWithTilde(directory)
|
|
20
|
+
: process.cwd();
|
|
21
|
+
const context = await createSchemaParserContext(resolvedDirectory);
|
|
22
|
+
const userConfig = await getUserConfig();
|
|
23
|
+
await diffProject({
|
|
24
|
+
directory: resolvedDirectory,
|
|
25
|
+
logger,
|
|
26
|
+
context,
|
|
27
|
+
userConfig,
|
|
28
|
+
compact: options.compact ?? false,
|
|
29
|
+
appFilter: options.app,
|
|
30
|
+
globPatterns: options.glob,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -36,6 +36,14 @@ export function addTemplatesCommand(program) {
|
|
|
36
36
|
.action(async (directory, app, options) => {
|
|
37
37
|
await handleExtractTemplates(directory, app, options);
|
|
38
38
|
});
|
|
39
|
+
// Templates generate subcommand
|
|
40
|
+
templatesCommand
|
|
41
|
+
.command('generate [directory]')
|
|
42
|
+
.description('Generate typed template files from existing extractor.json configurations')
|
|
43
|
+
.option('--skip-clean', 'Skip cleaning the output directories (templates and generated)', false)
|
|
44
|
+
.action(async (directory, options) => {
|
|
45
|
+
await handleGenerateTemplates(directory, options);
|
|
46
|
+
});
|
|
39
47
|
}
|
|
40
48
|
async function handleListTemplates(directory, options) {
|
|
41
49
|
const { discoverGenerators } = await import('@baseplate-dev/project-builder-server/template-extractor');
|
|
@@ -108,3 +116,13 @@ async function handleExtractTemplates(directory, app, options) {
|
|
|
108
116
|
skipClean: options.skipClean,
|
|
109
117
|
});
|
|
110
118
|
}
|
|
119
|
+
async function handleGenerateTemplates(directory, options) {
|
|
120
|
+
const { generateTypedTemplateFiles } = await import('@baseplate-dev/project-builder-server/template-extractor');
|
|
121
|
+
const resolvedDirectory = directory
|
|
122
|
+
? expandPathWithTilde(directory)
|
|
123
|
+
: undefined;
|
|
124
|
+
const defaultPlugins = await getDefaultPlugins(logger);
|
|
125
|
+
await generateTypedTemplateFiles(resolvedDirectory, defaultPlugins, logger, {
|
|
126
|
+
skipClean: options.skipClean,
|
|
127
|
+
});
|
|
128
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { program } from 'commander';
|
|
2
2
|
import { addBuildCommand } from './commands/build.js';
|
|
3
3
|
import { addConfigCommand } from './commands/config.js';
|
|
4
|
+
import { addDiffCommand } from './commands/diff.js';
|
|
4
5
|
import { addServeCommand } from './commands/server.js';
|
|
5
6
|
import { addTemplatesCommand } from './commands/templates.js';
|
|
6
7
|
import { getEnabledFeatureFlags } from './services/feature-flags.js';
|
|
@@ -17,6 +18,7 @@ export async function runCli() {
|
|
|
17
18
|
addTemplatesCommand(program);
|
|
18
19
|
}
|
|
19
20
|
addBuildCommand(program);
|
|
21
|
+
addDiffCommand(program);
|
|
20
22
|
addServeCommand(program);
|
|
21
23
|
addConfigCommand(program);
|
|
22
24
|
await program.parseAsync(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseplate-dev/project-builder-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Full-stack CLI builder using Baseplate generators",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"pino-pretty": "13.0.0",
|
|
46
46
|
"pkg-dir": "^8.0.0",
|
|
47
47
|
"zod": "3.24.1",
|
|
48
|
-
"@baseplate-dev/project-builder-common": "0.2.
|
|
49
|
-
"@baseplate-dev/project-builder-lib": "0.2.
|
|
50
|
-
"@baseplate-dev/project-builder-server": "0.2.
|
|
51
|
-
"@baseplate-dev/project-builder-web": "0.2.
|
|
52
|
-
"@baseplate-dev/utils": "0.2.
|
|
48
|
+
"@baseplate-dev/project-builder-common": "0.2.3",
|
|
49
|
+
"@baseplate-dev/project-builder-lib": "0.2.3",
|
|
50
|
+
"@baseplate-dev/project-builder-server": "0.2.3",
|
|
51
|
+
"@baseplate-dev/project-builder-web": "0.2.3",
|
|
52
|
+
"@baseplate-dev/utils": "0.2.3"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@playwright/test": "1.51.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"tsx": "4.19.3",
|
|
62
62
|
"typescript": "5.7.3",
|
|
63
63
|
"vitest": "3.0.7",
|
|
64
|
-
"@baseplate-dev/tools": "0.2.
|
|
64
|
+
"@baseplate-dev/tools": "0.2.3"
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": "^22.0.0"
|
|
@@ -78,12 +78,13 @@
|
|
|
78
78
|
"clean": "rm -rf ./dist",
|
|
79
79
|
"dev": "tsx watch --tsconfig ./tsconfig.app.json --exclude /**/node_modules/** -r dotenv/config -C development ./src/cli.ts",
|
|
80
80
|
"dev:serve": "pnpm dev serve",
|
|
81
|
-
"extract:templates": "pnpm start templates extract",
|
|
82
81
|
"lint": "eslint .",
|
|
83
82
|
"prettier:check": "prettier --check .",
|
|
84
83
|
"prettier:write": "prettier -w .",
|
|
85
84
|
"project:generate": "pnpm start generate",
|
|
86
85
|
"start": "tsx --tsconfig ./tsconfig.app.json -r dotenv/config -C development ./src/cli.ts",
|
|
86
|
+
"templates:extract": "pnpm start templates extract",
|
|
87
|
+
"templates:generate": "pnpm start templates generate",
|
|
87
88
|
"test": "vitest",
|
|
88
89
|
"test:e2e": "playwright test",
|
|
89
90
|
"typecheck": "tsc -b --noEmit"
|