mirror of
https://github.com/actions/setup-node
synced 2024-11-30 21:22:29 +08:00
Reorder to npm, yarn, pnpm
This commit is contained in:
parent
4bc87b8e10
commit
0ae03de2b7
30
README.md
30
README.md
@ -7,7 +7,7 @@
|
|||||||
This action provides the following functionality for GitHub Actions users:
|
This action provides the following functionality for GitHub Actions users:
|
||||||
|
|
||||||
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
|
- Optionally downloading and caching distribution of the requested Node.js version, and adding it to the PATH
|
||||||
- Optionally caching npm/pnpm/yarn dependencies
|
- Optionally caching npm/yarn/pnpm dependencies
|
||||||
- Registering problem matchers for error output
|
- Registering problem matchers for error output
|
||||||
- Configuring authentication for GPR or npm
|
- Configuring authentication for GPR or npm
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
|
|||||||
|
|
||||||
### Caching packages dependencies
|
### Caching packages dependencies
|
||||||
|
|
||||||
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `pnpm`, `yarn`. The `cache` input is optional, and caching is turned off by default.
|
The action has a built-in functionality for caching and restoring npm/yarn dependencies. Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default.
|
||||||
|
|
||||||
**Caching npm dependencies:**
|
**Caching npm dependencies:**
|
||||||
```yaml
|
```yaml
|
||||||
@ -55,6 +55,19 @@ steps:
|
|||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Caching yarn dependencies:**
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '14'
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install
|
||||||
|
- run: yarn test
|
||||||
|
```
|
||||||
|
Yarn caching handles both yarn versions: 1 or 2.
|
||||||
|
|
||||||
**Caching pnpm (v6.10+) dependencies:**
|
**Caching pnpm (v6.10+) dependencies:**
|
||||||
```yaml
|
```yaml
|
||||||
# This workflow uses actions that are not certified by GitHub.
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
@ -77,19 +90,6 @@ steps:
|
|||||||
- run: pnpm test
|
- run: pnpm test
|
||||||
```
|
```
|
||||||
|
|
||||||
**Caching yarn dependencies:**
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: '14'
|
|
||||||
cache: 'yarn'
|
|
||||||
- run: yarn install
|
|
||||||
- run: yarn test
|
|
||||||
```
|
|
||||||
Yarn caching handles both yarn versions: 1 or 2.
|
|
||||||
|
|
||||||
> At the moment, only `lock` files in the project root are supported.
|
> At the moment, only `lock` files in the project root are supported.
|
||||||
|
|
||||||
### Matrix Testing:
|
### Matrix Testing:
|
||||||
|
@ -20,7 +20,7 @@ inputs:
|
|||||||
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
|
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
cache:
|
cache:
|
||||||
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, pnpm, yarn'
|
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm'
|
||||||
# TODO: add input to control forcing to pull from cloud or dist.
|
# TODO: add input to control forcing to pull from cloud or dist.
|
||||||
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
|
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
|
||||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||||
|
Loading…
Reference in New Issue
Block a user