Skip to content

Commit 76a4cff

Browse files
author
Maxim Lobanov
authored
update readme and dist files
1 parent a869e7c commit 76a4cff

File tree

5 files changed

+888
-876
lines changed

5 files changed

+888
-876
lines changed

README.md

+10-34
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ major versions: `12`, `14`, `16`
3939
more specific versions: `10.15`, `14.2.0`, `16.3.0`
4040
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
4141

42-
### Caching packages dependencies
42+
## Caching packages dependencies
4343

44-
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings.
44+
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default.
4545

46-
Supported package managers are `npm`, `yarn`, `pnpm`. The `cache` input is optional, and caching is turned off by default.
46+
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
4747

48-
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories. See the examples of `cache-dependency-path` usage in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
49-
50-
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
48+
See the examples of using cache for `yarn` / `pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
5149

5250
**Caching npm dependencies:**
5351
```yaml
@@ -61,42 +59,20 @@ steps:
6159
- run: npm test
6260
```
6361

64-
**Caching yarn dependencies:**
62+
**Caching npm dependencies in monorepos:**
6563
```yaml
6664
steps:
6765
- uses: actions/checkout@v2
6866
- uses: actions/setup-node@v2
6967
with:
7068
node-version: '14'
71-
cache: 'yarn'
72-
- run: yarn install
73-
- run: yarn test
74-
```
75-
Yarn caching handles both yarn versions: 1 or 2.
76-
77-
**Caching pnpm (v6.10+) dependencies:**
78-
```yaml
79-
# This workflow uses actions that are not certified by GitHub.
80-
# They are provided by a third-party and are governed by
81-
# separate terms of service, privacy policy, and support
82-
# documentation.
83-
84-
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
85-
86-
steps:
87-
- uses: actions/checkout@v2
88-
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
89-
with:
90-
version: 6.10.0
91-
- uses: actions/setup-node@v2
92-
with:
93-
node-version: '14'
94-
cache: 'pnpm'
95-
- run: pnpm install
96-
- run: pnpm test
69+
cache: 'npm'
70+
cache-dependency-path: subdir/package-lock.json
71+
- run: npm install
72+
- run: npm test
9773
```
9874

99-
### Matrix Testing:
75+
## Matrix Testing:
10076
```yaml
10177
jobs:
10278
build:

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ inputs:
2222
cache:
2323
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm'
2424
cache-dependency-path:
25-
description: 'Used to specify path to a dependencies file: package-lock.json, yarn.lock, etc. Supports wildcards or an array of file names.'
25+
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
2626
# TODO: add input to control forcing to pull from cloud or dist.
2727
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
2828
# Deprecated option, do not use. Will not be supported after October 1, 2019

0 commit comments

Comments
 (0)