-
Notifications
You must be signed in to change notification settings - Fork 527
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
Add depcheck for CI step to check for unused dependencies #1677
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
71b7808
add depcheck ci
anshgoyalevil fa1ed49
add depcheck ci
anshgoyalevil db36aaa
add depcheck ci
anshgoyalevil 745614f
add depcheck ci
anshgoyalevil 073304b
fix lint
anshgoyalevil ec8ac31
Bump @testing-library/jest-dom from 5.17.0 to 6.0.0 (#1679)
dependabot[bot] c2c29b7
Release 1.32.0 (#1676)
pavolloffay f2be9a9
Recognize uninstrumented services via both `producer` and `client` sp…
Wck-iipi 5758f9d
Remove unused packages (#1675)
anshgoyalevil 5e8b149
Bump eslint from 8.46.0 to 8.47.0 (#1678)
dependabot[bot] 27827f9
generate depcheckrc automatically
anshgoyalevil fef043d
Bump the typescript-eslint group with 2 updates (#1686)
dependabot[bot] f068fe8
Remove unused type defs and packages (#1682)
anshgoyalevil d272d41
modify generatedepcheckrc
anshgoyalevil d60678c
[plexus] Remove unused deps and add missing deps (#1688)
anshgoyalevil 3b2b286
add depcheck for plexus
anshgoyalevil a6d4086
fix lint errors
anshgoyalevil 61dabd9
Update .github/workflows/unit-tests.yml
anshgoyalevil 3d23799
sepration of concerns
anshgoyalevil d4d6709
fix script
anshgoyalevil b106ef4
fix script
anshgoyalevil ab0cf35
change permissions
anshgoyalevil 456e8c7
add more robust implementation
anshgoyalevil 29e1cbc
Merge branch 'main' into add-depcheck
anshgoyalevil 34dea32
remove console statements
anshgoyalevil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { babelConfiguration } = require('../packages/jaeger-ui/test/babel-transform'); | ||
|
||
const packageNames = [ | ||
...babelConfiguration.presets.flatMap(preset => { | ||
if (Array.isArray(preset)) { | ||
return [preset[0]]; | ||
} | ||
return [preset]; | ||
}), | ||
...babelConfiguration.plugins, | ||
]; | ||
|
||
const otherPackages = ['jest-environment-jsdom']; | ||
|
||
// Use the selected targetPackage for generating depcheckrcContent | ||
const depcheckrcContent = { | ||
ignores: [...packageNames, ...otherPackages], | ||
'ignore-dirs': ['build'], | ||
}; | ||
|
||
// Use the argument provided to the script as the output file path | ||
const outputFile = process.argv[2]; | ||
|
||
if (!outputFile) { | ||
process.exit(1); | ||
} | ||
|
||
const depcheckrcPath = path.resolve(__dirname, outputFile); | ||
|
||
fs.writeFileSync(depcheckrcPath, JSON.stringify(depcheckrcContent, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2023 The Jaeger Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const getBabelConfig = require('../packages/plexus/babel.config'); | ||
|
||
const babelConfiguration = getBabelConfig({ | ||
env: () => { | ||
'development'; | ||
}, | ||
}); | ||
|
||
const packageNames = [ | ||
...babelConfiguration.presets.flatMap(preset => { | ||
if (Array.isArray(preset)) { | ||
return [preset[0]]; | ||
} | ||
return [preset]; | ||
}), | ||
...babelConfiguration.plugins.flatMap(plugin => { | ||
if (Array.isArray(plugin)) { | ||
return [plugin[0]]; | ||
} | ||
return [plugin]; | ||
}), | ||
]; | ||
|
||
const otherPackages = ['rimraf', 'webpack-cli']; | ||
|
||
// Use the selected targetPackage for generating depcheckrcContent | ||
const depcheckrcContent = { | ||
ignores: [...packageNames, ...otherPackages], | ||
}; | ||
|
||
// Use the argument provided to the script as the output file path | ||
const outputFile = process.argv[2]; | ||
|
||
if (!outputFile) { | ||
process.exit(1); | ||
} | ||
|
||
const depcheckrcPath = path.resolve(__dirname, outputFile); | ||
|
||
fs.writeFileSync(depcheckrcPath, JSON.stringify(depcheckrcContent, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
set -ex | ||
|
||
# Create a temporary depcheckrc file for 'jaeger-ui' | ||
tempfile_jaeger=$(mktemp /tmp/depcheckrc.XXXXXX.json) | ||
node scripts/generateDepcheckrcJaegerUI.js "$tempfile_jaeger" | ||
depcheck packages/jaeger-ui --config "$tempfile_jaeger" | ||
|
||
# Create a temporary depcheckrc file for 'plexus' | ||
tempfile_plexus=$(mktemp /tmp/depcheckrc.XXXXXX.json) | ||
node scripts/generateDepcheckrcPlexus.js "$tempfile_plexus" | ||
depcheck packages/plexus --config "$tempfile_plexus" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could've done this more "unixy" by writing to stdout from the Node script and redirecting here to the temp file. This way there would be fewer dependencies between the steps, the Node script is easier to debug, and it would be simpler (no writing to files).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was earlier thinking of the same to redirect the output using
>
operator in Unix.Would create a sister PR to rectify the same.