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
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
interval: 'daily'
- package-ecosystem: 'docker'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
dist-zip
coverage
*.tgz
tests/test-nextjs/.next
7 changes: 7 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
tabWidth: 2,
semi: true,
singleQuote: true,
trailingComma: 'all',
printWidth: 120,
};
22 changes: 22 additions & 0 deletions BUILD_IMPROVEMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,53 @@ This document outlines the improvements made to the pp-dev package build system
## πŸš€ Build Performance Improvements

### 1. Parallel Builds

- **Before**: Sequential builds (ESM β†’ CJS β†’ Client)
- **After**: Parallel builds using `npm run build:parallel`
- **Benefit**: ~40-60% faster build times

### 2. Enhanced Tree-Shaking

- Improved module side effects detection
- Better property read side effects handling
- Strict entry signature preservation

### 3. Optimized TypeScript Compilation

- Incremental compilation enabled
- Build info caching with `.tsbuildinfo`
- Optimized dependency change detection

## πŸ“¦ Build Outputs

### ESM Build (`dist/esm/`)

- Modern ES modules format
- Optimized for tree-shaking
- Source maps included

### CJS Build (`dist/cjs/`)

- CommonJS format for Node.js compatibility
- Optimized for server-side usage
- Source maps included

### Type Definitions (`dist/types/`)

- Full TypeScript declarations
- Declaration maps for better IDE support
- Clean, optimized type output

### Client Build (`dist/client/`)

- Optimized CSS with SCSS compilation
- Asset handling with proper public paths
- Source maps for debugging

## πŸ› οΈ Build Scripts

### Production Builds

```bash
# Standard build (parallel)
npm run build
Expand All @@ -56,6 +64,7 @@ npm run clean && npm run build
```

### Development Builds

```bash
# Fast build (parallel)
npm run build:fast
Expand All @@ -68,6 +77,7 @@ npm run build:analyze
```

### Optimization

```bash
# Run build optimizations
npm run build:optimize
Expand All @@ -79,12 +89,14 @@ npm run build:optimize
## ⚑ Build Tools

### Rollup (Primary)

- Advanced tree-shaking
- Plugin ecosystem
- Source map generation
- Bundle analysis support

### Rollup (Primary)

- Advanced tree-shaking
- Plugin ecosystem
- Source map generation
Expand All @@ -101,17 +113,20 @@ The build system includes bundle analysis capabilities:
## πŸ”§ Configuration Files

### Rollup Config (`rollup.config.ts`)

- Multi-format builds (ESM, CJS, Types)
- Optimized external dependency handling
- Enhanced terser configuration
- Better source map generation

### Esbuild Config (`esbuild.config.ts`)

- Alternative build system for experimentation
- Simplified TypeScript builds
- Build metadata generation

### TypeScript Configs

- `tsconfig.json` - Base configuration
- `tsconfig.esm.json` - ESM-specific settings
- `tsconfig.cjs.json` - CJS-specific settings
Expand All @@ -120,40 +135,47 @@ The build system includes bundle analysis capabilities:
## πŸ“ˆ Performance Metrics

### Build Times (approximate)

- **Before**: ~15-20 seconds
- **After (Rollup)**: ~8-12 seconds
- **After (Parallel)**: ~5-8 seconds

### Bundle Sizes

- Optimized tree-shaking reduces bundle size by 15-25%
- Better external dependency handling
- Improved code splitting

## 🎯 Best Practices

### For Development

1. Use `npm run build:fast` for quick iterations
2. Use `npm run build:watch` for continuous builds
3. Run `npm run build:optimize` to apply optimizations

### For Production

1. Use `npm run build` for full builds
2. Run `npm run build:analyze` to check bundle sizes
3. Verify all formats are generated correctly

### For CI/CD

1. Use `npm run build:parallel` for faster CI builds
2. Include bundle analysis in release process
3. Monitor build performance metrics

## πŸ” Troubleshooting

### Common Issues

1. **Build failures**: Check TypeScript configuration
2. **Slow builds**: Ensure parallel builds are enabled
3. **Large bundles**: Run bundle analysis to identify issues

### Performance Issues

1. **Memory usage**: Monitor Node.js memory limits
2. **CPU usage**: Check for unnecessary TypeScript compilation
3. **Disk I/O**: Ensure SSD storage for faster builds
Expand Down
Loading