@jterrazz/typescript 6.0.3 → 6.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/README.md +13 -13
- package/bin/commands/check.sh +41 -16
- package/package.json +14 -12
- /package/{bin → lib}/merge-knip-config.js +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jterrazz/typescript
|
|
2
2
|
|
|
3
|
-
The complete TypeScript toolchain — build, run, check, and document with zero configuration. Powered by tsdown, Oxlint, Oxfmt,
|
|
3
|
+
The complete TypeScript toolchain — build, run, check, and document with zero configuration. Powered by tsdown, Oxlint, Oxfmt, TypeScript 7, and Knip.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -86,12 +86,12 @@ your-project/
|
|
|
86
86
|
|
|
87
87
|
| Tool | Purpose |
|
|
88
88
|
| ------ | -------------------- |
|
|
89
|
-
|
|
|
89
|
+
| tsc | Type checking |
|
|
90
90
|
| oxlint | Linting |
|
|
91
91
|
| oxfmt | Formatting |
|
|
92
92
|
| knip | Unused code analysis |
|
|
93
93
|
|
|
94
|
-
`typescript fix` runs
|
|
94
|
+
`typescript fix` runs tsc, oxlint (with `--fix`), and oxfmt in parallel (knip excluded).
|
|
95
95
|
|
|
96
96
|
### Lint presets
|
|
97
97
|
|
|
@@ -153,16 +153,16 @@ jobs:
|
|
|
153
153
|
|
|
154
154
|
The toolchain is fully compiled — no JavaScript in the hot path:
|
|
155
155
|
|
|
156
|
-
| Step | Tool
|
|
157
|
-
| ------------ |
|
|
158
|
-
| Transpile | [Oxc](https://oxc.rs) (via tsdown)
|
|
159
|
-
| Bundle | [Rolldown](https://rolldown.rs)
|
|
160
|
-
| Declarations | [tsdown](https://tsdown.dev) built-in
|
|
161
|
-
| Type check | [
|
|
162
|
-
| Lint | [Oxlint](https://oxc.rs/docs/guide/usage/linter)
|
|
163
|
-
| Format | [Oxfmt](https://oxc.rs/docs/guide/usage/formatter)
|
|
164
|
-
| Unused code | [Knip](https://knip.dev)
|
|
165
|
-
| API docs | [Typedoc](https://typedoc.org)
|
|
156
|
+
| Step | Tool | Language |
|
|
157
|
+
| ------------ | ---------------------------------------------------------------- | -------- |
|
|
158
|
+
| Transpile | [Oxc](https://oxc.rs) (via tsdown) | Rust |
|
|
159
|
+
| Bundle | [Rolldown](https://rolldown.rs) | Rust |
|
|
160
|
+
| Declarations | [tsdown](https://tsdown.dev) built-in | Rust |
|
|
161
|
+
| Type check | [tsc (TypeScript 7)](https://github.com/microsoft/typescript-go) | Go |
|
|
162
|
+
| Lint | [Oxlint](https://oxc.rs/docs/guide/usage/linter) | Rust |
|
|
163
|
+
| Format | [Oxfmt](https://oxc.rs/docs/guide/usage/formatter) | Rust |
|
|
164
|
+
| Unused code | [Knip](https://knip.dev) | Node |
|
|
165
|
+
| API docs | [Typedoc](https://typedoc.org) | Node |
|
|
166
166
|
|
|
167
167
|
## License
|
|
168
168
|
|
package/bin/commands/check.sh
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Quality checks: runs
|
|
2
|
+
# Quality checks: runs tsc, oxlint, oxfmt, and knip in parallel.
|
|
3
3
|
# Called by: typescript check | typescript fix
|
|
4
4
|
|
|
5
5
|
# Colors for output
|
|
@@ -19,14 +19,39 @@ done
|
|
|
19
19
|
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
20
20
|
PACKAGE_ROOT="$SCRIPT_DIR/../.."
|
|
21
21
|
|
|
22
|
-
# Find
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
# Find binaries one by one - npm may hoist some tools to the consumer's
|
|
23
|
+
# node_modules/.bin and nest others under this package, so a single shared
|
|
24
|
+
# bin directory cannot be assumed
|
|
25
|
+
find_binary() {
|
|
26
|
+
local name="$1"
|
|
27
|
+
if [ -x "$PACKAGE_ROOT/node_modules/.bin/$name" ]; then
|
|
28
|
+
echo "$PACKAGE_ROOT/node_modules/.bin/$name"
|
|
29
|
+
elif [ -x "$PACKAGE_ROOT/../../.bin/$name" ]; then
|
|
30
|
+
echo "$PACKAGE_ROOT/../../.bin/$name"
|
|
31
|
+
else
|
|
32
|
+
echo "$name" # Fallback to PATH
|
|
33
|
+
fi
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# The Go compiler (official typescript@7) is installed under the
|
|
37
|
+
# "typescript-go" npm alias: typedoc and eslint-plugin-perfectionist need the
|
|
38
|
+
# JS-API typescript 5/6 to resolve under the name "typescript", so the two
|
|
39
|
+
# must coexist. Resolve the aliased package's binary directly — both packages
|
|
40
|
+
# link a `tsc` bin, so .bin/tsc would be ambiguous.
|
|
41
|
+
find_tsc() {
|
|
42
|
+
if [ -x "$PACKAGE_ROOT/node_modules/typescript-go/bin/tsc" ]; then
|
|
43
|
+
echo "$PACKAGE_ROOT/node_modules/typescript-go/bin/tsc"
|
|
44
|
+
elif [ -x "$PACKAGE_ROOT/../../typescript-go/bin/tsc" ]; then
|
|
45
|
+
echo "$PACKAGE_ROOT/../../typescript-go/bin/tsc"
|
|
46
|
+
else
|
|
47
|
+
find_binary tsc
|
|
48
|
+
fi
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
TSC=$(find_tsc)
|
|
52
|
+
OXLINT=$(find_binary oxlint)
|
|
53
|
+
OXFMT=$(find_binary oxfmt)
|
|
54
|
+
KNIP=$(find_binary knip)
|
|
30
55
|
|
|
31
56
|
# Parse command and args
|
|
32
57
|
COMMAND=""
|
|
@@ -71,20 +96,20 @@ run_checks() {
|
|
|
71
96
|
printf "${CYAN_BG}${BRIGHT_WHITE} START ${NC} ${LABEL}\n"
|
|
72
97
|
|
|
73
98
|
# Run all tools in parallel
|
|
74
|
-
"$
|
|
99
|
+
"$TSC" --noEmit > "$tmp_dir/type.log" 2>&1 &
|
|
75
100
|
local type_pid=$!
|
|
76
101
|
|
|
77
102
|
if [ "$FIX_MODE" = true ]; then
|
|
78
|
-
"$
|
|
103
|
+
"$OXLINT" --fix "${LINT_ARGS[@]}" > "$tmp_dir/lint.log" 2>&1 &
|
|
79
104
|
else
|
|
80
|
-
"$
|
|
105
|
+
"$OXLINT" "${LINT_ARGS[@]}" > "$tmp_dir/lint.log" 2>&1 &
|
|
81
106
|
fi
|
|
82
107
|
local lint_pid=$!
|
|
83
108
|
|
|
84
109
|
if [ "$FIX_MODE" = true ]; then
|
|
85
|
-
"$
|
|
110
|
+
"$OXFMT" > "$tmp_dir/format.log" 2>&1 &
|
|
86
111
|
else
|
|
87
|
-
"$
|
|
112
|
+
"$OXFMT" --check > "$tmp_dir/format.log" 2>&1 &
|
|
88
113
|
fi
|
|
89
114
|
local format_pid=$!
|
|
90
115
|
|
|
@@ -98,8 +123,8 @@ run_checks() {
|
|
|
98
123
|
[ -f "knip.json" ] && knip_project="knip.json"
|
|
99
124
|
[ -f "knip.jsonc" ] && knip_project="knip.jsonc"
|
|
100
125
|
|
|
101
|
-
node "$PACKAGE_ROOT/
|
|
102
|
-
"$
|
|
126
|
+
node "$PACKAGE_ROOT/lib/merge-knip-config.js" "$knip_base" $knip_project > "$tmp_dir/knip-merged.json"
|
|
127
|
+
"$KNIP" --no-progress --no-config-hints --config "$tmp_dir/knip-merged.json" > "$tmp_dir/knip.log" 2>&1 &
|
|
103
128
|
knip_pid=$!
|
|
104
129
|
fi
|
|
105
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jterrazz/typescript",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"bin",
|
|
14
|
+
"lib",
|
|
14
15
|
"presets",
|
|
15
16
|
"src"
|
|
16
17
|
],
|
|
@@ -41,18 +42,19 @@
|
|
|
41
42
|
"test": "vitest --run"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"typedoc": "^
|
|
51
|
-
"
|
|
45
|
+
"eslint-plugin-perfectionist": "^5.10.0",
|
|
46
|
+
"knip": "^6.27.0",
|
|
47
|
+
"oxfmt": "^0.59.0",
|
|
48
|
+
"oxlint": "^1.74.0",
|
|
49
|
+
"tsdown": "^0.22.9",
|
|
50
|
+
"typedoc": "^0.28.20",
|
|
51
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
52
|
+
"typescript": "^6.0.0",
|
|
53
|
+
"typescript-go": "npm:typescript@^7.0.2"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@jterrazz/test": "^
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"vitest": "^4.1.
|
|
56
|
+
"@jterrazz/test": "^8.0.0",
|
|
57
|
+
"@types/node": "^26.1.1",
|
|
58
|
+
"vitest": "^4.1.10"
|
|
57
59
|
}
|
|
58
60
|
}
|
|
File without changes
|