Skip to content

Commit 0b7abb9

Browse files
authored
fix(doc): add package configuration instruction to readme (#188)
1 parent bc03266 commit 0b7abb9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ We do acknowledge the irony and overhead of using npm to install Corepack, which
3636

3737
## Usage
3838

39+
### When Building Packages
40+
3941
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:
4042

4143
- **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
4446

4547
- **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.
4648

49+
### When Authoring Packages
50+
51+
Set your package's manager with the `packageManager` field in `package.json`:
52+
53+
```json
54+
{
55+
"packageManager": "yarn@3.2.3+sha224.953c8233f7a92884eee2de69a1b92d1f2ec1655e66d08071ba9a02fa"
56+
}
57+
```
58+
59+
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+
4761
## Known Good Releases
4862

4963
When running Corepack within projects that don't list a supported package

0 commit comments

Comments
 (0)