npm / npm/documentation

Scripts documentation incorrectly states all package.json fields are provided via the environment

Open
#1,178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MDX
Stars
712
Forks
4.2k
Avg merge
4d 16h
Merged PRs (30d)
3

Description

According to the scripts documentation, all of the fields in package.json are exposed to scripts via environment variables. However, this isn't true: they were removed in 2021 in npm 7 without replacement. I eventually had to track down the 7.0.0-rc0 changelog to find out what changed and the motivation; it would be great if the docs accurately reflected the current state of what's available for scripts.

There are a few issues about this in the npm repo, a couple of which are still open and mention that the docs are out of date:
https://github.com/npm/cli/issues/3022
https://github.com/npm/cli/issues/2452

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the scripts documentation section linked in the issue, especially the packagejson-vars content, and compare its claims with the npm 7.0.0-rc0 changelog and the linked npm issues. Update the documentation to describe the current environment variables accurately and ensure the outdated claim is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
cli, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.