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

Switch to pnpm #10576

Merged
merged 1 commit into from
Aug 22, 2022
Merged

Switch to pnpm #10576

merged 1 commit into from
Aug 22, 2022

Conversation

benmccann
Copy link
Contributor

@benmccann benmccann commented Aug 7, 2022

The main benefit is that it allows you to have a monorepo with sub-projects. E.g. right now the main package.json has all the dependencies in it, but in this PR I was able to move the documentation dependencies to the docs sub-project, which is cleaner and helps make it clearer what is used where. Also, this completely removes the need for test/integration/integration-test.cjs and creating a temporary directory for integration testing as we can use workspace dependencies.

As a final benefit, pnpm is much faster than npm especially for subsequent installs of the Chart.js project. The lockfile is also easier to read - you can see the deletion of 28,000 lines. I've been seeing it adopted quite a lot in large projects like Next.js, Vue, Vite, and SvelteKit.

This requires that you install pnpm to build the project. Just run npm install -g pnpm

The compressed size action is failing because it's checking out the previous version from github where pnpm fails because this project is not currently specifying the required peer dependencies. I fixed that in this PR, so all subsequent PRs after this one should pass that check if this is merged.

@benmccann benmccann force-pushed the pnpm branch 10 times, most recently from 7c3d87e to b327dd9 Compare August 8, 2022 02:54
@benmccann benmccann force-pushed the pnpm branch 3 times, most recently from e618efc to ea5bc05 Compare August 8, 2022 20:20
Copy link
Collaborator

@LeeLenaleee LeeLenaleee left a comment

Choose a reason for hiding this comment

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

Looks fine only I think it would be best to put a mention in the migration guide for this too.
Guess best place is like in the V3 migration guide in the Developer migration section, small bit of text that we switched from npm to pnpm so that needs to be installed before you can work with hte project again

@benmccann
Copy link
Contributor Author

Developer migration in v3 was for developers of plugins, etc. However, there won't be any migration required for either end users or developers of plugins. Only people working on this repository itself. That will start immediately with this being merged and will not coincide with the release of v4. So I think putting it in the contributor's guide is probably best.

@LeeLenaleee
Copy link
Collaborator

Aah yeah makes sense, my bad

LeeLenaleee
LeeLenaleee previously approved these changes Aug 9, 2022
Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

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

Faster speed is a good enough reason to switch already. I have some questions though.

@etimberg
Copy link
Member

I can replicate the CI failure locally

❯ pnpm test-ci-integration

> chart.js@4.0.0-dev test-ci-integration /mnt/c/Users/evert/opensource/chartjs
> pnpm --filter './test/integration/**' test

Scope: 2 of 4 workspace projects
test/integration/node test$ npm run test-mjs && npm run test-cjs
│ > test-mjs
│ > node test.js
│ > test-cjs
│ > node test.cjs
└─ Done in 536ms
test/integration/react-browser test$ react-scripts build
│ Creating an optimized production build...
│ Failed to compile.
│ [eslint]
│ src/AppAuto.tsx
│   Line 3:9:   'merge' is defined but never used  no-unused-vars
│   Line 8:13:  Trailing spaces not allowed        no-trailing-spaces
│   Line 12:5:  Do not use 'new' for side effects  no-new
│ Search for the keywords to learn more about each error.
└─ Failed in 52s
/mnt/c/Users/evert/opensource/chartjs/test/integration/react-browser:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @ test: `react-scripts build`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

@LeeLenaleee
Copy link
Collaborator

No new should be without putting it in a variable if I'm not mistaken so const c = new Chart() should work although it's an unused car so we might need an update statement or ignore it

@benmccann
Copy link
Contributor Author

Oops. Should be fixed now. I think it was working originally, but I lost some of the fixes while merging in the latest changes from master

etimberg
etimberg previously approved these changes Aug 20, 2022
Copy link
Member

@kurkle kurkle left a comment

Choose a reason for hiding this comment

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

looks good expect for @LeeLenaleee comments (integration tests for helpers)

@kurkle
Copy link
Member

kurkle commented Aug 22, 2022

Some actions seem to fail still

@benmccann
Copy link
Contributor Author

benmccann commented Aug 22, 2022

@kurkle looks like you caught it right before I pushed a fix 😄 I had a bad merge when rebasing against master. Should be addressed now. (Except for the Compressed Size one which will start working after this is merged. See the PR description about that one)

@LeeLenaleee LeeLenaleee merged commit 9258f25 into chartjs:master Aug 22, 2022
@benmccann benmccann deleted the pnpm branch August 22, 2022 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants