You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch enables Corepack, allowing to use pnpm directly
and unbundling yarn from the default image.
Removing yarn also simplifies the image and the maintenance.
This change has been discussed in
#777.
Closes#777, #1645, #1755.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ Thank you for your contribution. Here are a set of guidelines for contributing t
6
6
7
7
New **Node.js** releases are released as soon as possible.
8
8
9
-
New **NPM** releases are not tracked. We simply use the NPM version bundled in the corresponding Node.js release.
10
-
11
-
**Yarn** is updated to the latest version only when there is a new Node.js SemVer PATCH release (unless Yarn has received a security update), and it's updated only in the branch with the new release, preferably in the same PR. The `update.sh` script does this automatically when invoked with a specific branch, e.g. `./update.sh 6.10`.
9
+
New package manager releases are not tracked. We simply use the versions provided by [Corepack](https://github.com/nodejs/corepack).
Copy file name to clipboardExpand all lines: docs/BestPractices.md
+15-44Lines changed: 15 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,62 +27,33 @@ Run with `NODE_ENV` set to `production`. This is the way you would pass in secre
27
27
-e "NODE_ENV=production"
28
28
```
29
29
30
-
## Global npm dependencies
31
-
32
-
If you need to install global npm dependencies, it is recommended to place those dependencies in the [non-root user](#non-root-user) directory. To achieve this, add the following line to your `Dockerfile`
30
+
## Package Managers
33
31
34
-
```Dockerfile
35
-
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
36
32
37
-
ENV PATH=$PATH:/home/node/.npm-global/bin # optionally if you want to run npm global bin without specifying path
38
-
```
33
+
Just use your package managers as you usually would.
34
+
They will be automatically installed by [Corepack](https://github.com/nodejs/corepack), which is enabled by default.
39
35
40
-
## Upgrading/downgrading Yarn
36
+
Corepack downloads your package managers the first time you use them.
37
+
It honors the [`packageManager` field of your `package.json`](https://nodejs.org/api/packages.html#packagemanager)
38
+
if defined.
41
39
42
-
### Local
43
-
44
-
If you need to upgrade/downgrade `yarn` for a local install, you can do so by issuing the following commands in your `Dockerfile`:
45
-
46
-
> Note that if you create some other directory which is not a descendant one from where you ran the command, you will end up using the global (dated) version. If you wish to upgrade `yarn` globally follow the instructions in the next section.
47
-
48
-
> When following the local install instructions, due to duplicated yarn the image will end up being bigger.
49
-
50
-
```Dockerfile
51
-
FROM node:6
40
+
As many production environments don't have network access,
41
+
you probably want to bundle your package managers in your Docker image.
52
42
53
-
ENV YARN_VERSION 1.16.0
43
+
To do so, add the following line to your `Dockerfile`:
54
44
55
-
RUN yarn policies set-version $YARN_VERSION
56
45
```
57
-
58
-
### Global
59
-
60
-
```Dockerfile
61
-
FROM node:6
62
-
63
-
ENV YARN_VERSION 1.16.0
64
-
65
-
RUN curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
If you're using an Alpine-based image, `curl` won't be present, so you'll need to make sure it's installed while using it:
49
+
## Global npm dependencies
73
50
74
-
```Dockerfile
75
-
FROM node:6-alpine
51
+
If you need to install global npm dependencies, it is recommended to place those dependencies in the [non-root user](#non-root-user) directory. To achieve this, add the following line to your `Dockerfile`:
76
52
77
-
ENV YARN_VERSION 1.5.1
53
+
```Dockerfile
54
+
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
78
55
79
-
RUN apk add --no-cache --virtual .build-deps-yarn curl \
0 commit comments