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

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

Merged
merged 9 commits into from
Feb 8, 2024

Conversation

styfle
Copy link
Member

@styfle styfle commented Feb 8, 2024

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.

Copy link

changeset-bot bot commented Feb 8, 2024

🦋 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

packages/build-utils/src/fs/run-user-scripts.ts Outdated Show resolved Hide resolved
packages/build-utils/src/fs/run-user-scripts.ts Outdated Show resolved Hide resolved
packages/build-utils/test/unit.test.ts Show resolved Hide 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
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
115 checks passed
@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/build-utils@7.6.0

### 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))

## vercel@33.5.0

### 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/next@4.1.1
    -   @vercel/node@3.0.18
    -   @vercel/redwood@2.0.7
    -   @vercel/remix-builder@2.0.19
    -   @vercel/build-utils@7.6.0
    -   @vercel/static-build@2.3.0

## @vercel/static-build@2.3.0

### Minor Changes

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

### Patch Changes

- Updated dependencies
\[[`ab2444466`](ab24444)]:
    -   @vercel/gatsby-plugin-vercel-builder@2.0.17

## @vercel/client@13.1.2

### Patch Changes

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

## @vercel/gatsby-plugin-vercel-builder@2.0.17

### Patch Changes

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

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

## @vercel/next@4.1.1

### Patch Changes

- [node][next][redwood][remix] bump `@vercel/nft@0.26.3`
([#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/node@3.0.18

### Patch Changes

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

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

## @vercel/redwood@2.0.7

### Patch Changes

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

## @vercel/remix-builder@2.0.19

### Patch Changes

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

## @vercel-internals/types@1.0.22

### Patch Changes

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build-utils pr: automerge Automatically merge the PR when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants