Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/update-package-versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@baseplate-dev/core-generators': patch
'@baseplate-dev/react-generators': patch
---

Update package versions to match latest dependencies from main repo

- Update ESLint and related plugins to latest versions
- Update TypeScript ESLint to 8.38.0
- Update Prettier plugins to latest versions
- Update Tailwind CSS Prettier plugin to 0.6.14
11 changes: 0 additions & 11 deletions packages/core-generators/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Templates can now reference other templates within the same generator using the `$templateName` syntax. This enables templates to access file paths of other templates in the same generator during generation.

Key features:

- Use `$templateName` in template files to reference other generator templates
- Kebab-case template names are automatically converted to camelCase (e.g., `session-constants` → `sessionConstants`)
- Configure referenced templates using the `referencedGeneratorTemplates` field in extractor.json
Expand Down Expand Up @@ -63,7 +62,6 @@
This adds corresponding template renderers for text and raw templates, following the same pattern as TypeScript template renderers. The new renderers provide consistent APIs for generating template rendering functions that can be used in generator code.

Key features:

- Text template renderers support both individual templates and template groups
- Raw template renderers support individual templates (no groups needed)
- Full TypeScript type safety with proper action input types
Expand All @@ -75,50 +73,42 @@
- [#602](https://github.com/halfdomelabs/baseplate/pull/602) [`f0cb763`](https://github.com/halfdomelabs/baseplate/commit/f0cb7632f04bfb487722785fac7218d76d3b7e3b) Thanks [@kingston](https://github.com/kingston)! - Improve Docker Compose generation with security, resource management, and developer experience enhancements

## Version Upgrades

- Upgrade PostgreSQL from 16.2 to 17.5-alpine
- Upgrade Redis from 7.2.4 to 8.0-alpine
- For existing projects, follow the upgrade guide at https://docs.baseplate.dev/guides/upgrading-postgres/

## Security Improvements

- Use environment variables for all sensitive data (passwords, usernames)
- Add `security_opt: no-new-privileges:true` to prevent privilege escalation
- Fix Redis healthcheck to include authentication

## Networking

- Create custom bridge network for better isolation
- All services communicate over internal network

## Database Configuration

- Add PostgreSQL environment variables: `POSTGRES_DB`, `POSTGRES_INITDB_ARGS`
- Use default `postgres` user for simplicity in local development
- Add container names for easier management
- Improve volume configuration

## Redis Configuration

- Add Redis memory limits (256MB) and eviction policy (no-eviction for BullMQ)
- Configure maxmemory and maxmemory-policy

## Developer Experience

- Add logging configuration to prevent disk filling (10MB max, 3 files)
- Generate `.env.example` file with all available variables
- Improve health checks with start periods
- Better default values using project name
- Fix interface bug in redis.ts (PostgresConfig → RedisConfig)

## Breaking Changes

- PostgreSQL generator now requires additional config parameters (database, projectName)
- Redis generator now requires projectName parameter
- Generated Docker Compose files now use custom bridge network

- [#596](https://github.com/halfdomelabs/baseplate/pull/596) [`059edf7`](https://github.com/halfdomelabs/baseplate/commit/059edf771755f1ff846494f238d777a9d1f7f5d7) Thanks [@kingston](https://github.com/kingston)! - Simplify template metadata system by consolidating template definitions in extractor.json

- Consolidate template definitions in extractor.json using template names as keys instead of file paths
- Rename .template-metadata.json to .templates-info.json with simplified instance tracking
- Remove file-id-map.json dependency and related file ID mapping logic
Expand All @@ -139,7 +129,6 @@
This new plugin reduces template rendering boilerplate by 70-80% by automatically generating pre-configured rendering functions. It follows the same architectural pattern as the typed templates system, with a TypeScript-specific renderer function (`renderTsTemplateRenderers`) that generates generic definitions consumed by the plugin.

**Key Features:**

- **Simplified API**: Reduces complex `renderTemplate`/`renderTemplateGroup` calls to simple `renderers.templateName.render()` calls
- **Automatic Dependency Resolution**: Import map providers and task dependencies are automatically resolved
- **Type Safety**: Generated interfaces provide full TypeScript type safety
Expand Down
2 changes: 1 addition & 1 deletion packages/core-generators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"oxc-resolver": "5.2.0",
"p-limit": "6.1.0",
"prettier": "catalog:",
"prettier-plugin-packagejson": "2.5.11",
"prettier-plugin-packagejson": "2.5.19",
"resolve-from": "5.0.0",
"semver": "^7.5.4",
"sort-package-json": "2.10.1",
Expand Down
22 changes: 11 additions & 11 deletions packages/core-generators/src/constants/core-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ export const CORE_PACKAGES = {
typescript: '5.7.3',

// Linting
'@eslint/js': '9.26.0',
'@vitest/eslint-plugin': '1.1.44',
eslint: '9.26.0',
'eslint-config-prettier': '10.1.3',
'eslint-import-resolver-typescript': '4.4.1',
'eslint-plugin-import-x': '4.13.3',
'@eslint/js': '9.32.0',
'@vitest/eslint-plugin': '1.3.4',
eslint: '9.32.0',
'eslint-config-prettier': '10.1.8',
'eslint-import-resolver-typescript': '4.4.4',
'eslint-plugin-import-x': '4.16.1',
'eslint-plugin-jsx-a11y': '6.10.2',
'eslint-plugin-perfectionist': '4.12.3',
'eslint-plugin-perfectionist': '4.15.0',
'eslint-plugin-react': '7.37.5',
'eslint-plugin-react-hooks': '5.2.0',
'eslint-plugin-unicorn': '59.0.1',
'typescript-eslint': '8.32.0',
'eslint-plugin-unicorn': '60.0.0',
'typescript-eslint': '8.38.0',

// Formatting
prettier: '3.5.3',
'prettier-plugin-packagejson': '2.5.11',
prettier: '3.6.2',
'prettier-plugin-packagejson': '2.5.19',

// Testing
vitest: '3.0.7',
Expand Down
3 changes: 0 additions & 3 deletions packages/project-builder-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Additionally, introduces a new `baseplate sync` command (replacing `build`) with a `--force-overwrite` flag that respects ignore patterns when overwriting files.

Features:

- Uses `.baseplateignore` file in project root with gitignore-style syntax
- Includes sensible default patterns (.env, \*.log, node_modules/, dist/, build/, .DS_Store, Thumbs.db)
- Can be disabled with `--no-ignore-file` flag
Expand Down Expand Up @@ -62,7 +61,6 @@
Adds a new `baseplate diff` command that shows the difference between what would be generated and what currently exists in the working directory. This helps developers avoid losing code when they write in generated files and then revert to test generation.

Features:

- Shows unified diff format by default
- Supports `--compact` flag for summary format with change counts
- Supports `--app` flag to filter by specific applications
Expand All @@ -71,7 +69,6 @@
- Modular design with separate utilities for diffing, formatting, and comparison

- [#596](https://github.com/halfdomelabs/baseplate/pull/596) [`059edf7`](https://github.com/halfdomelabs/baseplate/commit/059edf771755f1ff846494f238d777a9d1f7f5d7) Thanks [@kingston](https://github.com/kingston)! - Add templates generate CLI command for regenerating template files without extraction

- Add `templates generate <directory> <app>` CLI command to regenerate template files from existing extractor.json configurations
- Add `--skip-clean` option to skip cleaning output directories
- Add `generateTemplateFiles` function in sync package that initializes plugins and writes generated files without running extraction
Expand Down
1 change: 0 additions & 1 deletion packages/project-builder-cli/src/commands/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function addSyncCommand(program: Command): void {
.option(
'--snapshot <directory>',
'Apply diffs from snapshot directory (requires --overwrite)',
'.baseplate-snapshot',
)
.action(
async (
Expand Down
4 changes: 0 additions & 4 deletions packages/project-builder-lib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
Previously, plugin migrations had mixed responsibilities - both transforming plugin config and mutating the project definition in the same unclear contract. This made the system hard to test and reason about.

**New Migration Interface:**

- `PluginMigrationResult` with explicit `updatedConfig` and `updateProjectDefinition` properties
- Clear separation between config transformations and project definition updates
- Better type safety and testability

**Schema Version Bug Fix:**

- Fixed bug where enabling plugins via UI didn't set `configSchemaVersion`
- Plugin card now uses `PluginUtils.setPluginConfig` to automatically set correct schema version
- Prevents unnecessary migrations when enabling new plugins

**Migration Updates:**

- All existing migrations updated to use new interface
- Auth plugin migration: simple config-only transformation
- Storage plugin migrations: migration #1 (config-only), migration #2 (config + project updates)
Expand Down Expand Up @@ -67,7 +64,6 @@
### Patch Changes

- [#587](https://github.com/halfdomelabs/baseplate/pull/587) [`b6bc11f`](https://github.com/halfdomelabs/baseplate/commit/b6bc11fdf199c8de40832eb88ea6f6cfc83aa5d7) Thanks [@kingston](https://github.com/kingston)! - Migrate reference system from ZodRef to transform-based architecture

- Complete migration from legacy ZodRef system to new transform-based reference processing using marker classes and schema transformations
- Implement `deserializeSchemaWithTransformedReferences` for integration testing with real-world usage patterns
- Replace `fixRefDeletions` implementation to use new transform system with `parseSchemaWithTransformedReferences`
Expand Down
5 changes: 0 additions & 5 deletions packages/project-builder-server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
Additionally, introduces a new `baseplate sync` command (replacing `build`) with a `--force-overwrite` flag that respects ignore patterns when overwriting files.

Features:

- Uses `.baseplateignore` file in project root with gitignore-style syntax
- Includes sensible default patterns (.env, \*.log, node_modules/, dist/, build/, .DS_Store, Thumbs.db)
- Can be disabled with `--no-ignore-file` flag
Expand Down Expand Up @@ -65,7 +64,6 @@
Adds a new `baseplate diff` command that shows the difference between what would be generated and what currently exists in the working directory. This helps developers avoid losing code when they write in generated files and then revert to test generation.

Features:

- Shows unified diff format by default
- Supports `--compact` flag for summary format with change counts
- Supports `--app` flag to filter by specific applications
Expand All @@ -78,12 +76,10 @@
This change updates the service file generation to use explicit `.crud.ts` naming instead of the previous `-service.ts` pattern. This provides better separation between generated CRUD operations and future hand-written business logic files, supporting the planned architectural split between generated and manual code.

Example changes:

- `user-service.ts` → `user.crud.ts`
- `todo-item-service.ts` → `todo-item.crud.ts`

- [#596](https://github.com/halfdomelabs/baseplate/pull/596) [`059edf7`](https://github.com/halfdomelabs/baseplate/commit/059edf771755f1ff846494f238d777a9d1f7f5d7) Thanks [@kingston](https://github.com/kingston)! - Simplify template metadata system by consolidating template definitions in extractor.json

- Consolidate template definitions in extractor.json using template names as keys instead of file paths
- Rename .template-metadata.json to .templates-info.json with simplified instance tracking
- Remove file-id-map.json dependency and related file ID mapping logic
Expand All @@ -92,7 +88,6 @@
- Add migration script to convert existing extractor.json files to new format

- [#596](https://github.com/halfdomelabs/baseplate/pull/596) [`059edf7`](https://github.com/halfdomelabs/baseplate/commit/059edf771755f1ff846494f238d777a9d1f7f5d7) Thanks [@kingston](https://github.com/kingston)! - Add templates generate CLI command for regenerating template files without extraction

- Add `templates generate <directory> <app>` CLI command to regenerate template files from existing extractor.json configurations
- Add `--skip-clean` option to skip cleaning output directories
- Add `generateTemplateFiles` function in sync package that initializes plugins and writes generated files without running extraction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { handleFileNotFoundError } from '@baseplate-dev/utils/node';
import { applyPatch } from 'diff';
import { readFile } from 'node:fs/promises';
import path from 'node:path';

import type { SnapshotManifest } from './snapshot-types.js';

export async function applySnapshotToFileContents(
relativePath: string,
generatedContents: string | Buffer,
snapshot: SnapshotManifest,
diffDirectory: string,
): Promise<string | Buffer | undefined | false> {
// If the file was purposely deleted, we skip the generation
if (snapshot.files.deleted.includes(relativePath)) {
return undefined;
}

// We do not support applying diffs to binary files
if (Buffer.isBuffer(generatedContents)) {
return generatedContents;
}

// Check for modified files
const fileEntry = snapshot.files.modified.find(
(file) => file.path === relativePath,
);
if (!fileEntry) {
return generatedContents;
}

const diffFilePath = path.join(diffDirectory, fileEntry.diffFile);
const diffFile = await readFile(diffFilePath, 'utf-8').catch(
handleFileNotFoundError,
);
if (!diffFile) {
throw new Error(`Diff file not found: ${diffFilePath}`);
}

return applyPatch(generatedContents, diffFile);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function applySnapshotToGeneratorOutput(
const fileData = generatorFiles.get(fileEntry.path);
if (!fileData) {
throw new Error(
`File not found in generator output: ${fileEntry.path}. Please run fix-diff to fix the diffs.`,
`File not found in generator output: ${fileEntry.path}. Please run snapshot fix-diff to fix the diffs.`,
);
}
const diffFilePath = path.join(diffDirectory, fileEntry.diffFile);
Expand All @@ -35,7 +35,7 @@ export async function applySnapshotToGeneratorOutput(
const newContents = applyPatch(fileData.contents.toString(), diffFile);
if (!newContents) {
throw new Error(
`Failed to apply patch to file ${fileEntry.path}. The patch may be invalid. Please run fix-diff to fix the diffs.`,
`Failed to apply patch to file ${fileEntry.path}. The patch may be invalid. Please run snapshot fix-diff to fix the diffs.`,
);
}
fileData.contents = newContents;
Expand Down
1 change: 1 addition & 0 deletions packages/project-builder-server/src/diff/snapshot/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './apply-diff-to-file-contents.js';
export * from './apply-diff-to-generator-output.js';
export * from './create-snapshot-for-project.js';
export * from './snapshot-management.js';
Expand Down
Loading