@baseplate-dev/project-builder-cli 0.3.4 → 0.3.6
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.
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { invokeServiceActionAsCli, syncAllProjectsAction, } from '@baseplate-dev/project-builder-server/actions';
|
|
2
|
+
import { createServiceActionContext } from '#src/utils/create-service-action-context.js';
|
|
3
|
+
import { getExampleProjects } from '#src/utils/list-projects.js';
|
|
4
|
+
/**
|
|
5
|
+
* Adds a sync-examples command to the program.
|
|
6
|
+
* @param program - The program to add the command to.
|
|
7
|
+
*/
|
|
8
|
+
export function addSyncExamplesCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command('sync-examples')
|
|
11
|
+
.description('Syncs all example projects using the baseplate sync engine')
|
|
12
|
+
.option('--overwrite', 'Force overwrite existing files and apply snapshots automatically')
|
|
13
|
+
.option('--skip-commands', 'Skip running commands during sync')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
// Get all example projects
|
|
16
|
+
const exampleProjects = await getExampleProjects();
|
|
17
|
+
if (exampleProjects.length === 0) {
|
|
18
|
+
console.info('No example projects found to sync.');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.info(`Found ${exampleProjects.length} example projects to sync:`);
|
|
22
|
+
for (const project of exampleProjects) {
|
|
23
|
+
console.info(` - ${project.name}`);
|
|
24
|
+
}
|
|
25
|
+
// Create context with example projects only
|
|
26
|
+
const baseContext = await createServiceActionContext();
|
|
27
|
+
const context = {
|
|
28
|
+
...baseContext,
|
|
29
|
+
projects: exampleProjects,
|
|
30
|
+
};
|
|
31
|
+
await invokeServiceActionAsCli(syncAllProjectsAction, {
|
|
32
|
+
overwrite: options.overwrite,
|
|
33
|
+
skipCommands: options.skipCommands,
|
|
34
|
+
}, context);
|
|
35
|
+
});
|
|
36
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { addMcpCommand } from './commands/mcp.js';
|
|
|
6
6
|
import { addProjectsCommand } from './commands/projects.js';
|
|
7
7
|
import { addServeCommand } from './commands/server.js';
|
|
8
8
|
import { addSnapshotCommand } from './commands/snapshot.js';
|
|
9
|
+
import { addSyncExamplesCommand } from './commands/sync-examples.js';
|
|
9
10
|
import { addSyncCommand } from './commands/sync.js';
|
|
10
11
|
import { addTemplatesCommand } from './commands/templates.js';
|
|
11
12
|
import { getEnabledFeatureFlags } from './services/feature-flags.js';
|
|
@@ -23,6 +24,7 @@ export async function runCli() {
|
|
|
23
24
|
addSnapshotCommand(program);
|
|
24
25
|
}
|
|
25
26
|
addSyncCommand(program);
|
|
27
|
+
addSyncExamplesCommand(program);
|
|
26
28
|
addDiffCommand(program);
|
|
27
29
|
addServeCommand(program);
|
|
28
30
|
addDevServerCommand(program);
|
|
@@ -56,3 +56,18 @@ export declare function listProjects({ additionalDirectories, }: {
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
export declare function resolveProject(projectNameOrDirectory?: string | undefined): Promise<ServiceActionProject>;
|
|
59
|
+
/**
|
|
60
|
+
* Lists all example projects by searching through example directories only.
|
|
61
|
+
*
|
|
62
|
+
* This function searches for projects specifically in the examples/ directory
|
|
63
|
+
* of the Baseplate repository.
|
|
64
|
+
*
|
|
65
|
+
* @returns Promise that resolves to an array of example projects
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // List all example projects
|
|
70
|
+
* const exampleProjects = await getExampleProjects();
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function getExampleProjects(): Promise<ServiceActionProject[]>;
|
|
@@ -107,3 +107,21 @@ export async function resolveProject(projectNameOrDirectory = process.cwd()) {
|
|
|
107
107
|
}
|
|
108
108
|
return project;
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Lists all example projects by searching through example directories only.
|
|
112
|
+
*
|
|
113
|
+
* This function searches for projects specifically in the examples/ directory
|
|
114
|
+
* of the Baseplate repository.
|
|
115
|
+
*
|
|
116
|
+
* @returns Promise that resolves to an array of example projects
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // List all example projects
|
|
121
|
+
* const exampleProjects = await getExampleProjects();
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export async function getExampleProjects() {
|
|
125
|
+
const exampleDirs = await findExamplesDirectories();
|
|
126
|
+
return discoverProjects(exampleDirs, logger);
|
|
127
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baseplate-dev/project-builder-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Full-stack CLI builder using Baseplate generators",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"pino-pretty": "13.0.0",
|
|
47
47
|
"pkg-dir": "^8.0.0",
|
|
48
48
|
"zod": "3.25.76",
|
|
49
|
-
"@baseplate-dev/project-builder-common": "0.3.
|
|
50
|
-
"@baseplate-dev/project-builder-lib": "0.3.
|
|
51
|
-
"@baseplate-dev/project-builder-server": "0.3.
|
|
52
|
-
"@baseplate-dev/project-builder-web": "0.3.
|
|
53
|
-
"@baseplate-dev/utils": "0.3.
|
|
49
|
+
"@baseplate-dev/project-builder-common": "0.3.6",
|
|
50
|
+
"@baseplate-dev/project-builder-lib": "0.3.6",
|
|
51
|
+
"@baseplate-dev/project-builder-server": "0.3.6",
|
|
52
|
+
"@baseplate-dev/project-builder-web": "0.3.6",
|
|
53
|
+
"@baseplate-dev/utils": "0.3.6"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@playwright/test": "1.51.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"tsx": "4.19.3",
|
|
63
63
|
"typescript": "5.8.3",
|
|
64
64
|
"vitest": "3.2.4",
|
|
65
|
-
"@baseplate-dev/tools": "0.3.
|
|
65
|
+
"@baseplate-dev/tools": "0.3.6"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": "^22.0.0"
|