Skip to content

Commit af75d04

Browse files
authored
doc: remove Corepack documentation
PR-URL: #57635 Reviewed-By: Jordan Harband <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent c922bd8 commit af75d04

File tree

4 files changed

+4
-181
lines changed

4 files changed

+4
-181
lines changed

Diff for: doc/api/corepack.md

+3-132
Original file line numberDiff line numberDiff line change
@@ -12,139 +12,10 @@ added:
1212

1313
> Stability: 1 - Experimental
1414
15-
_[Corepack][Corepack repository]_ is an experimental tool to help with
16-
managing versions of your package managers. It exposes binary proxies for
17-
each [supported package manager][] that, when called, will identify whatever
18-
package manager is configured for the current project, download it if needed,
19-
and finally run it.
15+
Documentation for this tool can be found on the [Corepack repository][].
2016

2117
Despite Corepack being distributed with default installs of Node.js, the package
22-
managers managed by Corepack are not part of the Node.js distribution and:
18+
managers managed by Corepack are not part of the Node.js distribution, and
19+
Corepack itself will no longer be distributed with future versions of Node.js.
2320

24-
* Upon first use, Corepack downloads the latest version from the network.
25-
* Any required updates (related to security vulnerabilities or otherwise) are
26-
out of scope of the Node.js project. If necessary end users must figure out
27-
how to update on their own.
28-
29-
This feature simplifies two core workflows:
30-
31-
* It eases new contributor onboarding, since they won't have to follow
32-
system-specific installation processes anymore just to have the package
33-
manager you want them to.
34-
35-
* It allows you to ensure that everyone in your team will use exactly the
36-
package manager version you intend them to, without them having to
37-
manually synchronize it each time you need to make an update.
38-
39-
## Workflows
40-
41-
### Enabling the feature
42-
43-
Due to its experimental status, Corepack currently needs to be explicitly
44-
enabled to have any effect. To do that, run [`corepack enable`][], which
45-
will set up the symlinks in your environment next to the `node` binary
46-
(and overwrite the existing symlinks if necessary).
47-
48-
From this point forward, any call to the [supported binaries][] will work
49-
without further setup. Should you experience a problem, run
50-
[`corepack disable`][] to remove the proxies from your system (and consider
51-
opening an issue on the [Corepack repository][] to let us know).
52-
53-
### Configuring a package
54-
55-
The Corepack proxies will find the closest [`package.json`][] file in your
56-
current directory hierarchy to extract its [`"packageManager"`][] property.
57-
58-
If the value corresponds to a [supported package manager][], Corepack will make
59-
sure that all calls to the relevant binaries are run against the requested
60-
version, downloading it on demand if needed, and aborting if it cannot be
61-
successfully retrieved.
62-
63-
You can use [`corepack use`][] to ask Corepack to update your local
64-
`package.json` to use the package manager of your choice:
65-
66-
```bash
67-
corepack use [email protected] # sets the latest 7.x version in the package.json
68-
corepack use yarn@* # sets the latest version in the package.json
69-
```
70-
71-
### Upgrading the global versions
72-
73-
When running outside of an existing project (for example when running
74-
`yarn init`), Corepack will by default use predefined versions roughly
75-
corresponding to the latest stable releases from each tool. Those versions can
76-
be overridden by running the [`corepack install`][] command along with the
77-
package manager version you wish to set:
78-
79-
```bash
80-
corepack install --global [email protected]
81-
```
82-
83-
Alternately, a tag or range may be used:
84-
85-
```bash
86-
corepack install --global pnpm@*
87-
corepack install --global yarn@stable
88-
```
89-
90-
### Offline workflow
91-
92-
Many production environments don't have network access. Since Corepack
93-
usually downloads the package manager releases straight from their registries,
94-
it can conflict with such environments. To avoid that happening, call the
95-
[`corepack pack`][] command while you still have network access (typically at
96-
the same time you're preparing your deploy image). This will ensure that the
97-
required package managers are available even without network access.
98-
99-
The `pack` command has [various flags][]. Consult the detailed
100-
[Corepack documentation][] for more information.
101-
102-
## Supported package managers
103-
104-
The following binaries are provided through Corepack:
105-
106-
| Package manager | Binary names |
107-
| --------------- | ----------------- |
108-
| [Yarn][] | `yarn`, `yarnpkg` |
109-
| [pnpm][] | `pnpm`, `pnpx` |
110-
111-
## Common questions
112-
113-
### How does Corepack interact with npm?
114-
115-
While Corepack could support npm like any other package manager, its
116-
shims aren't enabled by default. This has a few consequences:
117-
118-
* It's always possible to run a `npm` command within a project configured to
119-
be used with another package manager, since Corepack cannot intercept it.
120-
121-
* While `npm` is a valid option in the [`"packageManager"`][] property, the
122-
lack of shim will cause the global npm to be used.
123-
124-
### Running `npm install -g yarn` doesn't work
125-
126-
npm prevents accidentally overriding the Corepack binaries when doing a global
127-
install. To avoid this problem, consider one of the following options:
128-
129-
* Don't run this command; Corepack will provide the package manager
130-
binaries anyway and will ensure that the requested versions are always
131-
available, so installing the package managers explicitly isn't needed.
132-
133-
* Add the `--force` flag to `npm install`; this will tell npm that it's fine to
134-
override binaries, but you'll erase the Corepack ones in the process. (Run
135-
[`corepack enable`][] to add them back.)
136-
137-
[Corepack documentation]: https://github.com/nodejs/corepack#readme
13821
[Corepack repository]: https://github.com/nodejs/corepack
139-
[Yarn]: https://yarnpkg.com
140-
[`"packageManager"`]: packages.md#packagemanager
141-
[`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name
142-
[`corepack enable`]: https://github.com/nodejs/corepack#corepack-enable--name
143-
[`corepack install`]: https://github.com/nodejs/corepack#corepack-install--g--global---all--nameversion
144-
[`corepack pack`]: https://github.com/nodejs/corepack#corepack-pack---all--nameversion
145-
[`corepack use`]: https://github.com/nodejs/corepack#corepack-use-nameversion
146-
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
147-
[pnpm]: https://pnpm.io
148-
[supported binaries]: #supported-package-managers
149-
[supported package manager]: #supported-package-managers
150-
[various flags]: https://github.com/nodejs/corepack#utility-commands

Diff for: doc/api/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* [Cluster](cluster.md)
2222
* [Command-line options](cli.md)
2323
* [Console](console.md)
24-
* [Corepack](corepack.md)
2524
* [Crypto](crypto.md)
2625
* [Debugger](debugger.md)
2726
* [Deprecated APIs](deprecations.md)

Diff for: doc/api/packages.md

-47
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,6 @@ For completeness there is also `--input-type=commonjs`, for explicitly running
259259
string input as CommonJS. This is the default behavior if `--input-type` is
260260
unspecified.
261261

262-
## Determining package manager
263-
264-
> Stability: 1 - Experimental
265-
266-
While all Node.js projects are expected to be installable by all package
267-
managers once published, their development teams are often required to use one
268-
specific package manager. To make this process easier, Node.js ships with a
269-
tool called [Corepack][] that aims to make all package managers transparently
270-
available in your environment - provided you have Node.js installed.
271-
272-
By default Corepack won't enforce any specific package manager and will use
273-
the generic "Last Known Good" versions associated with each Node.js release,
274-
but you can improve this experience by setting the [`"packageManager"`][] field
275-
in your project's `package.json`.
276-
277262
## Package entry points
278263

279264
In a package's `package.json` file, two fields can define entry points for a
@@ -905,8 +890,6 @@ The following fields in `package.json` files are used in Node.js:
905890
by package managers as the name of the package.
906891
* [`"main"`][] - The default module when loading the package, if exports is not
907892
specified, and in versions of Node.js prior to the introduction of exports.
908-
* [`"packageManager"`][] - The package manager recommended when contributing to
909-
the package. Leveraged by the [Corepack][] shims.
910893
* [`"type"`][] - The package type determining whether to load `.js` files as
911894
CommonJS or ES modules.
912895
* [`"exports"`][] - Package exports and conditional exports. When present,
@@ -971,33 +954,6 @@ via `require()`](modules.md#folders-as-modules).
971954
require('./path/to/directory');
972955
```
973956

974-
### `"packageManager"`
975-
976-
<!-- YAML
977-
added:
978-
- v16.9.0
979-
- v14.19.0
980-
-->
981-
982-
> Stability: 1 - Experimental
983-
984-
* Type: {string}
985-
986-
```json
987-
{
988-
"packageManager": "<package manager name>@<version>"
989-
}
990-
```
991-
992-
The `"packageManager"` field defines which package manager is expected to be
993-
used when working on the current project. It can be set to any of the
994-
[supported package managers][], and will ensure that your teams use the exact
995-
same package manager versions without having to install anything else other than
996-
Node.js.
997-
998-
This field is currently experimental and needs to be opted-in; check the
999-
[Corepack][] page for details about the procedure.
1000-
1001957
### `"type"`
1002958

1003959
<!-- YAML
@@ -1137,7 +1093,6 @@ This field defines [subpath imports][] for the current package.
11371093

11381094
[CommonJS]: modules.md
11391095
[Conditional exports]: #conditional-exports
1140-
[Corepack]: corepack.md
11411096
[ES module]: esm.md
11421097
[ES modules]: esm.md
11431098
[Node.js documentation for this section]: https://github.com/nodejs/node/blob/HEAD/doc/api/packages.md#conditions-definitions
@@ -1148,7 +1103,6 @@ This field defines [subpath imports][] for the current package.
11481103
[`"imports"`]: #imports
11491104
[`"main"`]: #main
11501105
[`"name"`]: #name
1151-
[`"packageManager"`]: #packagemanager
11521106
[`"type"`]: #type
11531107
[`--conditions` / `-C` flag]: #resolving-user-conditions
11541108
[`--no-addons` flag]: cli.md#--no-addons
@@ -1163,7 +1117,6 @@ This field defines [subpath imports][] for the current package.
11631117
[self-reference]: #self-referencing-a-package-using-its-name
11641118
[subpath exports]: #subpath-exports
11651119
[subpath imports]: #subpath-imports
1166-
[supported package managers]: corepack.md#supported-package-managers
11671120
[the dual CommonJS/ES module packages section]: #dual-commonjses-module-packages
11681121
[the full specifier path]: esm.md#mandatory-file-extensions
11691122
[the package examples repository]: https://github.com/nodejs/package-examples

Diff for: test/doctool/test-make-doc.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const linkedHtmls = [...new Set(links)].map((link) => link.match(re)[1])
4545
const expectedJsons = linkedHtmls
4646
.map((name) => name.replace('.html', '.json'));
4747
const expectedDocs = linkedHtmls.concat(expectedJsons);
48-
const renamedDocs = ['policy.json', 'policy.html'];
48+
const renamedDocs = ['corepack.json', 'corepack.html', 'policy.json', 'policy.html'];
4949
const skipedDocs = ['quic.json', 'quic.html'];
5050

5151
// Test that all the relative links in the TOC match to the actual documents.

0 commit comments

Comments
 (0)