meta_package_manager.managers.npm — Meta Package Manager 2.4.1 documentation

# `meta_package_manager.managers.npm`

class `meta_package_manager.managers.npm.` `NPM`

  Bases: `meta_package_manager.base.PackageManager`

  `cli_path` = u'/usr/local/bin/npm'
  `platforms` = frozenset([u'macos'])
  `get_version`()

    Fetch version from `npm --version` output.

  `name` = u"Node's npm"
  `installed`

    Fetch installed packages from `npm list` output.

    Raw CLI output samples:

        $ npm list -g --json
        {
          "dependencies": {
            "npm": {
              "version": "4.0.5",
              "dependencies": {
                "JSONStream": {
                  "version": "1.2.1",
                  "from": "JSONStream@latest",
                  "resolved": "https://(...)/JSONStream-1.2.1.tgz",
                  "dependencies": {
                    "jsonparse": {
                      "version": "1.2.0",
                      "from": "jsonparse@>=1.2.0 <2.0.0",
                      "resolved": "https://(...)/jsonparse-1.2.0.tgz"
                    },
                    "through": {
                      "version": "2.3.8",
                      "from": "through@>=2.2.7 <3.0.0",
                      "resolved": "https://(...)/through-2.3.8.tgz"
                    }
                  }
                },
                "abbrev": {
                  "version": "1.0.9",
                  "from": "abbrev@1.0.9",
                  "resolved": "https://(...)/abbrev-1.0.9.tgz"
                },
                "ansi-regex": {
                  "version": "2.0.0",
                  "from": "ansi-regex@2.0.0",
                  "resolved": "https://(...)/ansi-regex-2.0.0.tgz"
                },
        (...)

  `outdated`

    Fetch outdated packages from `npm outdated` output.

    Raw CLI output samples:

        $ npm -g --progress=false --json outdated
        {
          "my-linked-package": {
            "current": "0.0.0-development",
            "wanted": "linked",
            "latest": "linked",
            "location": "/Users/..."
          },
          "npm": {
            "current": "3.10.3",
            "wanted": "3.10.5",
            "latest": "3.10.5",
            "location": "/Users/..."
          }
        }

  `upgrade_cli`(package_id=None)
  `upgrade_all_cli`()