angelxmoreno / angelxmoreno/bun-sqlite-orm
[Feature]: Optimize Dependencies - Move to Peer Dependencies
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
**Problem Statement**
Currently, critical dependencies like `reflect-metadata` and `class-validator` are included as regular dependencies, which can lead to version conflicts and unnecessary bundle bloat for consumers who may already have these packages installed in their projects.
This approach prevents consumers from controlling the versions of these core libraries and can lead to:
- Duplicate installations of the same packages
- Version conflicts in consumer applications
- Larger bundle sizes
- Dependency management issues
**Proposed Solution**
Move appropriate packages to peer dependencies to give consumers better control over their dependency management:
**Candidates for Peer Dependencies:**
1. **`reflect-metadata`** - Core TypeScript decorator functionality
2. **`class-validator`** - Validation functionality (optional for users)
3. **`typescript`** - Already a peer dependency, but ensure consistency
**Keep as Regular Dependencies:**
- `tsyringe` - Internal DI container, users shouldn't manage this
- `pino` - After Issue #25 is resolved, should be peer dependency
**Example package.json changes**
```json
{
"dependencies": {
"tsyringe": "^4.10.0"
},
"peerDependencies": {
"reflect-metadata": "^0.2.2",
"class-validator": "^0.14.2",
"typescript": "^5.0.0",
"pino": "^9.7.0"
},
"peerDependenciesMeta": {
"class-validator": {
"optional": true
},
"pino": {
"optional": true
}
}
}
```
**Alternatives Considered**
1. **Keep Current Structure**: Maintain all as regular dependencies for simplicity
2. **Optional Dependencies**: Use optionalDependencies instead of peerDependencies
3. **Separate Packages**: Split functionality into separate packages (validation, logging, etc.)
**Impact**
- [ ] Query API
- [ ] Entity definitions
- [ ] Validation
- [ ] Migrations
- [x] Performance
- [ ] TypeScript types
- [x] Documentation
**Additional Context**
**Benefits:**
- Reduced bundle size for consumers
- Better version control for consumers
- Prevents duplicate package installations
- Follows npm best practices for library packages
- Allows consumers to opt-out of optional features
**Migration Strategy:**
- Mark as optional peer dependencies initially
- Provide clear installation instructions
- Update documentation with peer dependency requirements
- Consider automated peer dependency checking in installation scripts
**Breaking Change Considerations:**
- This would be a breaking change requiring major version bump
- Need clear migration guide for existing users
- Should provide compatibility warnings/helpers
**Priority**: Low-Medium - Improves ecosystem integration and bundle optimization
Contributor guide
Research direction
Start with package.json and review the current dependency declarations against the proposed peerDependencies and peerDependenciesMeta entries. Check Issue #25 before deciding how pino should be handled, then review the existing documentation for installation guidance. Done means the dependency strategy, migration guidance, and breaking-change impact are documented and consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, typescript
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100