Files
actions/node-setup
Ismo Vuorinen 77ee000e50 refactor: inline Node.js version detection into node-setup
Replace version-file-parser dependency with ~140 lines of inline detection:
- Detect from .nvmrc, package.json, .tool-versions, Dockerfile, devcontainer.json
- Detect package manager from lock files (bun, pnpm, yarn, npm)
- Use POSIX sh with set -eu for portability
- Include validate_version() and clean_version() helper functions
- Add diagnostic messages when jq unavailable

Detection priority: .nvmrc > package.json > .tool-versions > Dockerfile > devcontainer > default

Reduces external dependencies and improves initialization performance.
2025-11-20 10:36:40 +02:00
..
2025-11-19 15:42:06 +02:00
2025-11-19 15:42:06 +02:00

ivuorinen/actions/node-setup

Node Setup

Description

Sets up Node.js environment with version detection and package manager configuration.

Inputs

name description required default
default-version

Default Node.js version to use if no configuration file is found.

false 22
package-manager

Node.js package manager to use (npm, yarn, pnpm, bun, auto)

false auto
registry-url

Custom NPM registry URL

false https://registry.npmjs.org
token

Auth token for private registry

false ""
node-mirror

Custom Node.js binary mirror

false ""
force-version

Force specific Node.js version regardless of config files

false ""

Outputs

name description
node-version

Installed Node.js version

package-manager

Selected package manager

node-path

Path to Node.js installation

Runs

This action is a composite action.

Usage

- uses: ivuorinen/actions/node-setup@main
  with:
    default-version:
    # Default Node.js version to use if no configuration file is found.
    #
    # Required: false
    # Default: 22

    package-manager:
    # Node.js package manager to use (npm, yarn, pnpm, bun, auto)
    #
    # Required: false
    # Default: auto

    registry-url:
    # Custom NPM registry URL
    #
    # Required: false
    # Default: https://registry.npmjs.org

    token:
    # Auth token for private registry
    #
    # Required: false
    # Default: ""

    node-mirror:
    # Custom Node.js binary mirror
    #
    # Required: false
    # Default: ""

    force-version:
    # Force specific Node.js version regardless of config files
    #
    # Required: false
    # Default: ""