Skip to content

Commit 96ea1ac

Browse files
Change default node-version-file to package.json (#6)
* Change default node-version-file to package.json * Add node version * Update README * Remove node version * Update readme * Use latest setup-node
1 parent 45ebe10 commit 96ea1ac

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ Allows changing the `node-version` passed to `actions/setup-node`.
3838
node-version: 18
3939
```
4040

41+
### `node-version-file`
42+
43+
Allows changing the `node-version-file` passed to `actions/setup-node`.
44+
45+
The default has changed from `actions/setup-node`'s `''` to `'package.json'`, enabling easy volta usage with 0 configuration for consumers of `wyvox/action-setup-pnpm`.
46+
_not_ providing a volta config also have 0 consequence.
47+
48+
```yaml
49+
- uses: wyvox/action-setup-pnpm@v3
50+
with:
51+
node-version-file: '.node-version'
52+
```
53+
4154
### `node-registry-url`
4255

4356
Allows changing the `registry-url` passed to `actions/setup-node`.
@@ -82,7 +95,7 @@ steps:
8295
- uses: pnpm/action-setup@v2
8396
with:
8497
version: 8
85-
- uses: actions/setup-node@v3
98+
- uses: actions/setup-node@v4
8699
with:
87100
cache: 'pnpm'
88101
- run: pnpm install

action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
node-version:
99
description: "Override the default node version, or override what is specified in your project's volta config"
1010
required: false
11+
node-version-file:
12+
description: "Override where the default node version is read from. By default this reads from package.json, which includes support for volta.node. Specifying node-version will override this"
13+
required: false
14+
default: 'package.json'
1115
node-registry-url:
1216
description: "Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN."
1317
required: false
@@ -118,10 +122,13 @@ runs:
118122
# Note also that volta's action does not have formal support for pnpm, nor its cache.
119123
# - does not install pnpm
120124
- name: 'Setup node and the cache for pnpm'
121-
uses: actions/setup-node@v3
125+
uses: actions/setup-node@v4
122126
with:
123127
cache: 'pnpm'
128+
# If specified, takes precedence over node-version-file
124129
node-version: ${{ inputs.node-version }}
130+
# Default node version read from package.json, but can be changed by passing in inputs.node-version-file
131+
node-version-file: ${{ inputs.node-version-file }}
125132
registry-url: ${{ inputs.node-registry-url }}
126133

127134
# It's only efficient to install dependencies

0 commit comments

Comments
 (0)