From 0b7abb9833d332bad97902260d31652482c274a0 Mon Sep 17 00:00:00 2001 From: Colin Kennedy Date: Thu, 13 Oct 2022 11:32:26 -0300 Subject: [PATCH] fix(doc): add package configuration instruction to readme (#188) --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 8ba03a760..01a7c635d 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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