Skip to content

Conversation

@wraithgar
Copy link
Member

This was removed in npm 7 and never got re-added. In order for this not to be a breaking change the info was added to new fields, since the old fields are already being used to return counts.

This differs slightly from the npm 6 output, as "changed" now has a "from" and "to" field instead of a tacked on "previousVersion" field.

Closes: #6558

@wraithgar wraithgar requested a review from a team as a code owner April 17, 2025 03:53
@wraithgar
Copy link
Member Author

install

$ node ./gar_install-json install [email protected] --json
{
  "add": [
    {
      "name": "@popperjs/core",
      "version": "2.11.8",
      "path": "/Users/wraithgar/Development/scratch/json/node_modules/@popperjs/core"
    },
    {
      "name": "bootstrap",
      "version": "5.3.4",
      "path": "/Users/wraithgar/Development/scratch/json/node_modules/bootstrap"
    }
  ],
  "added": 2,
  "audited": 3,
  "change": [],
  "changed": 0,
  "funding": 0,
  "remove": [],
  "removed": 0,
  "audit": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 2,
      "dev": 0,
      "optional": 0,
      "peer": 1,
      "peerOptional": 0,
      "total": 2
    }
  }
}

change

$ node ./gar_install-json install [email protected] --json
{
  "add": [],
  "added": 0,
  "audited": 3,
  "change": [
    {
      "from": {
        "name": "bootstrap",
        "version": "5.3.5",
        "path": "/Users/wraithgar/Development/scratch/json/node_modules/bootstrap"
      },
      "to": {
        "name": "bootstrap",
        "version": "5.3.4",
        "path": "/Users/wraithgar/Development/scratch/json/node_modules/bootstrap"
      }
    }
  ],
  "changed": 1,
  "funding": 0,
  "remove": [],
  "removed": 0,
  "audit": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 2,
      "dev": 0,
      "optional": 0,
      "peer": 1,
      "peerOptional": 0,
      "total": 2
    }
  }
}

uninstall

$ node ./gar_install-json uninstall bootstrap --json
{
  "add": [],
  "added": 0,
  "audited": 1,
  "change": [],
  "changed": 0,
  "funding": 0,
  "remove": [
    {
      "name": "bootstrap",
      "version": "5.3.4",
      "path": "/Users/wraithgar/Development/scratch/json/node_modules/bootstrap"
    },
    {
      "name": "@popperjs/core",
      "version": "2.11.8",
      "path": "/Users/wraithgar/Development/scratch/json/node_modules/@popperjs/core"
    }
  ],
  "removed": 2,
  "audit": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 1,
      "dev": 0,
      "optional": 0,
      "peer": 0,
      "peerOptional": 0,
      "total": 0
    }
  }
}

This was removed in npm 7 and never got re-added.  In order for this not to be a breaking change the info was added to new fields, since the old fields are already being used to return counts.

This differs slightly from the npm 6 output, as "changed" now has a "from" and "to" field instead of a tacked on "previousVersion" field.

Closes: #6558
@wraithgar wraithgar merged commit 0d4c023 into latest Apr 18, 2025
20 checks passed
@wraithgar wraithgar deleted the gar/install-json branch April 18, 2025 00:18
@github-actions github-actions bot mentioned this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REGRESSION] Restore Complete JSON Output from 6.x

2 participants