From 5f3c94ebe66931550f45e3bcc568d07648c04227 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Tue, 28 Nov 2023 12:46:11 +0100 Subject: [PATCH 1/7] chore: add knip ci workflow Resolves: #897 --- .github/workflows/knip.yml | 28 ++++++++++++++++++++++++++++ package.json | 4 +++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/knip.yml diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml new file mode 100644 index 000000000..1be7f0c04 --- /dev/null +++ b/.github/workflows/knip.yml @@ -0,0 +1,28 @@ +name: Knip + +on: + pull_request: + +permissions: write-all + +jobs: + run-knip: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: "18.14.1" + + - name: Install toolchain + run: yarn install + + - name: Report knip results to pull request + uses: gitcoindev/knip-reporter@v1.2.9 + with: + verbose: true + comment_id: ${{ github.workflow }}-reporter + command_script_name: knip-ci diff --git a/package.json b/package.json index 2830f3051..b87cc1072 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "build:serverless": "ncc build src/index.ts -o ./", "build": "tsc", "clean": "rimraf ./dist ./node_modules", + "knip": "knip", + "knip-ci": "knip --no-exit-code --reporter jsonExt", "preformat": "yarn lint:prettier", "format": "yarn lint:eslint", "lint": "yarn lint:prettier:check && yarn lint:eslint", @@ -78,7 +80,7 @@ "@types/source-map-support": "^0.5.6", "eslint": "^8.43.0", "jest": "^29.6.2", - "knip": "^2.33.4", + "knip": "^2.43.0", "octokit": "^3.1.2", "rimraf": "3.0.2", "source-map-support": "^0.5.21", From 72f5fe2e0a454f4ceb8378f88359ef53f70c44e7 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Tue, 28 Nov 2023 12:53:47 +0100 Subject: [PATCH 2/7] chore: add knip.ts configuration skeleton Resolves: #897 --- knip.json | 4 ---- knip.ts | 11 +++++++++++ tsconfig.json | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) delete mode 100644 knip.json create mode 100644 knip.ts diff --git a/knip.json b/knip.json deleted file mode 100644 index 9d5789ccc..000000000 --- a/knip.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "entry": ["src/index.ts"], - "project": ["**/*.ts"] -} diff --git a/knip.ts b/knip.ts new file mode 100644 index 000000000..4894f6ad5 --- /dev/null +++ b/knip.ts @@ -0,0 +1,11 @@ +import type { KnipConfig } from "knip"; + +const config: KnipConfig = { + entry: ["src/index.ts"], + project: ["src/**/*.ts"], + ignore: ["src/types/config.ts"], + ignoreExportsUsedInFile: true, + ignoreDependencies: [], +}; + +export default config; diff --git a/tsconfig.json b/tsconfig.json index b9259e753..7da22171c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -62,6 +62,6 @@ "sourceMap": true }, "include": ["src/"], - "exclude": ["src/coverage/"], + "exclude": ["src/coverage/", "knip.ts"], "compileOnSave": false } From 7ab24dcae1091ee68a8f03fb5cc9f060bd8dd1b1 Mon Sep 17 00:00:00 2001 From: korrrba <88761781+gitcoindev@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:01:37 +0100 Subject: [PATCH 3/7] Update knip.yml to use knip-reporter v2.1.2 and node 20.x --- .github/workflows/knip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index 1be7f0c04..bc6a23c0c 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -15,13 +15,13 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "18.14.1" + node-version: 20.x - name: Install toolchain run: yarn install - name: Report knip results to pull request - uses: gitcoindev/knip-reporter@v1.2.9 + uses: gitcoindev/knip-reporter@v2.1.2 with: verbose: true comment_id: ${{ github.workflow }}-reporter From 1a9e6686ff4b49062d84e684d58c3492ad2c2687 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Mon, 11 Dec 2023 07:42:39 +0100 Subject: [PATCH 4/7] chore: switch knip-reporter to latest upstream release Version 2.1.0 released with export annotations support and additional tests. --- .github/workflows/knip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index bc6a23c0c..18b0e8e0a 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -15,13 +15,13 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 20.x + node-version: 20.10 - name: Install toolchain run: yarn install - name: Report knip results to pull request - uses: gitcoindev/knip-reporter@v2.1.2 + uses: codex-/knip-reporter@v2.1.0 with: verbose: true comment_id: ${{ github.workflow }}-reporter From ac3c2a42f4c9e31d64b28b96f5bfdc77537e6f0b Mon Sep 17 00:00:00 2001 From: Korrrba Date: Mon, 11 Dec 2023 11:16:37 +0100 Subject: [PATCH 5/7] chore: set node LTS and knip v2 tag --- .github/workflows/knip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index 18b0e8e0a..f0512ce24 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -15,13 +15,13 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: 20.10 + node-version: 20.10.x - name: Install toolchain run: yarn install - name: Report knip results to pull request - uses: codex-/knip-reporter@v2.1.0 + uses: codex-/knip-reporter@v2 with: verbose: true comment_id: ${{ github.workflow }}-reporter From 2243c38ff84389ec25be91f6ecbe6c53c79aebda Mon Sep 17 00:00:00 2001 From: Korrrba Date: Mon, 11 Dec 2023 13:31:34 +0100 Subject: [PATCH 6/7] chore: use Codex-/knip-reporter --- .github/workflows/knip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index f0512ce24..2c9deb495 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -21,7 +21,7 @@ jobs: run: yarn install - name: Report knip results to pull request - uses: codex-/knip-reporter@v2 + uses: Codex-/knip-reporter@v2 with: verbose: true comment_id: ${{ github.workflow }}-reporter From 970419c6e750d96a2a677d0c8b3647c91930e7c1 Mon Sep 17 00:00:00 2001 From: Korrrba Date: Fri, 15 Dec 2023 00:20:19 +0100 Subject: [PATCH 7/7] chore: upgrade knip to v3.7 with dev depencies typescript 5.0.4 and node types Also set explicit anntations in knip.yml. --- .github/workflows/knip.yml | 2 ++ package.json | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/knip.yml b/.github/workflows/knip.yml index 2c9deb495..9fff1ee22 100644 --- a/.github/workflows/knip.yml +++ b/.github/workflows/knip.yml @@ -26,3 +26,5 @@ jobs: verbose: true comment_id: ${{ github.workflow }}-reporter command_script_name: knip-ci + annotations: true + ignore_results: false diff --git a/package.json b/package.json index b87cc1072..9e0a62661 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "build": "tsc", "clean": "rimraf ./dist ./node_modules", "knip": "knip", - "knip-ci": "knip --no-exit-code --reporter jsonExt", + "knip-ci": "knip --no-exit-code --reporter json", "preformat": "yarn lint:prettier", "format": "yarn lint:eslint", "lint": "yarn lint:prettier:check && yarn lint:eslint", @@ -76,16 +76,16 @@ "@types/libsodium-wrappers": "^0.7.10", "@types/lodash": "^4.14.197", "@types/markdown-it": "^13.0.4", - "@types/node": "^14.18.37", + "@types/node": "^18.0.0", "@types/source-map-support": "^0.5.6", "eslint": "^8.43.0", "jest": "^29.6.2", - "knip": "^2.43.0", + "knip": "^3.7.1", "octokit": "^3.1.2", "rimraf": "3.0.2", "source-map-support": "^0.5.21", "ts-jest": "^29.1.1", - "typescript": "^4.9.5" + "typescript": "^5.0.4" }, "engines": { "node": ">=18"