Skip to content

Commit

Permalink
fix(doc): add package configuration instruction to readme (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiloCK authored Oct 13, 2022
1 parent bc03266 commit 0b7abb9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ We do acknowledge the irony and overhead of using npm to install Corepack, which

## Usage

### When Building Packages

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:

- **If the local project is configured for the package manager you're using**, Corepack will silently download and cache the latest compatible version.
Expand All @@ -44,6 +46,18 @@ Just use your package managers as you usually would. Run `yarn install` in Yarn

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

### When Authoring Packages

Set your package's manager with the `packageManager` field in `package.json`:

```json
{
"packageManager": "yarn@3.2.3+sha224.953c8233f7a92884eee2de69a1b92d1f2ec1655e66d08071ba9a02fa"
}
```

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`.

## Known Good Releases

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

0 comments on commit 0b7abb9

Please sign in to comment.