Skip to content

[build-utils] change default package manager when no lockfile detected from yarn to npm (gated behind feature flag) - #11131

Merged
kodiakhq[bot] merged 9 commits into
mainfrom
change-default-package-manager-to-npm
Feb 8, 2024
Merged

kodiakhq[bot] merged 9 commits into
mainfrom
change-default-package-manager-to-npm

Conversation

@styfle

@styfle styfle commented Feb 8, 2024

Copy link
Copy Markdown
Member

This PR changes the default package manager from yarn to npm in the case that no lockfile is present.

Many years ago when yarn was first released, it was much faster than npm so we used it by default. That is no longer the case today and yarn@1 is no longer receiving new features.

For example, sharp and esbuild no longer works with yarn@1:

Related

Note that this change will not impact most projects because most used a lockfile.

@changeset-bot

changeset-bot Bot commented Feb 8, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f847681

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@vercel/build-utils Minor
vercel Patch
@vercel/client Patch
@vercel/gatsby-plugin-vercel-builder Patch
@vercel/node Patch
@vercel/static-build Patch
@vercel-internals/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/build-utils/test/unit.test.ts Resolved
@styfle styfle changed the title [build-utils] change default package manager when no lockfile detected from yarn to npm [build-utils] change default package manager when no lockfile detected from yarn to npm (gated behind feature flag) Feb 8, 2024
EndangeredMassa
EndangeredMassa previously approved these changes Feb 8, 2024
);
runNpmInstallSema.release();
return false;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note: this change was required because yarn somehow allowed us to run yarn install, even if there was no package.json but npm install will throw.

This might end up being a tiny perf improvement for the case when no package.json is found since we then won't need to invoke a package manager at all.

@kodiakhq
kodiakhq Bot merged commit 0d034b6 into main Feb 8, 2024
@kodiakhq
kodiakhq Bot deleted the change-default-package-manager-to-npm branch February 8, 2024 21:26
EndangeredMassa pushed a commit that referenced this pull request Feb 9, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @vercel/[email protected]

### Minor Changes

- Revert "Default ruby to only currently supported version (3.2.0)"
([#11135](#11135))

- Mark `flags` as deprecated and replace them with `variants`
([#11098](#11098))

- [build-utils] change default package manager when no lockfile detected
from `yarn` to `npm` (gated behind feature flag)
([#11131](#11131))

### Patch Changes

- Update internal type for variants
([#11111](#11111))

## [email protected]

### Minor Changes

- Mark `flags` as deprecated and replace them with `variants`
([#11098](#11098))

### Patch Changes

- Updated dependencies
\[[`c32a909af`](c32a909),
[`b6ed28b9b`](b6ed28b),
[`d21bb9f87`](d21bb9f),
[`4027a1833`](4027a18),
[`8ba0ce932`](8ba0ce9),
[`0d034b682`](0d034b6),
[`abaa700ce`](abaa700),
[`3bad73401`](3bad734)]:
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]
    -   @vercel/[email protected]

## @vercel/[email protected]

### Minor Changes

- Revert "Default ruby to only currently supported version (3.2.0)"
([#11135](#11135))

### Patch Changes

- Updated dependencies
\[[`ab2444466`](ab24444)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- Updated dependencies
\[[`b6ed28b9b`](b6ed28b),
[`8ba0ce932`](8ba0ce9),
[`0d034b682`](0d034b6),
[`abaa700ce`](abaa700)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- [gatsby-plugin-vercel-builder] use --keep-names esbuild flag
([#11117](#11117))

- Updated dependencies
\[[`b6ed28b9b`](b6ed28b),
[`8ba0ce932`](8ba0ce9),
[`0d034b682`](0d034b6),
[`abaa700ce`](abaa700)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- [node][next][redwood][remix] bump `@vercel/[email protected]`
([#11115](#11115))

- Load common chunks on module initialization
([#11126](#11126))

- Fix index normalizing for app outputs
([#11099](#11099))

- Mark `flags` as deprecated and replace them with `variants`
([#11098](#11098))

- Fix rewrite RSC handling with trailingSlash
([#11107](#11107))

## @vercel/[email protected]

### Patch Changes

- [node][next][redwood][remix] bump `@vercel/[email protected]`
([#11115](#11115))

- Updated dependencies
\[[`b6ed28b9b`](b6ed28b),
[`8ba0ce932`](8ba0ce9),
[`0d034b682`](0d034b6),
[`abaa700ce`](abaa700)]:
    -   @vercel/[email protected]

## @vercel/[email protected]

### Patch Changes

- [node][next][redwood][remix] bump `@vercel/[email protected]`
([#11115](#11115))

## @vercel/[email protected]

### Patch Changes

- [node][next][redwood][remix] bump `@vercel/[email protected]`
([#11115](#11115))

## @vercel-internals/[email protected]

### Patch Changes

- Updated dependencies
\[[`b6ed28b9b`](b6ed28b),
[`8ba0ce932`](8ba0ce9),
[`0d034b682`](0d034b6),
[`abaa700ce`](abaa700)]:
    -   @vercel/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
styfle added a commit to vercel/next.js that referenced this pull request Apr 25, 2024
…ependency (#63321)

## History

Previously, we added support for `squoosh` because it was a wasm
implementation that "just worked" on all platforms when running `next
dev` for the first time. However, it was slow so we always recommended
manually installing `sharp` for production use cases running `next
build` and `next start`.

Now that [`sharp` supports
webassembly](https://sharp.pixelplumbing.com/install#webassembly), we no
longer need to maintain `squoosh`, so it can be removed. We also don't
need to make the user install sharp manually because it can be installed
under `optionalDependencies`. I left it optional in case there was some
platform that still needed to manually install the wasm variant with
`npm install --cpu=wasm32 sharp` such as codesandbox/stackblitz (I don't
believe sharp has any fallback built in yet).

Since we can guarantee `sharp`, we can also remove `get-orientation` dep
and upgrade `image-size` dep.

I also moved an [existing `sharp`
test](#56674) into its own fixture
since it was unrelated to image optimization.

## Related Issues
- Fixes #41417
- Related #54670
- Related #54708
- Related #44804
- Related #48820
- Related #61810
- Related #61696
- Related #44685
- Closes #64362

## Breaking Change

This is a breaking change because newer versions of `sharp` no longer
support `yarn@1`.

- lovell/sharp#3750

The workaround is to install with `yarn --ignore-engines` flag.

Also note that Vercel no longer defaults to yarn when no lockfile is
found

- vercel/vercel#11131
- vercel/vercel#11242

Closes NEXT-2823

This branch was successfully deployed

1 active deployment
Preview — f847681d Deployed Feb 8, 2024 by vercel[bot]
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.

2 participants