Releases: samuelho-dev/monorepo-library-generator
v1.9.1
Full Changelog: v1.9.0...v1.9.1
v1.8.1
Naming conventions and linter fixes
v1.8.0
Type safety improvements for Effect templates
v1.7.1
Bug Fixes
- Fix catchTags type inference for Effect error channels
Problem
TypeScript was inferring never for catchTags handlers because errors weren't properly in the Effect error channel.
Solution
- Service template now adds existence checks before update/delete that explicitly throw
NotFoundError - Handlers template now catches
DatabaseInternalErrorin addition to domain errors - Removed unused error imports (catchTags uses string literals, not runtime types)
- Uses centralized
envmodule instead of directprocess.envaccess
Breaking Changes: None - this is a fix for generated code that was previously not type-safe.
v1.7.0
Features
- Comprehensive biome lint compliance for all generator templates
- Improved code formatting and linting across all generated libraries
v1.5.2 - Remove Type Coercions and Assertions
Patch Changes
Remove unnecessary type coercions and assertions
This patch demonstrates TypeScript's type inference capabilities by removing all unnecessary type coercions, assertions, and type narrowing from generated code templates.
Changes:
-
Repository Interface Template - Replaced test layer
as anyassertions with honest placeholder implementations usingEffect.dieMessage. Test layers now guide developers to provide their own mocks. -
Repository Template - Removed non-null assertions and type casts:
- Replaced
store.get(id)\!withOption.fromNullable(store.get(id)) - Replaced
Effect.fail(...) as Effect.Effect<T, never, never>withEffect.dieMessage(...)
- Replaced
-
Provider Service Interface Template - Replaced test layer type assertions with placeholder implementations. No more
as Resourceoras PaginatedResultassertions. -
Provider Service Template - Improved config pattern:
- Replaced
||with??for default values (properly handles falsy values like 0) - Removed
\!non-null assertions on retry config (nullish coalescing ensures values are never undefined) - Removed
as consttype narrowing on health check status
- Replaced
-
TypeScript Builder - Replaced
targetMap.get(from)\!with proper undefined check that throws descriptive error.
Architecture Improvement:
Test layers now use honest placeholder implementations instead of creating mock entities with type assertions. This approach:
- Achieves zero type assertions without compromising branded type safety
- Guides developers to provide their own test implementations
- Demonstrates proper type-driven design where TypeScript infers types from schemas and interfaces
Breaking Changes: None - this is a patch release focusing on internal code quality improvements.
Install:
npm install @samuelho-dev/monorepo-library-generator@1.5.2npm: https://www.npmjs.com/package/@samuelho-dev/monorepo-library-generator/v/1.5.2
v1.5.1
v1.5.1 - Feature Consolidation & Dynamic Versioning
🎯 New Features
Feature Consolidation Architecture
Generate consolidated feature packages with modular sub-services and provider aggregation patterns.
Sub-Services for Feature Packages (includeSubServices option)
NX Unable to resolve @samuelho-dev/monorepo-library-generator:feature.
Unable to resolve local plugin with import path @samuelho-dev/monorepo-library-generator
Pass --verbose to see the stacktrace.
Generates organized service directory structure:
feature-cluster/
└── src/lib/server/services/
├── index.ts # Barrel export
├── backup/ # Individual sub-services
├── checkpoint/ # Each with service.ts, layers.ts
├── config/ # errors.ts, types.ts, index.ts
├── credentials/
└── discovery/
Provider Consolidation for Infra Packages (consolidatesProviders option)
NX Unable to resolve @samuelho-dev/monorepo-library-generator:infra.
Unable to resolve local plugin with import path @samuelho-dev/monorepo-library-generator
Pass --verbose to see the stacktrace.
Generates aggregated infrastructure layer:
// index.ts - Re-export all providers
export { Kubectl, Talos, Terraform, ArgoCD }
export { ClusterInfrastructureLive } from "./lib/layers"
export { ClusterOrchestrator } from "./lib/orchestrator"
// layers.ts - Merge all provider layers
export const ClusterInfrastructureLive = Layer.mergeAll(
KubectlLive, TalosLive, TerraformLive, ArgoCDLive
)
// orchestrator.ts - Multi-provider coordination
export class ClusterOrchestrator extends Context.Tag("ClusterOrchestrator")<
ClusterOrchestrator,
{ /* orchestration methods */ }
>() {}Templates Added (10 new files):
- Sub-service templates: service, layers, errors, types, index
- Provider consolidation: index, layers, orchestrator
- Core generators: sub-services.ts, provider-consolidation.ts
Dynamic Version System
CLI and MCP server now dynamically read version from package.json instead of hardcoded values.
- Auto-generates
src/version.tsduring build viascripts/generate-version.mjs - Version stays in sync across package.json, CLI output, and MCP server
- Added to prebuild script for automatic generation
🐛 Bug Fixes
Template Interpolation (src/generators/provider/templates/layers.template.ts)
- Fixed className interpolation using template literals instead of regular strings
- Now correctly generates
StripeInternalErrorinstead of literal${className}InternalError
Build System
- Fixed TypeScript compilation errors (unused variables, incorrect Effect imports)
- Updated publish script to use
test:cifor proper test execution - All 166 files now compile successfully
Test Infrastructure
- Fixed test expectations to match actual template output
- Updated vitest.config.local.ts to include
src/**/*.spec.ts - Added
fileParallelism: falseto prevent NX graph conflicts - Increased timeout to 30s for generator tests
- All 205 tests now passing
📊 Impact
Files Changed: 28 files
- Added: 11 files (+688 lines)
- Modified: 17 files (-23 lines)
Generator Enhancements:
- Feature generator: Sub-service architecture support
- Infra generator: Provider consolidation support
- Build system: Dynamic version management
- Template engine: Fixed interpolation bugs
🔧 Technical Details
Schema Updates:
feature/schema.json: AddedincludeSubServices,subServicesoptionsinfra/schema.json: AddedconsolidatesProviders,providersoptions
Core Generator Changes:
core/feature.ts: Integrated sub-service generationcore/infra.ts: Integrated provider consolidation with conditional index generation- Concurrent file generation with Effect.forEach
Backward Compatibility: ✅ Fully backward compatible
- New options are optional (default: false)
- Existing generators work unchanged
- No breaking changes to templates or APIs
📦 Package: @samuelho-dev/monorepo-library-generator@1.5.1
📚 Changelog: See CHANGELOG.md
🐛 Issues: Report bugs
v1.5.0
Minor Changes
Dotfiles Architecture Fix & Workspace Initialization
Breaking Changes:
- Removed
includeVSCodeSettingsoption from all generator schemas - Libraries no longer generate workspace-level dotfiles (
.editorconfig,.vscode/*)
New Features:
- CLI Command:
init-workspace- Initialize workspace-level dotfiles at repository root - MCP Tool:
init_workspace- AI agents can now initialize workspace dotfiles via MCP protocol
Architectural Improvements:
- Clean separation between workspace-level dotfiles (created once at root) and library-level dotfiles (created per library)
- See migration guide in CHANGELOG.md
Provider Type Specialization
Added support for four provider integration patterns:
- SDK Wrapper (default) - For npm packages with TypeScript SDKs
- CLI Wrapper - For command-line tools (Docker, Git, etc.)
- HTTP/REST API - For REST APIs with authentication support
- GraphQL API - For GraphQL endpoints with query/mutation support
New Usage Examples:
# SDK Wrapper (default)
nx g @workspace:provider stripe --externalService="Stripe" --providerType=sdk
# CLI Wrapper
nx g @workspace:provider docker --externalService="Docker" --providerType=cli --cliCommand="docker"
# HTTP/REST API
nx g @workspace:provider acme-api --externalService="Acme API" --providerType=http --baseUrl="https://api.acme.com"
# GraphQL API
nx g @workspace:provider hasura --externalService="Hasura" --providerType=graphql --baseUrl="https://api.hasura.io/v1/graphql"Comprehensive Effect.ts Patterns Audit
Documentation Improvements:
- Added control flow decision matrix (Effect.if/when/unless)
- Added Effect.all batch operations guide with concurrency patterns
- Expanded Effect running patterns section with clear decision matrix
- Added 400+ line "Decision Matrices & Quick Reference" section
Production Patterns:
- Stream Patterns: Added
streamAllmethod to repository interface - Queue Patterns: Already comprehensive (no changes needed)
- Observability: Added comprehensive Effect.tap success-path patterns
- Decision Matrices: Master decision trees for 6 categories
Test Coverage:
✅ All 205 tests passing
✅ Manual verification of generated libraries
✅ Workspace initialization tested
Impact:
- Developers can now generate providers for CLI tools, HTTP APIs, and GraphQL endpoints
- Production-ready code generation for all four patterns
- 100% backward compatible - existing SDK provider generation unchanged
v1.2.4
1.2.4
Patch Changes
-
Fix build system reliability and resolve all linting errors across generator templates
- Add prebuild cleanup script for consistent 130-file compilation
- Fix Effect.orDie type inference (remove unnecessary type assertions)
- Remove explicit return type annotations from all templates
- Fix unused parameter naming across all generators
- Update vitest config for @effect/dprint compliance
- Fix infrastructure generation issues
- All 159 tests passing, 0 linting errors
v1.2.3 - Bundle Optimization for Contract Libraries
🌳 Bundle Optimization
This release introduces bundle optimization features for contract libraries, enabling better tree-shaking and smaller production bundles.
✨ New Features
- Separate Entity Files: Each entity is now generated in its own file for optimal tree-shaking
- Granular Package Exports: Package.json includes specific subpath exports for each entity
- Type-Only Imports: Zero-runtime-overhead type imports via dedicated
/typesexport - Comma-Separated CLI Syntax: Pass multiple entities easily:
--entities=Product,ProductCategory,ProductReview
📦 Import Examples
// Granular imports (best for tree-shaking)
import { Product } from '@repo/contract-product/entities/product'
// Type-only imports (zero bundle impact)
import type { Product } from '@repo/contract-product/types'
// Barrel imports (convenience)
import { Product } from '@repo/contract-product/entities'🔧 Fixed
- Fixed generators.json packaging for Nx generator discovery
- Fixed entity parameter parsing from CLI arguments
- Corrected package.json repository URL and bin path format
📝 Usage
# Install or update
npm install -g @samuelho-dev/monorepo-library-generator
# Generate contract library with multiple entities
mlg contract product --entities=Product,ProductCategory,ProductReview🎯 Bundle Impact
Contract libraries now support:
- ✓ Separate entity files for tree-shaking
- ✓ Granular package.json exports per entity
- ✓ Type-only imports with zero runtime overhead
- ✓ Proper barrel files for convenience imports
🤖 Generated with Claude Code