Skip to content

Commit

Permalink
Change default node-version-file to package.json (#6)
Browse files Browse the repository at this point in the history
* Change default node-version-file to package.json

* Add node version

* Update README

* Remove node version

* Update readme

* Use latest setup-node
  • Loading branch information
NullVoxPopuli authored Dec 18, 2023
1 parent 45ebe10 commit 96ea1ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ Allows changing the `node-version` passed to `actions/setup-node`.
node-version: 18
```

### `node-version-file`

Allows changing the `node-version-file` passed to `actions/setup-node`.

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`.
_not_ providing a volta config also have 0 consequence.

```yaml
- uses: wyvox/action-setup-pnpm@v3
with:
node-version-file: '.node-version'
```

### `node-registry-url`

Allows changing the `registry-url` passed to `actions/setup-node`.
Expand Down Expand Up @@ -82,7 +95,7 @@ steps:
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- run: pnpm install
Expand Down
9 changes: 8 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
node-version:
description: "Override the default node version, or override what is specified in your project's volta config"
required: false
node-version-file:
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"
required: false
default: 'package.json'
node-registry-url:
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."
required: false
Expand Down Expand Up @@ -118,10 +122,13 @@ runs:
# Note also that volta's action does not have formal support for pnpm, nor its cache.
# - does not install pnpm
- name: 'Setup node and the cache for pnpm'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: 'pnpm'
# If specified, takes precedence over node-version-file
node-version: ${{ inputs.node-version }}
# Default node version read from package.json, but can be changed by passing in inputs.node-version-file
node-version-file: ${{ inputs.node-version-file }}
registry-url: ${{ inputs.node-registry-url }}

# It's only efficient to install dependencies
Expand Down

0 comments on commit 96ea1ac

Please sign in to comment.