npm / npm/documentation

Document the meaing of `peer` in the package-lock.json documentation.

Open
#1,773 1 comment 37 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 am currently trying to diagnose why a package-lock.json is being changed - the behaviour appears to be different between versions 10 and 11 of npm.

On version 11 of npm I see diffs that look like this:

     "node_modules/@aws-amplify/core": {
       "version": "6.13.0",
       "license": "Apache-2.0",
+      "peer": true,
       "dependencies": {

I can not ascertain the meaning of this property.

It is not documented here:

https://docs.npmjs.com/cli/v11/configuring-npm/package-lock-json#packages

I do see this line

bin, license, engines, dependencies, optionalDependencies: fields from package.json

This seems like an incomplete list, for example I can see diffs that mention cpu and os

+    "node_modules/@parcel/watcher-android-arm64": {
       "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.4.1.tgz",
+      "integrity": "sha512-LOi/WTbbh3aTn2RYddrO8pnapixAziFl6SMxHM69r3tvdSm94JtCenaKgk1GRg5FJ5wpMCpHeW+7yqPlvZv7kg==",
+      "cpu": [
+        "arm64"
+      ],
       "dev": true,
       "license": "MIT",
       "optional": true,
-      "dependencies": {
-        "detect-libc": "^1.0.3",
-        "is-glob": "^4.0.3",
-        "micromatch": "^4.0.5",
-        "node-addon-api": "^7.0.0"
-      },
+      "os": [
+        "android"
+      ],

However - I assume that these properties come from package.json : see: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#os

There is no such property peer on package.json - so I'm still at a loss to what it means.

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 package-lock.json documentation's packages section and compare it with the linked package.json os documentation. Determine and document what the npm v11 peer field means, and clarify which fields such as cpu and os can appear in lockfile package entries; done when the observed entries are explained in the documentation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.