Skip to content

Commit 17f4b8e

Browse files
committed
feat: modernize blueprint with Node.js 24, tsup, and Volta
Major updates to the TypeScript monorepo blueprint: - Upgrade Node.js requirement to >=24 (latest LTS with enhanced TypeScript support) - Add Volta configuration for consistent Node.js and pnpm version management - Replace tsc with tsup as primary build tool for all packages - Convert all packages to ESM-first with "type": "module" - Add tsup configurations following modern SDK patterns - Update all dependencies to latest versions and resolve security vulnerabilities - Update pnpm to 10.26.2 and fix packageManager field - Enhance README with comprehensive build documentation - Fix lint-staged command for biome compatibility Build improvements: - Zero-config bundling with automatic TypeScript compilation - Tree shaking and source map generation - ESM module output with proper exports configuration - Faster builds and better development experience
1 parent fb4cf2e commit 17f4b8e

File tree

9 files changed

+765
-434
lines changed

9 files changed

+765
-434
lines changed

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TypeScript Monorepo Starter
22

3-
[![Node.js](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org/)
4-
[![pnpm](https://img.shields.io/badge/pnpm-8.15.4-orange.svg)](https://pnpm.io/)
3+
[![Node.js](https://img.shields.io/badge/node-%3E%3D24-brightgreen.svg)](https://nodejs.org/)
4+
[![pnpm](https://img.shields.io/badge/pnpm-10.26.2-orange.svg)](https://pnpm.io/)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
66

77
A modern TypeScript monorepo starter template with best practices for scalable projects.
@@ -10,9 +10,11 @@ A modern TypeScript monorepo starter template with best practices for scalable p
1010

1111
- 📦 [PNPM](https://pnpm.io/) for fast, disk-efficient package management
1212
- 🏎️ [Turborepo](https://turbo.build/repo) for high-performance build system
13+
- 📦 [tsup](https://tsup.egoist.dev/) for fast, zero-config bundling with TypeScript support
1314
- 🔍 [Biome](https://biomejs.dev/) for fast linting and formatting
1415
- ⚙️ [TypeScript](https://www.typescriptlang.org/) configured with modern Node LTS settings
1516
- 🧪 [Vitest](https://vitest.dev/) for unit testing
17+
-[Volta](https://volta.sh/) for Node.js and package manager version management
1618
- 📝 [Commitlint](https://commitlint.js.org/) with Conventional Commits
1719
- 🔄 [Changesets](https://github.com/changesets/changesets) for versioning and changelogs
1820
- 🚀 GitHub Actions for CI/CD with npm publishing
@@ -34,6 +36,7 @@ ts-monorepo/
3436
├── package.json # Root package.json
3537
├── pnpm-workspace.yaml # PNPM workspace config
3638
├── tsconfig.json # Base TypeScript config
39+
├── tsup.config.ts # tsup build configuration
3740
├── turbo.json # Turborepo config
3841
└── vitest.config.ts # Vitest config
3942
```
@@ -42,8 +45,8 @@ ts-monorepo/
4245

4346
### Prerequisites
4447

45-
- [Node.js](https://nodejs.org/) (v22 LTS or higher)
46-
- [PNPM](https://pnpm.io/) (v8 or higher)
48+
- [Volta](https://volta.sh/) for Node.js and pnpm version management (recommended)
49+
- Or [Node.js](https://nodejs.org/) (v24 LTS or higher) and [PNPM](https://pnpm.io/) (v10 or higher)
4750

4851
### Installation
4952

@@ -53,12 +56,22 @@ ts-monorepo/
5356
cd ts-monorepo
5457
```
5558

56-
2. Install dependencies
59+
2. Install Node.js and pnpm (if using Volta, this happens automatically)
60+
```bash
61+
# With Volta (recommended)
62+
63+
64+
# Or install manually
65+
# Install Node.js 24+ from https://nodejs.org
66+
# Install pnpm: npm install -g pnpm
67+
```
68+
69+
3. Install dependencies
5770
```bash
5871
pnpm install
5972
```
6073

61-
3. Build all packages
74+
4. Build all packages
6275
```bash
6376
pnpm build
6477
```
@@ -87,14 +100,25 @@ pnpm format
87100

88101
#### Building
89102

103+
This template uses [tsup](https://tsup.egoist.dev/) for fast, zero-config bundling with TypeScript support. All packages are built as ESM modules.
104+
90105
```bash
91106
# Build all packages
92107
pnpm build
93108

94109
# Build a specific package
95110
pnpm -F "@monorepo/core" build
111+
112+
# Watch mode for development
113+
pnpm -F "@monorepo/core" dev
96114
```
97115

116+
**Build Configuration:**
117+
- **Output**: ESM modules (`dist/index.js`)
118+
- **Types**: Generated automatically (`dist/index.d.ts`)
119+
- **Source maps**: Included for debugging
120+
- **Tree shaking**: Enabled for optimal bundle size
121+
98122
### Making Changes
99123

100124
1. Create a new branch

package.json

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,30 @@
1515
"format": "turbo format",
1616
"typecheck": "turbo typecheck",
1717
"prepare": "husky",
18-
"lint-staged": "biome check --write --no-errors-on-unmatched --files",
18+
"lint-staged": "biome check --write --no-errors-on-unmatched",
1919
"changeset": "changeset",
2020
"version": "changeset version",
2121
"release": "pnpm build && changeset publish"
2222
},
2323
"devDependencies": {
24-
"@biomejs/biome": "2.3.8",
24+
"@biomejs/biome": "2.3.10",
2525
"@changesets/cli": "^2.29.8",
2626
"@commitlint/cli": "^20.2.0",
2727
"@commitlint/config-conventional": "^20.2.0",
2828
"@tsconfig/node-lts": "^24.0.0",
29+
"@vitest/coverage-v8": "^4.0.16",
2930
"husky": "^9.1.7",
30-
"turbo": "^2.6.3",
31+
"tsup": "^8.5.1",
32+
"turbo": "^2.7.2",
3133
"typescript": "^5.9.3",
32-
"vitest": "^4.0.15",
33-
"@vitest/coverage-v8": "^4.0.15"
34+
"vitest": "^4.0.16"
3435
},
35-
"packageManager": "pnpm@9.15.4",
36+
"packageManager": "pnpm@10.26.2",
3637
"engines": {
37-
"node": ">=22"
38+
"node": ">=24"
39+
},
40+
"volta": {
41+
"node": "24.12.0",
42+
"pnpm": "10.26.2"
3843
}
3944
}

packages/core/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "@monorepo/core",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"main": "./dist/index.js",
67
"types": "./dist/index.d.ts",
78
"exports": {
89
".": {
910
"types": "./dist/index.d.ts",
10-
"import": "./dist/index.js",
11-
"require": "./dist/index.js"
11+
"import": "./dist/index.js"
1212
}
1313
},
1414
"scripts": {
15-
"build": "tsc",
16-
"dev": "tsc --watch",
15+
"build": "tsup",
16+
"dev": "tsup --watch",
1717
"clean": "rm -rf dist",
1818
"typecheck": "tsc --noEmit",
1919
"lint": "biome lint ./src",
@@ -22,6 +22,7 @@
2222
"test:watch": "vitest"
2323
},
2424
"devDependencies": {
25+
"tsup": "^8.5.1",
2526
"typescript": "^5.9.3"
2627
}
2728
}

packages/core/tsup.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig({
4+
entry: ['src/index.ts'],
5+
format: ['esm'],
6+
dts: true,
7+
splitting: false,
8+
sourcemap: true,
9+
clean: true,
10+
treeshake: true,
11+
minify: false,
12+
outDir: 'dist',
13+
skipNodeModulesBundle: true,
14+
});

packages/feature-a/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "@monorepo/feature-a",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"main": "./dist/index.js",
67
"types": "./dist/index.d.ts",
78
"exports": {
89
".": {
910
"types": "./dist/index.d.ts",
10-
"import": "./dist/index.js",
11-
"require": "./dist/index.js"
11+
"import": "./dist/index.js"
1212
}
1313
},
1414
"scripts": {
15-
"build": "tsc",
16-
"dev": "tsc --watch",
15+
"build": "tsup",
16+
"dev": "tsup --watch",
1717
"clean": "rm -rf dist",
1818
"typecheck": "tsc --noEmit",
1919
"lint": "biome lint ./src",
@@ -26,6 +26,7 @@
2626
"@monorepo/utils": "workspace:*"
2727
},
2828
"devDependencies": {
29+
"tsup": "^8.5.1",
2930
"typescript": "^5.9.3"
3031
}
3132
}

packages/feature-a/tsup.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig({
4+
entry: ['src/index.ts'],
5+
format: ['esm'],
6+
dts: true,
7+
splitting: false,
8+
sourcemap: true,
9+
clean: true,
10+
treeshake: true,
11+
minify: false,
12+
outDir: 'dist',
13+
skipNodeModulesBundle: true,
14+
});

packages/utils/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"name": "@monorepo/utils",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"main": "./dist/index.js",
67
"types": "./dist/index.d.ts",
78
"exports": {
89
".": {
910
"types": "./dist/index.d.ts",
10-
"import": "./dist/index.js",
11-
"require": "./dist/index.js"
11+
"import": "./dist/index.js"
1212
}
1313
},
1414
"scripts": {
15-
"build": "tsc",
16-
"dev": "tsc --watch",
15+
"build": "tsup",
16+
"dev": "tsup --watch",
1717
"clean": "rm -rf dist",
1818
"typecheck": "tsc --noEmit",
1919
"lint": "biome lint ./src",
@@ -25,6 +25,7 @@
2525
"@monorepo/core": "workspace:*"
2626
},
2727
"devDependencies": {
28+
"tsup": "^8.5.1",
2829
"typescript": "^5.9.3"
2930
}
3031
}

packages/utils/tsup.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig({
4+
entry: ['src/index.ts'],
5+
format: ['esm'],
6+
dts: true,
7+
splitting: false,
8+
sourcemap: true,
9+
clean: true,
10+
treeshake: true,
11+
minify: false,
12+
outDir: 'dist',
13+
skipNodeModulesBundle: true,
14+
});

0 commit comments

Comments
 (0)