Skip to content

Commit 0d4dbcb

Browse files
committed
Run knip across workspaces
1 parent e059ebd commit 0d4dbcb

7 files changed

Lines changed: 92 additions & 77 deletions

File tree

knip.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import type { KnipConfig } from 'knip'
2+
3+
const sharedIgnore = ['dist/**', 'coverage/**', 'static-build/**', 'node_modules/**']
4+
const alphalibIgnore = 'src/alphalib/**'
5+
6+
const config: KnipConfig = {
7+
rules: {
8+
// Binary resolution is unreliable with Yarn PnP; avoid false positives.
9+
binaries: 'off',
10+
exports: 'warn',
11+
types: 'warn',
12+
nsExports: 'warn',
13+
nsTypes: 'warn',
14+
duplicates: 'warn',
15+
},
16+
ignoreWorkspaces: ['.'],
17+
ignoreExportsUsedInFile: {
18+
type: true,
19+
interface: true,
20+
},
21+
workspaces: {
22+
'packages/node': {
23+
entry: ['src/Transloadit.ts', 'src/cli.ts', 'test/**/*.{ts,tsx,js,jsx}', 'vitest.config.ts'],
24+
project: ['{src,test}/**/*.{ts,tsx,js,jsx}'],
25+
ignore: [...sharedIgnore, alphalibIgnore],
26+
ignoreDependencies: [
27+
// Used in src/alphalib/** which is excluded from knip
28+
'@aws-sdk/client-s3',
29+
'@aws-sdk/s3-request-presigner',
30+
'@transloadit/sev-logger',
31+
'type-fest',
32+
'zod',
33+
// Repo-specific ignores
34+
'@types/minimist',
35+
'minimatch',
36+
// Tooling lives at the repo root in this monorepo.
37+
'vitest',
38+
'vitest/config',
39+
],
40+
},
41+
'packages/transloadit': {
42+
entry: [
43+
'src/Transloadit.ts',
44+
'src/cli.ts',
45+
'src/cli/commands/**/*.ts',
46+
'src/cli/types.ts',
47+
'src/tus.ts',
48+
],
49+
project: ['src/**/*.{ts,tsx,js,jsx}'],
50+
ignore: [...sharedIgnore, alphalibIgnore],
51+
ignoreDependencies: [
52+
// Used in src/alphalib/** which is excluded from knip
53+
'@aws-sdk/client-s3',
54+
'@aws-sdk/s3-request-presigner',
55+
'@transloadit/sev-logger',
56+
'type-fest',
57+
'zod',
58+
// Repo-specific ignores
59+
'@types/minimist',
60+
'minimatch',
61+
],
62+
},
63+
'packages/types': {
64+
entry: ['src/index.ts', 'scripts/emit-types.ts', 'scripts/emit-types.test.ts'],
65+
project: ['{src,scripts}/**/*.ts'],
66+
ignore: ['dist/**', 'node_modules/**'],
67+
ignoreDependencies: [
68+
// Zod is required for type inspection but not imported directly.
69+
'zod',
70+
],
71+
},
72+
'packages/zod': {
73+
entry: ['src/**/*.{ts,tsx,js,jsx}', 'scripts/**/*.ts', 'test/**/*.ts'],
74+
project: ['{src,scripts,test}/**/*.ts'],
75+
ignore: ['dist/**', 'node_modules/**'],
76+
},
77+
},
78+
}
79+
80+
export default config

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
"packages/*"
88
],
99
"scripts": {
10-
"check": "yarn workspace @transloadit/node run knip --fix --allow-remove-files && yarn lint:ts && yarn fix:js && yarn test:unit",
10+
"check": "yarn run --binaries-only knip --fix --allow-remove-files --no-config-hints && yarn lint:ts && yarn fix:js && yarn test:unit",
1111
"lint:js": "biome check .",
1212
"lint:ts": "yarn workspace @transloadit/node lint:ts && yarn workspace @transloadit/types lint:ts && yarn workspace @transloadit/zod lint:ts",
1313
"lint": "yarn lint:js",
1414
"fix": "yarn fix:js",
1515
"fix:js": "biome check --write .",
1616
"fix:js:unsafe": "biome check --write . --unsafe",
17-
"knip": "yarn workspace @transloadit/node knip",
17+
"knip": "yarn run --binaries-only knip --no-config-hints --no-progress",
1818
"pack": "node scripts/pack-transloadit.ts",
1919
"parity:transloadit": "node scripts/fingerprint-pack.ts packages/transloadit --ignore-scripts --out /tmp/transloadit-after.json && node scripts/verify-fingerprint.ts --current /tmp/transloadit-after.json --baseline docs/fingerprint/transloadit-baseline.json --allow package.json --baseline-package-json docs/fingerprint/transloadit-baseline.package.json --current-package-json packages/transloadit/package.json",
2020
"test:unit": "yarn workspace @transloadit/node test:unit && yarn workspace @transloadit/types test:unit && yarn workspace @transloadit/zod test:unit",

packages/node/knip.ts

Lines changed: 0 additions & 53 deletions
This file was deleted.

packages/node/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"src": "./src"
6363
},
6464
"scripts": {
65-
"check": "yarn exec knip --fix --allow-remove-files --no-config-hints && yarn lint:ts && yarn fix && yarn test:unit",
65+
"check": "yarn lint:ts && yarn fix && yarn test:unit",
6666
"fix:js": "biome check --write .",
6767
"lint:ts": "tsc --build",
6868
"fix:js:unsafe": "biome check --write . --unsafe",
@@ -71,7 +71,6 @@
7171
"fix": "npm-run-all --serial 'fix:js'",
7272
"lint:deps": "knip --dependencies --no-progress",
7373
"fix:deps": "knip --dependencies --no-progress --fix",
74-
"knip": "knip --no-config-hints --no-progress",
7574
"prepack": "rm -f tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo && tsc --build tsconfig.build.json",
7675
"test:unit": "vitest run --coverage ./test/unit",
7776
"test:e2e": "vitest run ./test/e2e",

packages/transloadit/package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@
4141
"@types/minimist": "^1.2.5",
4242
"@types/node": "^24.10.3",
4343
"@types/recursive-readdir": "^2.2.4",
44-
"@types/temp": "^0.9.4",
45-
"badge-maker": "^5.0.2",
46-
"execa": "9.6.0",
47-
"image-size": "^2.0.2",
48-
"minimatch": "^10.1.1",
49-
"nock": "^14.0.10",
50-
"p-retry": "^7.0.0",
51-
"rimraf": "^6.1.2",
52-
"temp": "^0.9.4"
44+
"minimatch": "^10.1.1"
5345
},
5446
"repository": {
5547
"type": "git",
@@ -59,7 +51,7 @@
5951
"src": "./src"
6052
},
6153
"scripts": {
62-
"check": "yarn exec knip --fix --allow-remove-files --no-config-hints && yarn lint:ts && yarn fix && yarn test:unit",
54+
"check": "yarn lint:ts && yarn fix && yarn test:unit",
6355
"fix:js": "biome check --write .",
6456
"lint:ts": "tsc --build",
6557
"fix:js:unsafe": "biome check --write . --unsafe",
@@ -68,7 +60,6 @@
6860
"fix": "npm-run-all --serial 'fix:js'",
6961
"lint:deps": "knip --dependencies --no-progress",
7062
"fix:deps": "knip --dependencies --no-progress --fix",
71-
"knip": "knip --no-config-hints --no-progress",
7263
"prepack": "node ../../scripts/prepare-transloadit.ts",
7364
"test:unit": "vitest run --coverage ./test/unit",
7465
"test:e2e": "vitest run ./test/e2e",

packages/zod/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@
4040
"check": "yarn sync && tsc --build tsconfig.build.json && tsc --noEmit --project tsconfig.test.json && yarn test:unit"
4141
},
4242
"dependencies": {
43+
"type-fest": "^4.41.0",
4344
"zod": "^4.0.0"
4445
},
46+
"devDependencies": {
47+
"@transloadit/types": "workspace:*"
48+
},
4549
"publishConfig": {
4650
"tag": "experimental"
4751
}

