Skip to content

Commit 34dcf16

Browse files
werwolf2303matz3
andauthored
ci: Replace depcheck with knip (#540)
Due to the deprecation of depcheck we migrated to knip, which is in active development and has more features. As a first step we only activate the checking of unused dependencies. For monorepos it has to be run at root package level: [Knip Monorepos](https://knip.dev/features/monorepos-and-workspaces). JIRA: CPOUI5FOUNDATION-1126 --------- Co-authored-by: Matthias Osswald <mat.osswald@sap.com>
1 parent 2f65cb9 commit 34dcf16

6 files changed

Lines changed: 596 additions & 791 deletions

File tree

.github/workflows/github-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: npm run check-licenses
3535

3636
- name: Perform dependency check
37-
run: npm run depcheck
37+
run: npm run knip
3838

3939
- name: Run unit tests
4040
run: npm run test:unit:coverage

knip.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const config = {
2+
/**
3+
* We only need dependency checking at the moment,
4+
* so all checks except for dependencies are turned off.
5+
*/
6+
rules: {
7+
files: "off",
8+
duplicates: "off",
9+
classMembers: "off",
10+
unlisted: "off",
11+
binaries: "off",
12+
unresolved: "off",
13+
catalog: "off",
14+
exports: "off",
15+
types: "off",
16+
enumMembers: "off",
17+
},
18+
19+
ignoreDependencies: [
20+
/**
21+
* Used in packages/middleware-code-coverage/test/integration/fixtures/ui5-app/package.json
22+
* which is not part of the scope that knip analyzes
23+
*/
24+
"@ui5/cli",
25+
26+
/**
27+
* Used via nyc ava --node-arguments="--experimental-loader=@istanbuljs/esm-loader-hook"
28+
* which is not detected by knip as a usage of this package
29+
*/
30+
"@istanbuljs/esm-loader-hook"
31+
],
32+
33+
workspaces: {
34+
"packages/middleware-code-coverage": {
35+
/**
36+
* UI5 custom middleware entry (see packages/middleware-code-coverage/ui5.yaml)
37+
*/
38+
entry: ["lib/middleware.js"],
39+
ava: {
40+
config: [
41+
"ava.config.js",
42+
"ava-integration.config.js"
43+
]
44+
}
45+
}
46+
}
47+
};
48+
49+
export default config;

0 commit comments

Comments
 (0)