mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-11-04 03:28:19 +08:00 
			
		
		
		
	Add readme example for omitting version (#134)
				
					
				
			* Add readme example for omitting `version` * docs: more detailed explanations --------- Co-authored-by: Khải <hvksmr1996@gmail.com>
This commit is contained in:
		
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
								
							@@ -60,7 +60,9 @@ Location of `pnpm` and `pnpx` command.
 | 
			
		||||
 | 
			
		||||
## Usage example
 | 
			
		||||
 | 
			
		||||
### Just install pnpm
 | 
			
		||||
### Install only pnpm without `packageManager`
 | 
			
		||||
 | 
			
		||||
This works when the repo either doesn't have a `package.json` or has a `package.json` but it doesn't specify `packageManager`.
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
on:
 | 
			
		||||
@@ -77,6 +79,23 @@ jobs:
 | 
			
		||||
          version: 8
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
###  Install only pnpm with `packageManager`
 | 
			
		||||
 | 
			
		||||
Omit `version` input to use the version in the [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
on:
 | 
			
		||||
  - push
 | 
			
		||||
  - pull_request
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  install:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: pnpm/action-setup@v4
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Install pnpm and a few npm packages
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user