Back to Explore

sindresorhus/npm-run-path

GitHub
1 watchersOpen source

Last release: 8/26/2024

npm-run-path helps you prepend your local `node_modules/.bin` directories to the `PATH` when running commands in npm scripts. It exposes `npmRunPath()` (returns an updated PATH string) and `npmRunPathEnv()` (returns an updated `process.env` object), which is useful for executing locally installed binaries by name via Node.js child processes.

Project status

  • The project appears actively maintained, with recent updates and an upstream push on 2024-10-28 (after the latest published update).
  • Update cadence looks moderate, with versions v5.2.0 (2023-12-21), v5.3.0 (2024-02-23), and v6.0.0 (2024-08-26), suggesting periodic rather than continuous changes.

AI summary generated Today

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v6.0.0

    8/26/2024

    v6.0.0 raises the minimum supported Node.js version to 18 and improves PATH handling. It also adds idempotent behavior and better handling for empty PATH values.

    Breaking
  • v5.3.0

    2/23/2024

    v5.3.0 adds two new options, `preferLocal` and `addExecPath`, to control which directories are prepended to `PATH`. The code introduces conditional logic around adding `node_modules/.bin` and the Node executable directory, while keeping existing defaults as `true` to preserve current behavior.

    Features
  • v5.2.0

    12/21/2023

    v5.2.0 extends npm-run-path to accept file URLs for the execPath option, converting file:// URLs to filesystem paths before building PATH. The release notes only mention this execPath enhancement, but the diff also includes some packaging and repository maintenance changes.

    Features
  • v5.1.0

    2/9/2022

    v5.1.0 adds support for passing `cwd` as a `URL` object instead of only a string. The implementation converts file URLs to filesystem paths and updates both runtime logic and TypeScript types/tests/docs accordingly.

    Features
  • v5.0.1

    10/5/2021

    v5.0.1 is a very small patch release with only two modified files. The release notes claim it fixes a typo, but the provided diff shows a functional change in the main export.

  • v5.0.0

    10/5/2021

    v5.0.0 of npm-run-path is a major release that switches the package to ESM and changes the public exports to named exports. The code diff also updates TypeScript typings and the environment helper API, in addition to bumping dependencies and adding CI configuration.

    Breaking
  • v4.0.1

    12/22/2019

    v4.0.1 changes how npm-run-path constructs the PATH so that locally installed binaries take priority over the directory containing the running Node binary. The release notes specifically call out this priority change.

    Breaking
  • v4.0.0

    10/14/2019

    v4.0.0 introduces an `execPath` option to control which Node.js executable directory is prepended to PATH. It also changes PATH ordering so the directory for the current Node executable (`process.execPath`) is placed before locally installed `node_modules/.bin` entries.

    BreakingFeatures
  • v3.1.0

    4/5/2019

    v3.1.0 primarily refactors the TypeScript declaration files for npm-run-path to better support CommonJS usage. The code diff shows changes focused on the public TypeScript typing surface and test/type tooling updates rather than runtime functionality.

  • v3.0.0

    3/10/2019

    v3.0.0 introduces a breaking requirement to run on Node.js 8, which may require upgrading your runtime. It also adds TypeScript type definitions to improve developer experience when using the package in TypeScript projects.

    BreakingFeatures