mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:23:34 +00:00 
			
		
		
		
	improve caching documentation
This commit is contained in:
		
							parent
							
								
									56337c4255
								
							
						
					
					
						commit
						52f916cae1
					
				@ -41,12 +41,14 @@ major versions: `12`, `14`, `16`
 | 
				
			|||||||
more specific versions: `10.15`, `14.2.0`, `16.3.0`
 | 
					more specific versions: `10.15`, `14.2.0`, `16.3.0`
 | 
				
			||||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
 | 
					nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Caching packages dependencies
 | 
					## Caching global packages data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the 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.
 | 
					The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data 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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.
 | 
					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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Note:** The action does not cache `node_modules`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.
 | 
					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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching npm dependencies:**
 | 
					**Caching npm dependencies:**
 | 
				
			||||||
@ -101,7 +103,7 @@ jobs:
 | 
				
			|||||||
1. [Check latest version](docs/advanced-usage.md#check-latest-version)
 | 
					1. [Check latest version](docs/advanced-usage.md#check-latest-version)
 | 
				
			||||||
2. [Using a node version file](docs/advanced-usage.md#node-version-file)
 | 
					2. [Using a node version file](docs/advanced-usage.md#node-version-file)
 | 
				
			||||||
3. [Using different architectures](docs/advanced-usage.md#architecture)
 | 
					3. [Using different architectures](docs/advanced-usage.md#architecture)
 | 
				
			||||||
4. [Caching packages dependencies](docs/advanced-usage.md#caching-packages-dependencies)
 | 
					4. [Caching packages data](docs/advanced-usage.md#caching-packages-dependencies)
 | 
				
			||||||
5. [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures)
 | 
					5. [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures)
 | 
				
			||||||
6. [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
 | 
					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)
 | 
					7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
 | 
				
			||||||
 | 
				
			|||||||
@ -55,7 +55,7 @@ jobs:
 | 
				
			|||||||
      - run: npm test
 | 
					      - run: npm test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Caching packages dependencies
 | 
					## Caching packages data
 | 
				
			||||||
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.
 | 
					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.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Caching yarn dependencies:**
 | 
					**Caching yarn dependencies:**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user