ts-builds 2.0.0 → 2.1.0
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.
- package/.prettierignore +23 -1
- package/README.md +15 -0
- package/dist/cli.js +22 -3
- package/dist/tsdown.config.base.js +5 -1
- package/package.json +5 -5
package/.prettierignore
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
+
# Dependencies
|
|
1
2
|
node_modules
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
# Build outputs
|
|
5
|
+
dist
|
|
6
|
+
lib
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# Lock files
|
|
10
|
+
pnpm-lock.yaml
|
|
11
|
+
package-lock.json
|
|
12
|
+
yarn.lock
|
|
13
|
+
|
|
14
|
+
# Minified files
|
|
15
|
+
*.min.js
|
|
16
|
+
*.min.css
|
|
17
|
+
|
|
18
|
+
# OS files
|
|
19
|
+
.DS_Store
|
|
20
|
+
Thumbs.db
|
|
21
|
+
|
|
22
|
+
# IDE
|
|
23
|
+
.idea
|
|
24
|
+
.vscode
|
package/README.md
CHANGED
|
@@ -104,6 +104,21 @@ Create `ts-builds.config.json` to customize behavior:
|
|
|
104
104
|
}
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
### With Custom ESLint Plugins
|
|
108
|
+
|
|
109
|
+
If your project uses ESLint plugins not bundled with ts-builds (e.g., `eslint-plugin-functional`, `eslint-plugin-react-hooks`):
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"srcDir": "./src",
|
|
114
|
+
"lint": {
|
|
115
|
+
"useProjectEslint": true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This tells ts-builds to use your project's ESLint installation instead of the bundled version.
|
|
121
|
+
|
|
107
122
|
### Advanced (Monorepos, Custom Commands)
|
|
108
123
|
|
|
109
124
|
```json
|
package/dist/cli.js
CHANGED
|
@@ -29,6 +29,7 @@ function loadConfig() {
|
|
|
29
29
|
return {
|
|
30
30
|
srcDir: userConfig.srcDir ?? "./src",
|
|
31
31
|
testDir: userConfig.testDir ?? "./test",
|
|
32
|
+
lint: { useProjectEslint: userConfig.lint?.useProjectEslint ?? false },
|
|
32
33
|
commands,
|
|
33
34
|
chains
|
|
34
35
|
};
|
|
@@ -148,6 +149,14 @@ CONFIGURATION:
|
|
|
148
149
|
"validateChain": ["format", "lint", "typecheck", "test", "build"]
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
With custom ESLint plugins (e.g., eslint-plugin-functional):
|
|
153
|
+
{
|
|
154
|
+
"srcDir": "./src",
|
|
155
|
+
"lint": {
|
|
156
|
+
"useProjectEslint": true
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
151
160
|
Advanced (monorepo with custom commands):
|
|
152
161
|
{
|
|
153
162
|
"srcDir": "./src",
|
|
@@ -280,10 +289,19 @@ function createConfig(force = false) {
|
|
|
280
289
|
Configuration options:
|
|
281
290
|
srcDir Source directory for linting (default: "./src")
|
|
282
291
|
testDir Test directory (default: "./test")
|
|
292
|
+
lint Lint settings: { "useProjectEslint": true }
|
|
283
293
|
validateChain Commands to run for validate (default shown above)
|
|
284
294
|
commands Custom commands: { "name": "shell command" }
|
|
285
295
|
chains Named chains: { "validate:fast": ["format", "lint"] }
|
|
286
296
|
|
|
297
|
+
Example with custom ESLint plugins:
|
|
298
|
+
{
|
|
299
|
+
"srcDir": "./src",
|
|
300
|
+
"lint": {
|
|
301
|
+
"useProjectEslint": true
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
287
305
|
Example with custom commands:
|
|
288
306
|
{
|
|
289
307
|
"srcDir": "./src",
|
|
@@ -303,7 +321,7 @@ async function runFormat(check = false) {
|
|
|
303
321
|
}
|
|
304
322
|
async function runLint(check = false) {
|
|
305
323
|
const config = loadConfig();
|
|
306
|
-
return runCommand("eslint", check ? [config.srcDir] : ["--fix", config.srcDir]);
|
|
324
|
+
return runCommand(config.lint.useProjectEslint ? "npx eslint" : "eslint", check ? [config.srcDir] : ["--fix", config.srcDir]);
|
|
307
325
|
}
|
|
308
326
|
async function runTypecheck() {
|
|
309
327
|
return runCommand("tsc", ["--noEmit"]);
|
|
@@ -323,11 +341,12 @@ async function runBuild(watch = false) {
|
|
|
323
341
|
return runCommand("cross-env", ["NODE_ENV=production", "tsdown"]);
|
|
324
342
|
}
|
|
325
343
|
function getBuiltinCommands(config) {
|
|
344
|
+
const eslintCmd = config.lint.useProjectEslint ? "npx eslint" : "eslint";
|
|
326
345
|
return {
|
|
327
346
|
format: { run: "prettier --write ." },
|
|
328
347
|
"format:check": { run: "prettier --check ." },
|
|
329
|
-
lint: { run:
|
|
330
|
-
"lint:check": { run:
|
|
348
|
+
lint: { run: `${eslintCmd} --fix ${config.srcDir}` },
|
|
349
|
+
"lint:check": { run: `${eslintCmd} ${config.srcDir}` },
|
|
331
350
|
typecheck: { run: "tsc --noEmit" },
|
|
332
351
|
"ts-types": { run: "tsc --noEmit" },
|
|
333
352
|
test: { run: "vitest run" },
|
|
@@ -8,7 +8,11 @@ const tsdown = {
|
|
|
8
8
|
minify: env === "production",
|
|
9
9
|
target: "es2020",
|
|
10
10
|
outDir: env === "production" ? "dist" : "lib",
|
|
11
|
-
entry: ["src/index.ts", "src/**/*.ts"]
|
|
11
|
+
entry: ["src/index.ts", "src/**/*.ts"],
|
|
12
|
+
outExtensions: () => ({
|
|
13
|
+
js: ".js",
|
|
14
|
+
dts: ".d.ts"
|
|
15
|
+
})
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-builds",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@eslint/eslintrc": "^3.3.3",
|
|
51
51
|
"@eslint/js": "^9.39.2",
|
|
52
52
|
"@types/node": "~24.10.4",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
54
|
-
"@typescript-eslint/parser": "^8.
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
55
55
|
"@vitest/coverage-v8": "^4.0.16",
|
|
56
56
|
"@vitest/ui": "^4.0.16",
|
|
57
57
|
"cross-env": "^10.1.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vitest": "^4.0.16"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"tsdown": "^0.18.
|
|
71
|
+
"tsdown": "^0.18.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"tsdown": "^0.x"
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"dev": "node dist/cli.js dev",
|
|
94
94
|
"prepublishOnly": "pnpm validate:bootstrap"
|
|
95
95
|
},
|
|
96
|
-
"packageManager": "pnpm@10.
|
|
96
|
+
"packageManager": "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a"
|
|
97
97
|
}
|