3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-25 03:29:33 +01:00

Reorder to npm, yarn, pnpm

This commit is contained in:
Jacob Gillespie 2021-07-15 20:14:30 +01:00
parent 4bc87b8e10
commit 0ae03de2b7
No known key found for this signature in database
GPG key ID: 52D71192EF3DBDD9
2 changed files with 16 additions and 16 deletions

View file

@ -7,7 +7,7 @@
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 caching npm/pnpm/yarn dependencies
- Optionally caching npm/yarn/pnpm dependencies
- Registering problem matchers for error output
- Configuring authentication for GPR or npm
@ -41,7 +41,7 @@ nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
### 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:**
```yaml
@ -55,6 +55,19 @@ steps:
- 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:**
```yaml
# This workflow uses actions that are not certified by GitHub.
@ -77,19 +90,6 @@ steps:
- 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.
### Matrix Testing:

View file

@ -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.
default: ${{ github.token }}
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.
# 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