@baseplate-dev/project-builder-cli 0.4.3 → 0.5.0

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.
@@ -10,7 +10,7 @@ export function addDiffCommand(program) {
10
10
  .command('diff [project]')
11
11
  .description('Show diff between generated output and project (name or directory)')
12
12
  .option('--compact', 'Show compact diff format instead of unified diff')
13
- .option('--package <packages...>', 'Filter by specific package names')
13
+ .option('--packages <packages...>', 'Filter by specific package names')
14
14
  .option('--include <patterns...>', 'Filter files by glob patterns')
15
15
  .option('--fail-on-differences', 'Fail the command if differences are found')
16
16
  .action(async (project, options) => {
@@ -0,0 +1,6 @@
1
+ import type { Command } from 'commander';
2
+ /**
3
+ * Adds a sync-file command to the program.
4
+ * @param program - The program to add the command to.
5
+ */
6
+ export declare function addSyncFileCommand(program: Command): void;
@@ -0,0 +1,26 @@
1
+ import { invokeServiceActionAsCli, syncFileAction, } from '@baseplate-dev/project-builder-server/actions';
2
+ import { createServiceActionContext } from '#src/utils/create-service-action-context.js';
3
+ import { logger } from '../services/logger.js';
4
+ /**
5
+ * Adds a sync-file command to the program.
6
+ * @param program - The program to add the command to.
7
+ */
8
+ export function addSyncFileCommand(program) {
9
+ program
10
+ .command('sync-file <project> <app> <files...>')
11
+ .description('Apply specific generated files to the working codebase without performing a full sync')
12
+ .action(async (project, app, files) => {
13
+ try {
14
+ const context = await createServiceActionContext();
15
+ await invokeServiceActionAsCli(syncFileAction, {
16
+ project,
17
+ app,
18
+ files,
19
+ }, context);
20
+ }
21
+ catch (error) {
22
+ logger.error('Failed to sync files:', error);
23
+ throw error;
24
+ }
25
+ });
26
+ }
@@ -10,6 +10,7 @@ export function addSyncCommand(program) {
10
10
  .description('Syncs project from project-definition.json in baseplate/ directory')
11
11
  .option('--overwrite', 'Force overwrite existing files and apply snapshots automatically')
12
12
  .option('--snapshot <directory>', 'Apply diffs from snapshot directory (requires --overwrite)')
13
+ .option('--packages <packages...>', 'Only sync specific packages by name.')
13
14
  .action(async (project, options) => {
14
15
  const context = await createServiceActionContext();
15
16
  const projectWithDefault = project ??
@@ -21,6 +22,7 @@ export function addSyncCommand(program) {
21
22
  project: projectWithDefault,
22
23
  overwrite: options.overwrite,
23
24
  snapshotDirectory: options.snapshot,
25
+ packages: options.packages,
24
26
  }, context);
25
27
  });
26
28
  }
@@ -1,4 +1,5 @@
1
1
  import { getDefaultPlugins } from '@baseplate-dev/project-builder-common';
2
+ import { enhanceErrorWithContext } from '@baseplate-dev/utils';
2
3
  import path from 'node:path';
3
4
  import { logger } from '#src/services/logger.js';
4
5
  import { expandPathWithTilde } from '#src/utils/path.js';
@@ -128,8 +129,7 @@ async function handleExtractTemplates(project, app, options) {
128
129
  });
129
130
  }
130
131
  catch (error) {
131
- logger.error(`Failed to extract templates: ${error instanceof Error ? error.message : String(error)}`);
132
- throw error;
132
+ throw enhanceErrorWithContext(error, `Failed to extract templates from project ${project}`);
133
133
  }
134
134
  }
135
135
  async function handleGenerateTemplates(directory, options) {
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { addProjectsCommand } from './commands/projects.js';
7
7
  import { addServeCommand } from './commands/server.js';
8
8
  import { addSnapshotCommand } from './commands/snapshot.js';
9
9
  import { addSyncExamplesCommand } from './commands/sync-examples.js';
10
+ import { addSyncFileCommand } from './commands/sync-file.js';
10
11
  import { addSyncCommand } from './commands/sync.js';
11
12
  import { addTemplatesCommand } from './commands/templates.js';
12
13
  import { getEnabledFeatureFlags } from './services/feature-flags.js';
@@ -24,6 +25,7 @@ export async function runCli() {
24
25
  addSnapshotCommand(program);
25
26
  }
26
27
  addSyncCommand(program);
28
+ addSyncFileCommand(program);
27
29
  addSyncExamplesCommand(program);
28
30
  addDiffCommand(program);
29
31
  addServeCommand(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baseplate-dev/project-builder-cli",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
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": "^4.1.13",
49
- "@baseplate-dev/project-builder-common": "0.4.3",
50
- "@baseplate-dev/project-builder-lib": "0.4.3",
51
- "@baseplate-dev/project-builder-server": "0.4.3",
52
- "@baseplate-dev/project-builder-web": "0.4.3",
53
- "@baseplate-dev/utils": "0.4.3"
49
+ "@baseplate-dev/project-builder-common": "0.5.0",
50
+ "@baseplate-dev/project-builder-lib": "0.5.0",
51
+ "@baseplate-dev/project-builder-server": "0.5.0",
52
+ "@baseplate-dev/project-builder-web": "0.5.0",
53
+ "@baseplate-dev/utils": "0.5.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@playwright/test": "1.56.1",
@@ -61,8 +61,8 @@
61
61
  "prettier": "3.6.2",
62
62
  "tsx": "4.20.6",
63
63
  "typescript": "5.8.3",
64
- "vitest": "3.2.4",
65
- "@baseplate-dev/tools": "0.4.3"
64
+ "vitest": "4.0.16",
65
+ "@baseplate-dev/tools": "0.5.0"
66
66
  },
67
67
  "engines": {
68
68
  "node": "^22.0.0"