From ecb6f5316c43d094b7f4b91ecf3ad7454184c902 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 17 Jul 2022 22:58:14 +0200 Subject: [PATCH] add documentation --- README.md | 1 + docs/advanced-usage.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/README.md b/README.md index c3d07869..1d01d1db 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ jobs: 6. [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm) 7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn) 8. [Using private packages](docs/advanced-usage.md#use-private-packages) +9. [Use `corepack` to automatically install package managers](docs/advanced-usage.md#corepack) ## License diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 4b620cbd..73331842 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -286,3 +286,31 @@ NOTE: As per https://github.com/actions/setup-node/issues/49 you cannot use `sec ### always-auth input The always-auth input sets `always-auth=true` in .npmrc file. With this option set [npm](https://docs.npmjs.com/cli/v6/using-npm/config#always-auth)/yarn sends the authentication credentials when making a request to the registries. + +## Automatically enable `corepack` + +_Requires Node >=14.x_ + +`corepack` is a new experimental feature that automatically installs package managers as they are used. [Read more about it here](https://nodejs.org/docs/latest/api/corepack.html) + +```yaml +steps: +- uses: actions/checkout@v3 +- uses: actions/setup-node@v3 + with: + node-version: '14.x' + corepack: enable +``` + +It is recommended to configure `package.json#packageManager` if you want to use it. + +e.g. +```json +{ + "name": "example", + "packageManager": "pnpm@7.5.2", + // ... +} +``` + +