ts-builds 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +103 -217
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,148 +1,148 @@
1
1
  # ts-builds
2
2
 
3
- [![Validate Configs Package](https://github.com/jordanburke/ts-builds/actions/workflows/node.js.yml/badge.svg)](https://github.com/jordanburke/ts-builds/actions/workflows/node.js.yml)
3
+ [![npm version](https://img.shields.io/npm/v/ts-builds.svg)](https://www.npmjs.com/package/ts-builds)
4
+ [![Validate](https://github.com/jordanburke/ts-builds/actions/workflows/node.js.yml/badge.svg)](https://github.com/jordanburke/ts-builds/actions/workflows/node.js.yml)
4
5
 
5
- Shared TypeScript configuration files for library templates. Provides standardized ESLint, Prettier, Vitest, TypeScript, and build configs.
6
+ Shared TypeScript build tooling. Bundles ESLint, Prettier, Vitest, TypeScript and provides a CLI for running standardized commands across projects.
6
7
 
7
- ## 📦 What's Included
8
+ ## Quick Start
8
9
 
9
- This package provides base configuration files for TypeScript library templates:
10
+ ### New Project
10
11
 
11
- ### Locked Configs (Use As-Is)
12
-
13
- - **`.prettierrc`** - Code formatting rules
14
- - **`.prettierignore`** - Files to ignore from formatting
15
-
16
- ### Extendable Configs (Can Be Customized)
12
+ ```bash
13
+ mkdir my-library && cd my-library
14
+ pnpm init
17
15
 
18
- - **`eslint.config.base.mjs`** - Base ESLint rules + TypeScript support
19
- - **`vitest.config.base.ts`** - Vitest test framework configuration
20
- - **`tsconfig.base.json`** - TypeScript compiler base settings
21
- - **`tsdown.config.base.ts`** - Build configuration for tsdown
22
- - **`package-scripts.json`** - Standardized npm scripts reference
16
+ # Install (bundles all tooling)
17
+ pnpm add -D ts-builds tsdown
23
18
 
24
- ## 🚀 Installation
19
+ # Initialize
20
+ npx ts-builds init # Creates .npmrc with hoist patterns
21
+ npx ts-builds config # Creates ts-builds.config.json
25
22
 
26
- ```bash
27
- pnpm add -D ts-builds
23
+ # Create source files
24
+ mkdir src test
25
+ echo 'export const hello = () => "Hello!"' > src/index.ts
28
26
 
29
- # Also install peer dependency:
30
- pnpm add -D tsdown
27
+ # Validate
28
+ npx ts-builds validate
31
29
  ```
32
30
 
33
- ## 🛠️ CLI Commands
34
-
35
- ### Initialize Project
31
+ ### Existing Project
36
32
 
37
33
  ```bash
38
- npx ts-builds
39
- # or
40
- npx ts-builds init
41
- ```
34
+ pnpm add -D ts-builds tsdown
42
35
 
43
- Creates `.npmrc` to configure pnpm to hoist CLI binaries from peer dependencies.
36
+ npx ts-builds init # Creates .npmrc
37
+ npx ts-builds config # Creates config file
38
+ npx ts-builds cleanup # Remove redundant dependencies
44
39
 
45
- ### Show Help
46
-
47
- ```bash
48
- npx ts-builds help
40
+ npx ts-builds validate
49
41
  ```
50
42
 
51
- ### List Bundled Packages
43
+ ## CLI Commands
44
+
45
+ ### Setup Commands
52
46
 
53
47
  ```bash
54
- npx ts-builds info
48
+ npx ts-builds init # Create .npmrc with hoist patterns
49
+ npx ts-builds config # Create ts-builds.config.json
50
+ npx ts-builds config --force # Overwrite existing config
51
+ npx ts-builds info # Show bundled packages
52
+ npx ts-builds cleanup # Remove redundant dependencies
53
+ npx ts-builds help # Show all commands
55
54
  ```
56
55
 
57
- Shows all 19 packages bundled with this config (eslint, prettier, typescript, vitest, etc.) that you **don't need to install separately**.
58
-
59
- ### Remove Redundant Dependencies
56
+ ### Script Commands
60
57
 
61
58
  ```bash
62
- npx ts-builds cleanup
63
- # or auto-confirm with
64
- npx ts-builds cleanup --yes
59
+ npx ts-builds validate # Run full validation chain
60
+ npx ts-builds format # Format with Prettier
61
+ npx ts-builds format:check # Check formatting only
62
+ npx ts-builds lint # Lint with ESLint (--fix)
63
+ npx ts-builds lint:check # Check lint only
64
+ npx ts-builds typecheck # TypeScript type checking
65
+ npx ts-builds test # Run tests once
66
+ npx ts-builds test:watch # Watch mode
67
+ npx ts-builds test:coverage # With coverage
68
+ npx ts-builds build # Production build
69
+ npx ts-builds dev # Watch mode build
65
70
  ```
66
71
 
67
- Scans your `package.json` and removes any devDependencies that are already bundled with `ts-builds`.
68
-
69
- ### Minimal Installation
72
+ ## Package.json Scripts
70
73
 
71
- Since this package bundles all tooling, you only need:
74
+ Add these to delegate all commands to ts-builds:
72
75
 
73
76
  ```json
74
77
  {
75
- "devDependencies": {
76
- "ts-builds": "^1.0.0",
77
- "tsdown": "^0.12.0"
78
+ "scripts": {
79
+ "validate": "ts-builds validate",
80
+ "format": "ts-builds format",
81
+ "format:check": "ts-builds format:check",
82
+ "lint": "ts-builds lint",
83
+ "lint:check": "ts-builds lint:check",
84
+ "typecheck": "ts-builds typecheck",
85
+ "test": "ts-builds test",
86
+ "test:watch": "ts-builds test:watch",
87
+ "build": "ts-builds build",
88
+ "dev": "ts-builds dev",
89
+ "prepublishOnly": "pnpm validate"
78
90
  }
79
91
  }
80
92
  ```
81
93
 
82
- **For local development** (testing before publishing):
83
-
84
- ```bash
85
- # Build first, then test
86
- pnpm build
87
- node dist/cli.js help
88
-
89
- # Or link globally
90
- pnpm link --global
91
- ts-builds help
92
- ```
93
-
94
- ## 📖 Usage
94
+ ## Configuration
95
95
 
96
- ### Prettier (Locked - Use Exact Copy)
96
+ Create `ts-builds.config.json` to customize behavior:
97
97
 
98
- Copy the Prettier config to your project root:
98
+ ### Basic
99
99
 
100
- ```bash
101
- cp node_modules/ts-builds/.prettierrc .
102
- cp node_modules/ts-builds/.prettierignore .
100
+ ```json
101
+ {
102
+ "srcDir": "./src",
103
+ "validateChain": ["format", "lint", "typecheck", "test", "build"]
104
+ }
103
105
  ```
104
106
 
105
- Or reference it in your `package.json`:
107
+ ### Advanced (Monorepos, Custom Commands)
106
108
 
107
109
  ```json
108
110
  {
109
- "prettier": "ts-builds/prettier"
111
+ "srcDir": "./src",
112
+ "commands": {
113
+ "compile": "tsc",
114
+ "docs:validate": "pnpm docs:build && pnpm docs:check",
115
+ "landing:validate": { "run": "pnpm validate", "cwd": "./landing" }
116
+ },
117
+ "chains": {
118
+ "validate": ["validate:core", "validate:landing"],
119
+ "validate:core": ["format", "lint", "compile", "test", "docs:validate", "build"],
120
+ "validate:landing": ["landing:validate"]
121
+ }
110
122
  }
111
123
  ```
112
124
 
113
- ### ESLint (Extendable)
125
+ Run named chains:
114
126
 
115
- **Basic usage (inherit all base rules):**
127
+ ```bash
128
+ npx ts-builds validate:core
129
+ npx ts-builds validate:landing
130
+ ```
116
131
 
117
- ```javascript
118
- // eslint.config.mjs
119
- import baseConfig from "ts-builds/eslint"
132
+ ## Extendable Configs
120
133
 
121
- export default [...baseConfig]
122
- ```
134
+ ts-builds exports base configurations you can extend:
123
135
 
124
- **Extended usage (add variant-specific rules):**
136
+ ### ESLint
125
137
 
126
138
  ```javascript
127
139
  // eslint.config.mjs
128
140
  import baseConfig from "ts-builds/eslint"
129
141
 
130
- export default [
131
- ...baseConfig,
132
- {
133
- // React-specific rules
134
- files: ["**/*.tsx"],
135
- rules: {
136
- "react/jsx-uses-react": "error",
137
- "react-hooks/rules-of-hooks": "error",
138
- },
139
- },
140
- ]
142
+ export default [...baseConfig]
141
143
  ```
142
144
 
143
- ### Vitest (Extendable)
144
-
145
- **Basic usage:**
145
+ ### Vitest
146
146
 
147
147
  ```typescript
148
148
  // vitest.config.ts
@@ -152,25 +152,7 @@ import baseConfig from "ts-builds/vitest"
152
152
  export default defineConfig(baseConfig)
153
153
  ```
154
154
 
155
- **Extended usage:**
156
-
157
- ```typescript
158
- // vitest.config.ts
159
- import { defineConfig } from "vitest/config"
160
- import baseConfig from "ts-builds/vitest"
161
-
162
- export default defineConfig({
163
- ...baseConfig,
164
- test: {
165
- ...baseConfig.test,
166
- setupFiles: ["./test/setup.ts"], // Add custom setup
167
- },
168
- })
169
- ```
170
-
171
- ### TypeScript (Extendable)
172
-
173
- **Basic usage:**
155
+ ### TypeScript
174
156
 
175
157
  ```json
176
158
  {
@@ -181,22 +163,7 @@ export default defineConfig({
181
163
  }
182
164
  ```
183
165
 
184
- **Extended usage:**
185
-
186
- ```json
187
- {
188
- "extends": "ts-builds/tsconfig",
189
- "compilerOptions": {
190
- "outDir": "./dist",
191
- "jsx": "react-jsx",
192
- "lib": ["ES2020", "DOM"]
193
- }
194
- }
195
- ```
196
-
197
- ### Tsdown (Extendable)
198
-
199
- **Basic usage:**
166
+ ### tsdown
200
167
 
201
168
  ```typescript
202
169
  // tsdown.config.ts
@@ -205,106 +172,25 @@ import baseConfig from "ts-builds/tsdown"
205
172
  export default baseConfig
206
173
  ```
207
174
 
208
- **Extended usage (customize entry points):**
209
-
210
- ```typescript
211
- // tsdown.config.ts
212
- import baseConfig from "ts-builds/tsdown"
213
- import type { UserConfig } from "tsdown"
214
-
215
- export default {
216
- ...baseConfig,
217
- entry: ["src/index.ts", "src/cli.ts"], // Multiple entry points
218
- } satisfies UserConfig
219
- ```
220
-
221
- ### Package Scripts (Reference Only)
222
-
223
- The `package-scripts.json` file contains standardized npm scripts. Copy the relevant scripts to your `package.json`:
175
+ ### Prettier
224
176
 
225
177
  ```json
226
178
  {
227
- "scripts": {
228
- "validate": "pnpm format && pnpm lint && pnpm test && pnpm build",
229
- "format": "prettier --write .",
230
- "format:check": "prettier --check .",
231
- "lint": "eslint ./src --fix",
232
- "lint:check": "eslint ./src",
233
- "test": "vitest run",
234
- "test:watch": "vitest",
235
- "test:coverage": "vitest run --coverage",
236
- "test:ui": "vitest --ui",
237
- "build": "rimraf dist && cross-env NODE_ENV=production tsdown",
238
- "build:watch": "tsdown --watch",
239
- "dev": "tsdown --watch",
240
- "prepublishOnly": "pnpm validate",
241
- "ts-types": "tsc"
242
- }
179
+ "prettier": "ts-builds/prettier"
243
180
  }
244
181
  ```
245
182
 
246
- ## 🔄 Update Workflow
247
-
248
- When configs are updated in this package, update your template:
249
-
250
- ```bash
251
- # Update to latest version
252
- pnpm update ts-builds
253
-
254
- # Re-copy locked files (Prettier)
255
- cp node_modules/ts-builds/.prettierrc .
256
- cp node_modules/ts-builds/.prettierignore .
257
-
258
- # Test that everything still works
259
- pnpm validate
260
- ```
261
-
262
- ## 🎯 Design Philosophy
263
-
264
- ### Locked vs Extendable
265
-
266
- **Locked files** ensure consistency across all templates:
267
-
268
- - **Prettier** - Code formatting should be identical everywhere
269
- - Prevents formatting debates and merge conflicts
270
-
271
- **Extendable files** allow variant-specific customization:
272
-
273
- - **ESLint** - Different variants need different rules (React, Node.js, etc.)
274
- - **Vitest** - Some variants need custom test setup
275
- - **TypeScript** - Browser vs Node targets, JSX support, etc.
276
- - **Build configs** - Different entry points, output formats
277
-
278
- ### Semantic Versioning
279
-
280
- This package follows semver:
281
-
282
- - **Patch** (1.0.x) - Bug fixes in configs
283
- - **Minor** (1.x.0) - New configs added, backward compatible
284
- - **Major** (x.0.0) - Breaking changes to existing configs
285
-
286
- ## 📚 Available Template Variants
287
-
288
- Templates using these configs:
289
-
290
- - **[typescript-library-template](https://github.com/jordanburke/typescript-library-template)** - Base template (tsdown)
291
- - **typescript-library-template-vite** - Vite-based variant (coming soon)
292
- - **typescript-library-template-react** - React library variant (coming soon)
293
-
294
- ## 🤝 Contributing
295
-
296
- Found a bug or want to improve the configs?
297
-
298
- 1. Fork this repository
299
- 2. Make your changes
300
- 3. Test in a template project
301
- 4. Submit a PR with explanation
183
+ ## Bundled Packages
302
184
 
303
- ## 📄 License
185
+ Run `npx ts-builds info` to see all bundled packages. You don't need to install:
304
186
 
305
- MIT © Jordan Burke
187
+ - eslint, prettier, typescript, vitest
188
+ - @typescript-eslint/eslint-plugin, @typescript-eslint/parser
189
+ - eslint-config-prettier, eslint-plugin-prettier, eslint-plugin-import
190
+ - @vitest/coverage-v8, @vitest/ui
191
+ - cross-env, rimraf, ts-node
192
+ - And more...
306
193
 
307
- ## 🔗 Related
194
+ ## License
308
195
 
309
- - [STANDARDIZATION_GUIDE.md](./STANDARDIZATION_GUIDE.md) - How to apply this pattern
310
- - [package-scripts.json](./package-scripts.json) - Script reference documentation
196
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-builds",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Shared TypeScript configuration files for library templates. Provides standardized ESLint, Prettier, Vitest, TypeScript, and build configs.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -49,9 +49,9 @@
49
49
  "dependencies": {
50
50
  "@eslint/eslintrc": "^3.3.3",
51
51
  "@eslint/js": "^9.39.1",
52
- "@types/node": "^22.19.1",
53
- "@typescript-eslint/eslint-plugin": "^8.48.1",
54
- "@typescript-eslint/parser": "^8.48.1",
52
+ "@types/node": "^24.10.2",
53
+ "@typescript-eslint/eslint-plugin": "^8.49.0",
54
+ "@typescript-eslint/parser": "^8.49.0",
55
55
  "@vitest/coverage-v8": "^4.0.15",
56
56
  "@vitest/ui": "^4.0.15",
57
57
  "cross-env": "^10.1.0",
@@ -68,7 +68,7 @@
68
68
  "vitest": "^4.0.15"
69
69
  },
70
70
  "devDependencies": {
71
- "tsdown": "^0.16.8"
71
+ "tsdown": "^0.17.2"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "tsdown": "^0.x"