yarn.lock

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,7 @@ __metadata:
26642664
languageName: node
26652665
linkType: hard
26662666

2667-
"@transloadit/types@workspace:packages/types":
2667+
"@transloadit/types@workspace:*, @transloadit/types@workspace:packages/types":
26682668
version: 0.0.0-use.local
26692669
resolution: "@transloadit/types@workspace:packages/types"
26702670
dependencies:
@@ -2676,6 +2676,8 @@ __metadata:
26762676
version: 0.0.0-use.local
26772677
resolution: "@transloadit/zod@workspace:packages/zod"
26782678
dependencies:
2679+
"@transloadit/types": "workspace:*"
2680+
type-fest: "npm:^4.41.0"
26792681
zod: "npm:^4.0.0"
26802682
languageName: unknown
26812683
linkType: soft
@@ -6894,26 +6896,18 @@ __metadata:
68946896
"@types/minimist": "npm:^1.2.5"
68956897
"@types/node": "npm:^24.10.3"
68966898
"@types/recursive-readdir": "npm:^2.2.4"
6897-
"@types/temp": "npm:^0.9.4"
6898-
badge-maker: "npm:^5.0.2"
68996899
clipanion: "npm:^4.0.0-rc.4"
69006900
debug: "npm:^4.4.3"
69016901
dotenv: "npm:^17.2.3"
6902-
execa: "npm:9.6.0"
69036902
form-data: "npm:^4.0.4"
69046903
got: "npm:14.4.9"
6905-
image-size: "npm:^2.0.2"
69066904
into-stream: "npm:^9.0.0"
69076905
is-stream: "npm:^4.0.1"
69086906
minimatch: "npm:^10.1.1"
6909-
nock: "npm:^14.0.10"
69106907
node-watch: "npm:^0.7.4"
69116908
p-map: "npm:^7.0.3"
69126909
p-queue: "npm:^9.0.1"
6913-
p-retry: "npm:^7.0.0"
69146910
recursive-readdir: "npm:^2.2.3"
6915-
rimraf: "npm:^6.1.2"
6916-
temp: "npm:^0.9.4"
69176911
tus-js-client: "npm:^4.3.1"
69186912
typanion: "npm:^3.14.0"
69196913
type-fest: "npm:^4.41.0"

0 commit comments

Comments
 (0)