Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add Knip to understand dependency usage #1360

Merged
merged 17 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["src/module.{js,ts,tsx}"],
"project": ["src/**/*", "tests/**/*", ".config/**/*"],
"eslint": {
"config": [".config/.eslintrc", "./.eslintrc"]
},
"webpack": {
"config": [".config/webpack/webpack.config.ts"]
}
}
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
run: |
mkdir ./packed-artifacts
npm pack --workspace="@grafana/create-plugin" --workspace="@grafana/sign-plugin" --pack-destination="./packed-artifacts"
cp ./.github/knip.json ./packed-artifacts
- name: Upload artifacts for testing
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -199,6 +200,13 @@ jobs:
run: sign-plugin --rootUrls http://www.example.com --signatureType private
working-directory: ./${{ matrix.workingDir }}

- name: Frontend Knip Report
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
cat .config/webpack/webpack.config.ts
npx -y knip --config ../packed-artifacts/knip.json --reporter markdown --no-exit-code
working-directory: ./${{ matrix.workingDir }}

release:
runs-on: ubuntu-latest
needs: [test, generate-plugins]
Expand Down
Loading