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

Docs: Which Package Manager should I use? #785

Closed
jaredpalmer opened this issue Feb 28, 2022 · 2 comments
Closed

Docs: Which Package Manager should I use? #785

jaredpalmer opened this issue Feb 28, 2022 · 2 comments
Labels
area: docs Improvements or additions to documentation

Comments

@jaredpalmer
Copy link
Contributor

Add page in documentation about yarn vs. yarn 2+ vs. pnpm vs. npm. Compare features:

Dimensions

  • Support for resolutions/overrides, hoisting
  • Workspace-aware installs
  • Support for React Native
  • Install speed comparison
  • Support for turbo
@jaredpalmer jaredpalmer added the area: docs Improvements or additions to documentation label Feb 28, 2022
@belgattitude
Copy link

belgattitude commented Mar 6, 2022

Something interesting I found out about yarn 3 (2+ too I guess) is the local cache feature. It allows to keep the cache across yarn.lock changes, by pruning old packages and installing the new ones without invalidating the whole cache.

Example with a github action and restore_key (but the same apply locally or with docker/bildkit)

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

      - name: Restore yarn cache
        uses: actions/cache@v2
        id: yarn-cache 
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
          restore-keys: |
            yarn-cache-folder-

When installing a new dependency, ie: superjson, there's no need to invalidate the whole thing.

yarn install --immutable
➤ YN0000: ┌ Fetch step
  ➤ YN0013: │ 1719 packages were already cached, one had to be fetched (superjson@npm:1.7.5)
➤ YN0000: └ Completed in 1s 124ms

Cache Size: ~127 MB (133261279 B)
Cache saved successfully

See also actions/setup-node#325

On Vercel, the following hack generally works YARN_CACHE_FOLDER=./.next/cache/yarn-cache yarn install

Worthy to share.

@jlarmstrongiv
Copy link

I tried pnpm before transitioning to npm workspaces, as prisma and next misbehaved with package hoisting

alebedev added a commit to HedvigInsurance/racoon that referenced this issue Oct 25, 2023
…rcel (#3480)

<!--
PR title: GRW-123 / Feature / Awesome new thing
-->

## Describe your changes

Move yarn cache outside node_modules, see vercel/turbo#785

<!--
What changes are made?
If there are many changes, a list might be a good format.
If it makes sense, add screenshots and/or screen recordings here.
-->

## Justify why they are needed

## Checklist before requesting a review

- [ ] I have performed a self-review of my code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants