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: enable yarn and pnpm Corepack binaries by default #51886

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions doc/api/corepack.md
Expand Up @@ -30,18 +30,6 @@ This feature simplifies two core workflows:

## Workflows

### Enabling the feature

Due to its experimental status, Corepack currently needs to be explicitly
enabled to have any effect. To do that, run [`corepack enable`][], which
will set up the symlinks in your environment next to the `node` binary
(and overwrite the existing symlinks if necessary).

From this point forward, any call to the [supported binaries][] will work
without further setup. Should you experience a problem, run
[`corepack disable`][] to remove the proxies from your system (and consider
opening an issue on the [Corepack repository][] to let us know).

### Configuring a package

The Corepack proxies will find the closest [`package.json`][] file in your
Expand Down Expand Up @@ -130,13 +118,11 @@ install. To avoid this problem, consider one of the following options:
[Corepack repository]: https://github.com/nodejs/corepack
[Yarn]: https://yarnpkg.com
[`"packageManager"`]: packages.md#packagemanager
[`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name
[`corepack enable`]: https://github.com/nodejs/corepack#corepack-enable--name
[`corepack install`]: https://github.com/nodejs/corepack#corepack-install--g--global---all--nameversion
[`corepack pack`]: https://github.com/nodejs/corepack#corepack-pack---all--nameversion
[`corepack use`]: https://github.com/nodejs/corepack#corepack-use-nameversion
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
[pnpm]: https://pnpm.js.org
[supported binaries]: #supported-package-managers
[supported package manager]: #supported-package-managers
[various flags]: https://github.com/nodejs/corepack#utility-commands
9 changes: 4 additions & 5 deletions tools/install.py
Expand Up @@ -116,11 +116,10 @@ def npm_files(options, action):
def corepack_files(options, action):
package_files(options, action, 'corepack', {
'corepack': 'dist/corepack.js',
# Not the default just yet:
# 'yarn': 'dist/yarn.js',
# 'yarnpkg': 'dist/yarn.js',
# 'pnpm': 'dist/pnpm.js',
# 'pnpx': 'dist/pnpx.js',
'yarn': 'dist/yarn.js',
'yarnpkg': 'dist/yarn.js',
'pnpm': 'dist/pnpm.js',
'pnpx': 'dist/pnpx.js',
})

# On z/OS, we install node-gyp for convenience, as some vendors don't have
Expand Down
8 changes: 6 additions & 2 deletions tools/msvs/msi/nodemsi/i18n/en-us.wxl
Expand Up @@ -20,10 +20,14 @@
<String Id="NodeRuntime_Description" Value="Install the core [ProductName] runtime (node.exe)."/>

<String Id="npm_Title" Value="npm package manager"/>
<String Id="npm_Description" Value="Install npm, the recommended package manager for [ProductName]."/>
<String Id="npm_Description" Value="Install npm, a package manager for [ProductName]."/>
Copy link
Member

Choose a reason for hiding this comment

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

This change does not relate to enabling Corepack by default (ie. we can recommend npm even though Corepack is being distributed). I'd suggest making a separate PR so we can discuss this change independently.

Suggested change
<String Id="npm_Description" Value="Install npm, a package manager for [ProductName]."/>
<String Id="npm_Description" Value="Install npm, the recommended package manager for [ProductName]."/>


<String Id="corepack_Title" Value="corepack manager"/>
<String Id="corepack_Title" Value="Corepack manager"/>
<String Id="corepack_Description" Value="Install corepack, the universal package manager for [ProductName]."/>
<String Id="corepack_pnpm_Title" Value="pnpm package manager"/>
<String Id="corepack_pnpm_Description" Value="Install pnpm, a package manager for [ProductName], distributed by Corepack."/>
<String Id="corepack_yarn_Title" Value="Yarn package manager"/>
<String Id="corepack_yarn_Description" Value="Install Yarn, a package manager for [ProductName], distributed by Corepack."/>

<String Id="DocumentationShortcuts_Title" Value="Online documentation shortcuts"/>
<String Id="DocumentationShortcuts_Description" Value="Add start menu entries that link the online documentation for [ProductName] [FullVersion] and the [ProductName] website."/>
Expand Down
32 changes: 32 additions & 0 deletions tools/msvs/msi/nodemsi/product.wxs
Expand Up @@ -82,6 +82,22 @@
<ComponentGroupRef Id="CorepackSourceFiles"/>
</Feature>

<Feature Id="corepack_pnpm"
Level="1"
Title="!(loc.corepack_pnpm_Title)"
Description="!(loc.corepack_pnpm_Description)">
<ComponentRef Id="CorepackpnpmCmdScript"/>
<ComponentRef Id="CorepackpnpmBashScript"/>
</Feature>

<Feature Id="corepack_yarn"
Level="1"
Title="!(loc.corepack_yarn_Title)"
Description="!(loc.corepack_yarn_Description)">
<ComponentRef Id="CorepackYarnCmdScript"/>
<ComponentRef Id="CorepackYarnBashScript"/>
</Feature>

<Feature Id="npm"
Level="1"
Title="!(loc.npm_Title)"
Expand Down Expand Up @@ -216,6 +232,22 @@
<File Id="corepack.sh" KeyPath="yes" Source="$(var.CorepackSourceDir)\shims\nodewin\corepack"/>
</Component>

<Component Id="CorepackPnpmCmdScript">
<File Id="corepack.cmd" KeyPath="yes" Source="$(var.CorepackSourceDir)\shims\nodewin\pnpm.cmd"/>
</Component>

<Component Id="CorepackPnpmBashScript">
<File Id="corepack.sh" KeyPath="yes" Source="$(var.CorepackSourceDir)\shims\nodewin\pnpm"/>
</Component>

<Component Id="CorepackYarnCmdScript">
<File Id="corepack.cmd" KeyPath="yes" Source="$(var.CorepackSourceDir)\shims\nodewin\yarn.cmd"/>
</Component>

<Component Id="CorepackYarnBashScript">
<File Id="corepack.sh" KeyPath="yes" Source="$(var.CorepackSourceDir)\shims\nodewin\yarn"/>
</Component>

<Component Id="NpmCmdScript">
<File Id="npm.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm.cmd"/>
</Component>
Expand Down