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

Implement depcheck as a Github Action #896

Closed
wants to merge 9 commits into from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Aug 12, 2023

Description

This PR implements a Github Action using depcheck to validate the usage of frontend libraries listed in yarn.lock. The goal is to optimize the frontend package size by eliminating unused libraries, which will improve build performance.

Summary of Changes

  • Added a new Github Action workflow file, depcheck.yml, in the .github/workflows directory.
  • The depcheck workflow is triggered on push and pull request events to the 'nextjs' branch.
  • The workflow checks out the repository code and sets up the Node.js environment.
  • Depcheck is installed using npm and then run on the frontend directory.
  • If unused dependencies are found, depcheck prints them and the workflow fails.

Please review and merge this PR to enable depcheck as a Github Action for the repository.

Fixes #895.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/depcheck-sweep-action

To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.

@sweep-ai sweep-ai bot added the sweep Assigns Sweep to an issue or pull request. label Aug 12, 2023
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is depcheck ./frontend --fail-on-error. Here are the relevant lines from the logs:

Unused dependencies
* @codemirror/commands
* @codemirror/lang-python
* @emotion/react
* @emotion/styled
* @testing-library/react
* @testing-library/user-event
* @types/crypto-js
* @types/file-saver
* @types/jest
* @types/lodash.camelcase
* @types/node
* @types/react-csv
* @types/redux-mock-store
* @uiw/react-codemirror
* axios
* crypto-js
* file-saver
* gestalt-datepicker
* jszip
* lodash.camelcase
* next-redux-wrapper
* rc-progress
* react-csv
* react-data-table-component
* react-filerobot-image-editor
* react-icons
* react-select
* socket.io-client
* typescript
* web-vitals
Unused devDependencies
* @testing-library/jest-dom
* @types/redux-mock-store
* eslint
* redux-mock-store
Missing dependencies
* @dnd-kit/utilities: ./src/features/Train/features/Tabular/components/TabularParametersStep.tsx
##[error]Process completed with exit code 255.

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: we don't use node-version 14. Look in .github/workflows/nodejs.yml. Our react build check uses node version 18.

runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: Use actions/checkout@v3 to be consistent with other github actions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: can you resolve any PR comments that are marked with "Outdated" tag

node-version: 18

- name: Install depcheck
run: npm install -g depcheck
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: how do you know that this is correct? Can you point me to some documentation to confirm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: I don't see a hyperlink. Cmon man, can you please search the web and link me a URL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: That link doesn't work. Sheesh, I have to do the work for you I guess

https://www.npmjs.com/package/depcheck

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweep: we also use yarn as our package manager. Can you update the github action file (.github/workflows/depcheck.yml) accordingly?

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is depcheck ./frontend --fail-on-error. Here are the relevant lines from the logs:

Unused dependencies
* @codemirror/commands
* @codemirror/lang-python
* @emotion/react
* @emotion/styled
* @testing-library/react
* @testing-library/user-event
* @types/crypto-js
* @types/file-saver
* @types/jest
* @types/lodash.camelcase
* @types/node
* @types/react-csv
* @types/redux-mock-store
* @uiw/react-codemirror
* axios
* crypto-js
* file-saver
* gestalt-datepicker
* jszip
* lodash.camelcase
* next-redux-wrapper
* rc-progress
* react-csv
* react-data-table-component
* react-filerobot-image-editor
* react-icons
* react-select
* socket.io-client
* typescript
* web-vitals
Unused devDependencies
* @testing-library/jest-dom
* @types/redux-mock-store
* eslint
* redux-mock-store
Missing dependencies
* @dnd-kit/utilities: ./src/features/Train/features/Tabular/components/TabularParametersStep.tsx
##[error]Process completed with exit code 255.

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is depcheck ./frontend --fail-on-error. Here are the relevant lines from the logs:

Unused dependencies
* @codemirror/commands
* @codemirror/lang-python
* @emotion/react
* @emotion/styled
* @testing-library/react
* @testing-library/user-event
* @types/crypto-js
* @types/file-saver
* @types/jest
* @types/lodash.camelcase
* @types/node
* @types/react-csv
* @types/redux-mock-store
* @uiw/react-codemirror
* axios
* crypto-js
* file-saver
* gestalt-datepicker
* jszip
* lodash.camelcase
* next-redux-wrapper
* rc-progress
* react-csv
* react-data-table-component
* react-filerobot-image-editor
* react-icons
* react-select
* socket.io-client
* typescript
* web-vitals
Unused devDependencies
* @testing-library/jest-dom
* @types/redux-mock-store
* eslint
* redux-mock-store
Missing dependencies
* @dnd-kit/utilities: ./src/features/Train/features/Tabular/components/TabularParametersStep.tsx
##[error]Process completed with exit code 255.

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is actions/checkout@v4. Here are the relevant lines from the logs:

##[error]Unable to resolve action `actions/checkout@v4`, unable to find version `v4`

Please note that the error occurred twice in the logs.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

1 similar comment
@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is actions/checkout@v4. Here are the relevant lines from the logs:

##[error]Unable to resolve action `actions/checkout@v4`, unable to find version `v4`

Please note that the error occurred twice in the logs.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@sweep-ai
Copy link
Contributor Author

sweep-ai bot commented Aug 12, 2023

GitHub actions yielded the following error.

The command that failed is actions/checkout@v4. Here are the relevant lines from the logs:

##[error]Unable to resolve action `actions/checkout@v4`, unable to find version `v4`

Please note that the error occurred twice in the logs.

This is likely a linting or type-checking issue with the source code. Update the code the changes and avoid modifying the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@karkir0003 karkir0003 closed this Aug 12, 2023
@karkir0003 karkir0003 reopened this Aug 12, 2023
@karkir0003 karkir0003 closed this Aug 12, 2023
@karkir0003 karkir0003 deleted the sweep/depcheck-sweep-action branch November 19, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Assigns Sweep to an issue or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: implement depcheck as a github action
1 participant