npm / npm/documentation

Overrides. Missed docs about short style for replacer

Open Beginner friendly
#1,929 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

I've noticed that many developers start using overrides in an unsafe style when reading the documentation.

There is no information in the documentation that you can specify a refinement of the package version for redefinition (there are only matchers for parent packages)

As a result, developers are starting to do something like this.

 "overrides": {
    "path-to-regexp": "0.1.13"
  },

In this way, they reimplement all versions of packages in the dependency tree, which is fundamentally unsafe.

path-to-regexp@0.1.12 -> 0.1.13
path-to-regexp@8.3.0 -> 0.1.13
path-to-regexp@8.4.0 -> 0.1.13
path-to-regexp@2.4.0 -> 0.1.13

NPM has support matchers for specific package (without parent matcher).

  "overrides": {
    "path-to-regexp@0.1.x": "0.1.13",
    "path-to-regexp@8.x.x": "8.4.0"
  },

But I did not find this mention in the documentation. I see via docs only that style:

  "overrides": {
    "path-to-regexp@0.1.x": { 
      ".": "0.1.13"
    }
    "path-to-regexp@8.x.x": {
      ".": "8.4.0"
    }
  },

Related links:

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 linked package.json overrides documentation page and compare its current examples with the reported short replacer style. Document how package-version refinements work without parent matchers, and consider the work done when the page clearly shows the safe version-specific syntax.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.