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
PR-URL: #45235
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
* add support for configurable registries and applicable auth options ([#186](https://github.com/nodejs/corepack/issues/186)) ([662ae90](https://github.com/nodejs/corepack/commit/662ae9057c7360cb05e9476914e611a9bf0074db))
* when strict checking is off, treat like transparent ([#197](https://github.com/nodejs/corepack/issues/197)) ([5eadc50](https://github.com/nodejs/corepack/commit/5eadc50192e205c60bfb1cad91854e9014a747b8))
11
+
12
+
13
+
### Bug Fixes
14
+
15
+
***doc:** add package configuration instruction to readme ([#188](https://github.com/nodejs/corepack/issues/188)) ([0b7abb9](https://github.com/nodejs/corepack/commit/0b7abb9833d332bad97902260d31652482c274a0))
16
+
* recreate cache folder if necessary ([#200](https://github.com/nodejs/corepack/issues/200)) ([7b5f2f9](https://github.com/nodejs/corepack/commit/7b5f2f9fcb24fe3fe517a96deaac7f32854f3124))
Copy file name to clipboardexpand all lines: deps/corepack/README.md
+33-17
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ We do acknowledge the irony and overhead of using npm to install Corepack, which
36
36
37
37
## Usage
38
38
39
+
### When Building Packages
40
+
39
41
Just use your package managers as you usually would. Run `yarn install` in Yarn projects, `pnpm install` in pnpm projects, and `npm` in npm projects. Corepack will catch these calls, and depending on the situation:
40
42
41
43
-**If the local project is configured for the package manager you're using**, Corepack will silently download and cache the latest compatible version.
@@ -44,6 +46,18 @@ Just use your package managers as you usually would. Run `yarn install` in Yarn
44
46
45
47
-**If the local project isn't configured for any package manager**, Corepack will assume that you know what you're doing, and will use whatever package manager version has been pinned as "known good release". Check the relevant section for more details.
46
48
49
+
### When Authoring Packages
50
+
51
+
Set your package's manager with the `packageManager` field in `package.json`:
Here, `yarn` is the name of the package manager, specified at version `3.2.3`, along with the SHA-224 hash of this version for validation. `packageManager@x.y.z` is required. The hash is optional but strongly recommended as a security practice. Permitted values for the package manager are `yarn`, `npm`, and `pnpm`.
60
+
47
61
## Known Good Releases
48
62
49
63
When running Corepack within projects that don't list a supported package
@@ -120,38 +134,40 @@ This command will retrieve the given package manager from the specified archive
120
134
manager versions that will be required for the projects you'll run, using
121
135
`corepack hydrate`).
122
136
123
-
-`COREPACK_ENABLE_STRICT` can be set to `0` to prevent Corepack from checking
137
+
-`COREPACK_ENABLE_STRICT` can be set to `0` to prevent Corepack from throwing error
138
+
if the package manager does not correspond to the one defined for the current project.
139
+
This means that if a user is using the package manager specified in the current project,
140
+
it will use the version specified by the project's `packageManager` field.
141
+
But if the user is using other package manager different from the one specified
142
+
for the current project, it will use the system-wide package manager version.
143
+
144
+
-`COREPACK_ENABLE_PROJECT_SPEC` can be set to `0` to prevent Corepack from checking
124
145
if the package manager corresponds to the one defined for the current project.
146
+
This means that it will always use the system-wide package manager regardless of
147
+
what is being specified in the project's `packageManager` field.
125
148
126
149
-`COREPACK_HOME` can be set in order to define where Corepack should install
127
150
the package managers. By default it is set to `%LOCALAPPDATA%\node\corepack`
128
151
on Windows, and to `$HOME/.cache/node/corepack` everywhere else.
129
152
130
153
-`COREPACK_ROOT` has no functional impact on Corepack itself; it's automatically being set in your environment by Corepack when it shells out to the underlying package managers, so that they can feature-detect its presence (useful for commands like `yarn init`).
131
154
132
-
-`HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` are supported through [`node-proxy-agent`](https://github.com/TooTallNate/node-proxy-agent).
155
+
-`COREPACK_NPM_REGISTRY` sets the registry base url used when retrieving package managers from npm. Default value is `https://registry.npmjs.org`
133
156
134
-
## Contributing
157
+
-`COREPACK_NPM_TOKEN` sets a Bearer token authorization header when connecting to a npm type registry.
135
158
136
-
If you want to build corepack yourself, you can build the project like this:
159
+
-`COREPACK_NPM_USERNAME` and `COREPACK_NPM_PASSWORD` to set a Basic authorization header when connecting to a npm type registry. Note that both environment variables are required and as plain text. If you want to send an empty password, explicitly set `COREPACK_NPM_PASSWORD` to an empty string.
137
160
138
-
1. Clone this repository
139
-
2. Run `yarn build` (no need for `yarn install`)
140
-
3. The `dist/` directory now contains the corepack build and the shims
141
-
4. Call `node ./dist/corepack --help` and behold
161
+
-`HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` are supported through [`node-proxy-agent`](https://github.com/TooTallNate/node-proxy-agent).
162
+
163
+
## Contributing
142
164
143
-
You can also run the tests with `yarn jest` (still no install needed).
165
+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
144
166
145
167
## Design
146
168
147
-
Various tidbits about Corepack's design are explained in more details in [DESIGN.md](/DESIGN.md).
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
154
-
>
155
-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
156
-
>
157
-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0 commit comments