[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\n    \"es2015\"\n  ],\n  \"plugins\": [\n    \"transform-runtime\",\n    \"transform-object-rest-spread\"\n  ]\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "# Get the plugin for your editor and your\n# tab settings will be set automatically.\n# http://EditorConfig.org\n\n# top-most EditorConfig file\nroot = true\n\n# Unix-style newlines with newline ending every file\n[*]\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n# Indentation override for all JS under lib directory\n[*.js]\nindent_size = 4\n"
  },
  {
    "path": ".gitignore",
    "content": "/.idea/\n/node_modules/\n/*.log\n/lib-es5/\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\n\nlanguage: node_js\n\nos:\n  - linux\n  - osx\n\nnode_js:\n  - 12.22.12\n  - 10.24.1\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "{\n  // Use IntelliSense to learn about possible attributes.\n  // Hover to view descriptions of existing attributes.\n  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n  \"version\": \"0.2.0\",\n  \"configurations\": [\n    {\n      \"type\": \"node\",\n      \"request\": \"launch\",\n      \"name\": \"cli\",\n      \"program\": \"${workspaceFolder}/lib/cli.js\",\n      \"args\": [\"--debug\"]\n    }\n  ]\n}\n"
  },
  {
    "path": "README.md",
    "content": "npm-check\n=========\n[![Build Status](https://travis-ci.org/dylang/npm-check.svg?branch=master)](https://travis-ci.org/dylang/npm-check)\n[![NPM version](https://badge.fury.io/js/npm-check.svg)](http://badge.fury.io/js/npm-check)\n[![npm](https://img.shields.io/npm/dm/npm-check.svg?maxAge=2592000)]()\n\n> Check for outdated, incorrect, and unused dependencies.\n\n<img width=\"796\" alt=\"npm-check -u\" src=\"https://cloud.githubusercontent.com/assets/51505/9569917/96947fea-4f48-11e5-9783-2d78077256f2.png\">\n\n### Features\n\n* Tells you what's out of date.\n* Provides a link to the package's documentation so you can decide if you want the update.\n* Kindly informs you if a dependency is not being used in your code.\n* Works on your globally installed packages too, via `-g`.\n* **Interactive Update** for less typing and fewer typos, via `-u`.\n* Supports public and private [@scoped/packages](https://docs.npmjs.com/getting-started/scoped-packages).\n* Supports ES6-style [`import from`](http://exploringjs.com/es6/ch_modules.html) syntax.\n* Upgrades your modules using your installed version of npm, including the new `npm@3`, so dependencies go where you expect them.\n* Works with any public npm registry, [private registries](https://www.npmjs.com/enterprise), and alternate registries like [Sinopia](https://github.com/rlidwka/sinopia).\n* Does not query registries for packages with `private: true` in their package.json.\n* Emoji in a command-line app, because command-line apps can be fun too.\n* Works with `npm@2` and `npm@3`, as well as newer alternative installers like `ied` and `pnpm`.\n\n### Requirements\n* Node >= 10.9.0\n\n### On the command line\n\nThis is the easiest way to use `npm-check`.\n\n### Install\n```bash\nnpm install -g npm-check\n```\n\n### Use\n```bash\nnpm-check\n```\n\n<img width=\"882\" alt=\"npm-check\" src=\"https://cloud.githubusercontent.com/assets/51505/9569919/99c2412a-4f48-11e5-8c65-e9b6530ee991.png\">\n\nThe result should look like the screenshot, or something nice when your packages are all up-to-date and in use.\n\nWhen updates are required it will return a non-zero response code that you can use in your CI tools.\n\n### Options\n\n```\nUsage\n  $ npm-check <path> <options>\n\nPath\n  Where to check. Defaults to current directory. Use -g for checking global modules.\n\nOptions\n  -u, --update          Interactive update.\n  -y, --update-all      Uninteractive update. Apply all updates without prompting.\n  -g, --global          Look at global modules.\n  -s, --skip-unused     Skip check for unused packages.\n  -p, --production      Skip devDependencies.\n  -d, --dev-only        Look at devDependencies only (skip dependencies).\n  -i, --ignore          Ignore dependencies based on succeeding glob.\n  -E, --save-exact      Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.\n  --specials            List of depcheck specials to include in check for unused dependencies.\n  --no-color            Force or disable color output.\n  --no-emoji            Remove emoji support. No emoji in default in CI environments.\n  --debug               Show debug output. Throw in a gist when creating issues on github.\n\nExamples\n  $ npm-check           # See what can be updated, what isn't being used.\n  $ npm-check ../foo    # Check another path.\n  $ npm-check -gu       # Update globally installed modules by picking which ones to upgrade.\n```\n\n![npm-check-u](https://cloud.githubusercontent.com/assets/51505/9569912/8c600cd8-4f48-11e5-8757-9387a7a21316.gif)\n\n#### `-u, --update`\n\nShow an interactive UI for choosing which modules to update.\n\nAutomatically updates versions referenced in the `package.json`.\n\n_Based on recommendations from the `npm` team, `npm-check` only updates using `npm install`, not `npm update`.\nTo avoid using more than one version of `npm` in one directory, `npm-check` will automatically install updated modules\nusing the version of `npm` installed globally._\n\n<img width=\"669\" alt=\"npm-check -g -u\" src=\"https://cloud.githubusercontent.com/assets/51505/9569921/9ca3aeb0-4f48-11e5-95ab-6fdb88124007.png\">\n\n##### Update using [ied](https://github.com/alexanderGugel/ied) or [pnpm](https://github.com/rstacruz/pnpm)\n\nSet environment variable `NPM_CHECK_INSTALLER` to the name of the installer you wish to use.\n\n```bash\nNPM_CHECK_INSTALLER=pnpm npm-check -u\n## pnpm install --save-dev foo@version --color=always\n```\n\nYou can also use this for dry-run testing:\n\n```bash\nNPM_CHECK_INSTALLER=echo npm-check -u\n```\n\n#### `-y, --update-all`\n\nUpdates your dependencies like `--update`, just without any prompt. This is especially useful if you want to automate your dependency updates with `npm-check`.\n\n#### `-g, --global`\n\nCheck the versions of your globally installed packages.\n\nIf the value of `process.env.NODE_PATH` is set, it will override the default path of global node_modules returned by package [`global-modules`](https://www.npmjs.com/package/global-modules).\n\n_Tip: Use `npm-check -u -g` to do a safe interactive update of global modules, including npm itself._\n\n#### `-s, --skip-unused`\n\nBy default `npm-check` will let you know if any of your modules are not being used by looking at `require` statements\nin your code.\n\nThis option will skip that check.\n\nThis is enabled by default when using `global` or `update`.\n\n#### `-p, --production`\n\nBy default `npm-check` will look at packages listed as `dependencies` and `devDependencies`.\n\nThis option will let it ignore outdated and unused checks for packages listed as `devDependencies`.\n\n#### `-d, --dev-only`\n\nIgnore `dependencies` and only check `devDependencies`.\n\nThis option will let it ignore outdated and unused checks for packages listed as `dependencies`.\n\n#### `-i, --ignore`\n\nIgnore dependencies that match specified glob.\n\n`$ npm-check -i babel-*` will ignore all dependencies starting with 'babel-'.\n\n#### `-E, --save-exact`\n\nInstall packages using `--save-exact`, meaning exact versions will be saved in package.json.\n\nApplies to both `dependencies` and `devDependencies`.\n\n#### `--specials`\n\nCheck special (e.g. config) files when looking for unused dependencies.\n\n`$ npm-check --specials=bin,webpack` will look in the `scripts` section of package.json and in webpack config.\n\nSee [https://github.com/depcheck/depcheck#special](https://github.com/depcheck/depcheck#special) for more information.\n\n#### `--color, --no-color`\n\nEnable or disable color support.\n\nBy default `npm-check` uses colors if they are available.\n\n#### `--emoji, --no-emoji`\n\nEnable or disable emoji support. Useful for terminals that don't support them. Automatically disabled in CI servers.\n\n#### `--spinner, --no-spinner`\n\nEnable or disable the spinner. Useful for terminals that don't support them. Automatically disabled in CI servers.\n\n### API\n\nThe API is here in case you want to wrap this with your CI toolset.\n\n```js\nconst npmCheck = require('npm-check');\n\nnpmCheck(options)\n  .then(currentState => console.log(currentState.get('packages')));\n```\n\n#### `update`\n\n* Interactive update.\n* default is `false`\n\n#### `global`\n\n* Check global modules.\n* default is `false`\n* `cwd` is automatically set with this option.\n\n#### `skipUnused`\n\n* Skip checking for unused packages.\n* default is `false`\n\n#### `ignoreDev`\n\n* Ignore `devDependencies`.\n* This is called `--production` on the command line to match `npm`.\n* default is `false`\n\n#### `devOnly`\n\n* Ignore `dependencies` and only check `devDependencies`.\n* default is `false`\n\n#### `ignore`\n\n* Ignore dependencies that match specified glob.\n* default is `[]`\n\n#### `saveExact`\n\n* Update package.json with exact version `x.y.z`  instead of semver range `^x.y.z`.\n* default is `false`\n\n#### `debug`\n\n* Show debug output. Throw in a gist when creating issues on github.\n* default is `false`\n\n#### `cwd`\n\n* Override where `npm-check` checks.\n* default is `process.cwd()`\n\n#### `specials`\n\n* List of [`depcheck`](https://github.com/depcheck/depcheck) special parsers to include.\n* default is `''`\n\n#### `currentState`\n\nThe result of the promise is a `currentState` object, look in [state.js](lib/state/state.js) to see how it works.\n\nYou will probably want `currentState.get('packages')` to get an array of packages and the state of each of them.\n\nEach item in the array will look like the following:\n\n```js\n{\n  moduleName: 'lodash',                 // name of the module.\n  homepage: 'https://lodash.com/',      // url to the home page.\n  regError: undefined,                  // error communicating with the registry\n  pkgError: undefined,                  // error reading the package.json\n  latest: '4.7.0',                      // latest according to the registry.\n  installed: '4.6.1',                   // version installed\n  isInstalled: true,                    // Is it installed?\n  notInstalled: false,                  // Is it installed?\n  packageWanted: '4.7.0',               // Requested version from the package.json.\n  packageJson: '^4.6.1',                // Version or range requested in the parent package.json.\n  devDependency: false,                 // Is this a devDependency?\n  usedInScripts: undefined,             // Array of `scripts` in package.json that use this module.\n  mismatch: false,                      // Does the version installed not match the range in package.json?\n  semverValid: '4.6.1',                 // Is the installed version valid semver?\n  easyUpgrade: true,                    // Will running just `npm install` upgrade the module?\n  bump: 'minor',                        // What kind of bump is required to get the latest, such as patch, minor, major.\n  unused: false                         // Is this module used in the code?\n},\n```\n\nYou will also see this if you use `--debug` on the command line.\n\n### RC File Support\nAdditional options can be sent to the depcheck process.  See [depcheck API](https://github.com/depcheck/depcheck#api).  Create a .npmcheckrc{.json,.yml,.js} file and set the depcheck options under depcheck property.\n\nFor example, to skip packages for unused check, but still want them in the outdated check (so can't use the --ignore option):\n```\n# .npmcheckrc\n\ndepcheck:\n  ignoreMatches: [\"replace-in-file\",\"snyk\",\"sonarqube-scanner\"]\n\n```\n\n### Inspiration\n\n* [npm outdated](https://docs.npmjs.com/cli/v7/commands/npm-outdated) - awkward output, requires --depth=0 to be grokable.\n* [david](https://github.com/alanshaw/david) - does not work with private registries.\n* [update-notifier](https://github.com/yeoman/update-notifier) - for single modules, not everything in package.json.\n* [depcheck](https://github.com/depcheck/depcheck) - only part of the puzzle. npm-check uses depcheck.\n\n### About the Author\n\nHi! Thanks for checking out this project! My name is **Dylan Greene**. When not overwhelmed with my two young kids I enjoy contributing\nto the open source community. I'm also a tech lead at [Opower](https://opower.com/). [![@dylang](https://img.shields.io/badge/github-dylang-green.svg)](https://github.com/dylang) [![@dylang](https://img.shields.io/badge/twitter-dylang-blue.svg)](https://twitter.com/dylang)\n\nHere's some of my other Node projects:\n\n| Name | Description | npm&nbsp;Downloads |\n|---|---|---|\n| [`grunt‑notify`](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux. | [![grunt-notify](https://img.shields.io/npm/dm/grunt-notify.svg?style=flat-square)](https://www.npmjs.org/package/grunt-notify) |\n| [`shortid`](https://github.com/dylang/shortid) | Amazingly short non-sequential url-friendly unique id generator. | [![shortid](https://img.shields.io/npm/dm/shortid.svg?style=flat-square)](https://www.npmjs.org/package/shortid) |\n| [`space‑hogs`](https://github.com/dylang/space-hogs) | Discover surprisingly large directories from the command line. | [![space-hogs](https://img.shields.io/npm/dm/space-hogs.svg?style=flat-square)](https://www.npmjs.org/package/space-hogs) |\n| [`rss`](https://github.com/dylang/node-rss) | RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. | [![rss](https://img.shields.io/npm/dm/rss.svg?style=flat-square)](https://www.npmjs.org/package/rss) |\n| [`grunt‑prompt`](https://github.com/dylang/grunt-prompt) | Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. | [![grunt-prompt](https://img.shields.io/npm/dm/grunt-prompt.svg?style=flat-square)](https://www.npmjs.org/package/grunt-prompt) |\n| [`xml`](https://github.com/dylang/node-xml) | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | [![xml](https://img.shields.io/npm/dm/xml.svg?style=flat-square)](https://www.npmjs.org/package/xml) |\n| [`changelog`](https://github.com/dylang/changelog) | Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. | [![changelog](https://img.shields.io/npm/dm/changelog.svg?style=flat-square)](https://www.npmjs.org/package/changelog) |\n| [`grunt‑attention`](https://github.com/dylang/grunt-attention) | Display attention-grabbing messages in the terminal | [![grunt-attention](https://img.shields.io/npm/dm/grunt-attention.svg?style=flat-square)](https://www.npmjs.org/package/grunt-attention) |\n| [`observatory`](https://github.com/dylang/observatory) | Beautiful UI for showing tasks running on the command line. | [![observatory](https://img.shields.io/npm/dm/observatory.svg?style=flat-square)](https://www.npmjs.org/package/observatory) |\n| [`anthology`](https://github.com/dylang/anthology) | Module information and stats for any @npmjs user | [![anthology](https://img.shields.io/npm/dm/anthology.svg?style=flat-square)](https://www.npmjs.org/package/anthology) |\n| [`grunt‑cat`](https://github.com/dylang/grunt-cat) | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | [![grunt-cat](https://img.shields.io/npm/dm/grunt-cat.svg?style=flat-square)](https://www.npmjs.org/package/grunt-cat) |\n\n_This list was generated using [anthology](https://github.com/dylang/anthology)._\n\n### License\nCopyright (c) 2016 Dylan Greene, contributors.\n\nReleased under the [MIT license](https://tldrlegal.com/license/mit-license).\n\nScreenshots are [CC BY-SA](https://creativecommons.org/licenses/by-sa/4.0/) (Attribution-ShareAlike).\n"
  },
  {
    "path": "appveyor.yml",
    "content": "environment:\n  matrix:\n  - nodejs_version: 12\n  - nodejs_version: 10\n\ninstall:\n  - ps: Install-Product node $env:nodejs_version\n  - npm install\n  - set CI=true\n\ntest_script:\n  - node --version\n  - npm --version\n  - npm run lint\n  - \"node lib\\\\cli.js || ver > null\"\n  - \"echo Exit code: %errorlevel%\"\n\nbuild: off\nshallow_clone: true\nclone_depth: 1\nversion: '{build}'\nmatrix:\n  fast_finish: true\n"
  },
  {
    "path": "bin/cli.js",
    "content": "#!/usr/bin/env node\n\nvar isEs2015;\ntry {\n    isEs2015 = new Function('() => {}');\n} catch (e) {\n    isEs2015 = false;\n}\nisEs2015 ? require('../lib/cli') : require('../lib-es5/cli');\n"
  },
  {
    "path": "index.d.ts",
    "content": "declare module NpmCheck { \n  interface INpmCheckOptions {\n    global?: boolean;\n    update?: boolean;\n    skipUnused?: boolean;\n    devOnly?: boolean;\n    ignoreDev?: boolean;\n    cwd?: string;\n    saveExact?: boolean;\n    currentState?: Object;\n  }\n\n  type INpmCheckGetSetValues = \"packages\" | \"debug\" | \"global\" | \"cwd\" | \"cwdPackageJson\" | \"emoji\";\n\n  type INpmVersionBumpType = \"patch\" | \"minor\" | \"major\" | \"prerelease\" | \"build\" | \"nonSemver\" | null;\n\n  interface INpmCheckCurrentState {\n    get: (key: INpmCheckGetSetValues) => INpmCheckPackage[];\n    set: (key: INpmCheckGetSetValues, val: any) => void;\n  }\n\n  interface INpmCheckPackage {\n    moduleName: string;                  // name of the module. \n    homepage: string;                    // url to the home page. \n    regError: any;                       // error communicating with the registry \n    pkgError: any;                       // error reading the package.json \n    latest: string;                      // latest according to the registry. \n    installed: string;                   // version installed \n    isInstalled: boolean;                // Is it installed? \n    notInstalled: boolean;               // Is it installed? \n    packageWanted: string;               // Requested version from the package.json. \n    packageJson: string;                 // Version or range requested in the parent package.json. \n    devDependency: boolean;              // Is this a devDependency? \n    usedInScripts: undefined | string[], // Array of `scripts` in package.json that use this module. \n    mismatch: boolean;                   // Does the version installed not match the range in package.json? \n    semverValid: string;                 // Is the installed version valid semver? \n    easyUpgrade: boolean;                // Will running just `npm install` upgrade the module? \n    bump: INpmVersionBumpType;           // What kind of bump is required to get the latest \n    unused: boolean;                     // Is this module used in the code? \n  }\n\n  //The default function returns a promise\n  export default function(options: INpmCheckOptions): {\n    then(stateFn: (state: INpmCheckCurrentState) => void): void;\n  };\n  \n}\n\ndeclare module \"npm-check\" {\n    export = NpmCheck.default;\n}"
  },
  {
    "path": "lib/cli.js",
    "content": "#!/usr/bin/env node\n'use strict';\n\nconst meow = require('meow');\nconst updateNotifier = require('update-notifier');\nconst isCI = require('is-ci');\nconst createCallsiteRecord = require('callsite-record');\nconst pkg = require('../package.json');\nconst npmCheck = require('./index');\nconst staticOutput = require('./out/static-output');\nconst interactiveUpdate = require('./out/interactive-update');\nconst updateAll = require('./out/update-all');\nconst debug = require('./state/debug');\nconst pkgDir = require('pkg-dir');\nconst detectPreferredPM = require('preferred-pm');\n\nupdateNotifier({pkg}).notify();\n\n/* eslint-disable indent */\nconst cli = meow(`\n        Usage\n          $ npm-check <path> <options>\n\n        Path\n          Where to check. Defaults to current directory. Use -g for checking global modules.\n\n        Options\n          -u, --update          Interactive update.\n          -y, --update-all      Uninteractive update. Apply all updates without prompting.\n          -g, --global          Look at global modules.\n          -s, --skip-unused     Skip check for unused packages.\n          -p, --production      Skip devDependencies.\n          -d, --dev-only        Look at devDependencies only (skip dependencies).\n          -i, --ignore          Ignore dependencies based on succeeding glob.\n          -E, --save-exact      Save exact version (x.y.z) instead of caret (^x.y.z) in package.json.\n          --specials            List of depcheck specials to include in check for unused dependencies.\n          --no-color            Force or disable color output.\n          --no-emoji            Remove emoji support. No emoji in default in CI environments.\n          --debug               Debug output. Throw in a gist when creating issues on github.\n\n        Examples\n          $ npm-check           # See what can be updated, what isn't being used.\n          $ npm-check ../foo    # Check another path.\n          $ npm-check -gu       # Update globally installed modules by picking which ones to upgrade.\n    `,\n    {\n        flags: {\n            update: {\n                type: 'boolean',\n                alias: 'u'\n            },\n            updateAll: {\n                type: 'boolean',\n                alias: 'y'\n            },\n            global: {\n                type: 'boolean',\n                alias: 'g'\n            },\n            skipUnused: {\n                type: 'boolean',\n                alias: 's'\n            },\n            production: {\n                type: 'boolean',\n                alias: 'p'\n            },\n            devOnly: {\n                type: 'boolean',\n                alias: 'd'\n            },\n            saveExact: {\n                type: 'boolean',\n                alias: 'E'\n            },\n            ignore: {\n                type: 'string',\n                alias: 'i'\n            },\n            specials: {\n                type: 'string'\n            },\n            color: {\n                type: 'boolean'\n            },\n            emoji: {\n                type: 'boolean',\n                default: !isCI\n            },\n            debug: {\n                type: 'boolean'\n            },\n            spinner: {\n                type: 'boolean',\n                default: !isCI\n            }\n        }\n    });\n\n/* eslint-enable indent */\n\nconst options = {\n    cwd: cli.input[0] || pkgDir.sync() || process.cwd(),\n    update: cli.flags.update,\n    updateAll: cli.flags.updateAll,\n    global: cli.flags.global,\n    skipUnused: cli.flags.skipUnused,\n    ignoreDev: cli.flags.production,\n    devOnly: cli.flags.devOnly,\n    saveExact: cli.flags.saveExact,\n    specials: cli.flags.specials,\n    emoji: cli.flags.emoji,\n    installer: process.env.NPM_CHECK_INSTALLER || 'auto',\n    debug: cli.flags.debug,\n    spinner: cli.flags.spinner,\n    ignore: cli.flags.ignore\n};\n\nif (options.debug) {\n    debug('cli.flags', cli.flags);\n    debug('cli.input', cli.input);\n}\n\nPromise.resolve()\n    .then(() => {\n        return options.installer === 'auto' ?\n            detectPreferredInstaller(options.cwd) :\n            options.installer;\n    })\n    .then(installer => {\n        options.installer = installer;\n        return npmCheck(options);\n    })\n    .then(currentState => {\n        currentState.inspectIfDebugMode();\n\n        if (options.updateAll) {\n            return updateAll(currentState);\n        }\n\n        if (options.update) {\n            return interactiveUpdate(currentState);\n        }\n\n        return staticOutput(currentState);\n    })\n    .catch(error => {\n        console.log(error.message);\n\n        if (options.debug) {\n            console.log(createCallsiteRecord(error).renderSync());\n        } else {\n            console.log('For more detail, add `--debug` to the command');\n        }\n\n        process.exit(1);\n    });\n\nconst SUPPORTED_INSTALLERS = new Set(['npm', 'pnpm', 'ied', 'yarn']);\n\nasync function detectPreferredInstaller(cwd) {\n    const preferredPM = await detectPreferredPM(cwd);\n    return preferredPM && SUPPORTED_INSTALLERS.has(preferredPM.name) ? preferredPM.name : 'npm';\n}\n"
  },
  {
    "path": "lib/in/best-guess-homepage.js",
    "content": "'use strict';\n\nconst gitUrl = require('giturl');\n\nfunction bestGuessHomepage(data) {\n    if (!data) {\n        return false;\n    }\n\n    const packageDataForLatest = data.versions[data['dist-tags'].latest];\n\n    return packageDataForLatest.homepage ||\n        packageDataForLatest.bugs && packageDataForLatest.bugs.url && gitUrl.parse(packageDataForLatest.bugs.url.trim()) ||\n        packageDataForLatest.repository && packageDataForLatest.repository.url && gitUrl.parse(packageDataForLatest.repository.url.trim());\n}\n\nmodule.exports = bestGuessHomepage;\n"
  },
  {
    "path": "lib/in/create-package-summary.js",
    "content": "'use strict';\n\nconst readPackageJson = require('./read-package-json');\nconst getLatestFromRegistry = require('./get-latest-from-registry');\nconst findModulePath = require('./find-module-path');\nconst _ = require('lodash');\nconst semverDiff = require('semver-diff');\nconst pathExists = require('path-exists');\nconst path = require('path');\nconst semver = require('semver');\nconst minimatch = require('minimatch');\n\nfunction createPackageSummary(moduleName, currentState) {\n    const cwdPackageJson = currentState.get('cwdPackageJson');\n\n    const modulePath = findModulePath(moduleName, currentState);\n    const packageIsInstalled = pathExists.sync(modulePath);\n    const modulePackageJson = readPackageJson(path.join(modulePath, 'package.json'));\n\n    // Ignore private packages\n    const isPrivate = Boolean(modulePackageJson.private);\n    if (isPrivate) {\n        return false;\n    }\n\n    // Ignore packages that are using github or file urls\n    const packageJsonVersion = cwdPackageJson.dependencies[moduleName] ||\n        cwdPackageJson.devDependencies[moduleName] ||\n        currentState.get('globalPackages')[moduleName];\n\n    if (packageJsonVersion && !semver.validRange(packageJsonVersion)) {\n        return false;\n    }\n\n    // Ignore specified '--ignore' package globs\n    const ignore = currentState.get('ignore');\n    if (ignore) {\n        const ignoreMatch = Array.isArray(ignore) ? ignore.some(ignoredModule => minimatch(moduleName, ignoredModule)) : minimatch(moduleName, ignore);\n        if (ignoreMatch) {\n            return false;\n        }\n    }\n\n    const unusedDependencies = currentState.get('unusedDependencies');\n    const missingFromPackageJson = currentState.get('missingFromPackageJson');\n\n    function foundIn(files) {\n        if (!files) {\n            return;\n        }\n\n        return 'Found in: ' + files.map(filepath => filepath.replace(currentState.get('cwd'), ''))\n            .join(', ');\n    }\n\n    return getLatestFromRegistry(moduleName)\n        .then(fromRegistry => {\n            const installedVersion = modulePackageJson.version;\n\n            const latest = installedVersion && fromRegistry.latest && fromRegistry.next && semver.gt(installedVersion, fromRegistry.latest) ? fromRegistry.next : fromRegistry.latest;\n            const versions = fromRegistry.versions || [];\n\n            const versionWanted = semver.maxSatisfying(versions, packageJsonVersion);\n\n            const versionToUse = installedVersion || versionWanted;\n            const usingNonSemver = semver.valid(latest) && semver.lt(latest, '1.0.0-pre');\n\n            const bump = semver.valid(latest) &&\n                        semver.valid(versionToUse) &&\n                        (usingNonSemver && semverDiff(versionToUse, latest) ? 'nonSemver' : semverDiff(versionToUse, latest));\n\n            const unused = _.includes(unusedDependencies, moduleName);\n\n            return {\n                // info\n                moduleName: moduleName,\n                homepage: fromRegistry.homepage,\n                regError: fromRegistry.error,\n                pkgError: modulePackageJson.error,\n\n                // versions\n                latest: latest,\n                installed: versionToUse,\n                isInstalled: packageIsInstalled,\n                notInstalled: !packageIsInstalled,\n                packageWanted: versionWanted,\n                packageJson: packageJsonVersion,\n\n                // Missing from package json\n                notInPackageJson: foundIn(missingFromPackageJson[moduleName]),\n\n                // meta\n                devDependency: _.has(cwdPackageJson.devDependencies, moduleName),\n                usedInScripts: _.findKey(cwdPackageJson.scripts, script => {\n                    return script.indexOf(moduleName) !== -1;\n                }),\n                mismatch: semver.validRange(packageJsonVersion) &&\n                    semver.valid(versionToUse) &&\n                    !semver.satisfies(versionToUse, packageJsonVersion),\n                semverValid:\n                    semver.valid(versionToUse),\n                easyUpgrade: semver.validRange(packageJsonVersion) &&\n                    semver.valid(versionToUse) &&\n                    semver.satisfies(latest, packageJsonVersion) &&\n                    bump !== 'major',\n                bump: bump,\n\n                unused: unused\n            };\n        });\n}\n\nmodule.exports = createPackageSummary;\n"
  },
  {
    "path": "lib/in/find-module-path.js",
    "content": "'use strict';\n\nconst Module = require('module');\nconst path = require('path');\nconst pathExists = require('path-exists');\n\n/**\n * Searches the directory hierarchy to return the path to the requested node module.\n * If the module can't be found, returns the initial (deepest) tried path.\n */\nfunction findModulePath(moduleName, currentState) {\n    const cwd = currentState.get('cwd');\n\n    if (currentState.get('global')) {\n        return path.join(cwd, moduleName);\n    }\n\n    // Module._nodeModulePaths does not include some places the node module resolver searches, such as\n    // the global prefix or other special directories. This is desirable because if a module is missing\n    // in the project directory we want to be sure to report it as missing.\n    // We can't use require.resolve because it fails if the module doesn't have an entry point.\n    const nodeModulesPaths = Module._nodeModulePaths(cwd);\n    const possibleModulePaths = nodeModulesPaths.map(x => path.join(x, moduleName));\n    const modulePath = possibleModulePaths.find(pathExists.sync);\n\n    // if no existing path was found, return the first tried path anyway\n    return modulePath || path.join(cwd, moduleName);\n}\n\nmodule.exports = findModulePath;\n"
  },
  {
    "path": "lib/in/get-installed-packages.js",
    "content": "'use strict';\nconst _ = require('lodash');\nconst globby = require('globby');\nconst readPackageJson = require('./read-package-json');\nconst path = require('path');\n\nmodule.exports = function (cwd) {\n    const GLOBBY_PACKAGE_JSON = '{*/package.json,@*/*/package.json}';\n    const installedPackages = globby.sync(GLOBBY_PACKAGE_JSON, {cwd: cwd});\n\n    return _(installedPackages)\n        .map(pkgPath => {\n            const pkg = readPackageJson(path.resolve(cwd, pkgPath));\n            return [pkg.name, pkg.version];\n        })\n        .fromPairs()\n        .valueOf();\n};\n"
  },
  {
    "path": "lib/in/get-latest-from-registry.js",
    "content": "'use strict';\n\nconst _ = require('lodash');\nconst bestGuessHomepage = require('./best-guess-homepage');\nconst semver = require('semver');\nconst packageJson = require('package-json');\nconst cpuCount = require('os').cpus().length;\nconst throat = require('throat')(cpuCount);\n\nfunction getNpmInfo(packageName) {\n    return throat(() => packageJson(packageName, { fullMetadata: true, allVersions: true }))\n        .then(rawData => {\n            const CRAZY_HIGH_SEMVER = '8000.0.0';\n\n            const sortedVersions = _(rawData.versions)\n                .keys()\n                .remove(_.partial(semver.gt, CRAZY_HIGH_SEMVER))\n                .sort(semver.compare)\n                .valueOf();\n\n            const latest = rawData['dist-tags'].latest;\n            const next = rawData['dist-tags'].next;\n            const latestStableRelease = semver.satisfies(latest, '*') ?\n                latest :\n                semver.maxSatisfying(sortedVersions, '*');\n            return {\n                latest: latestStableRelease,\n                next: next,\n                versions: sortedVersions,\n                homepage: bestGuessHomepage(rawData)\n            };\n        }).catch(err => {\n            const errorMessage = `Registry error ${err.message}`;\n            return {\n                error: errorMessage\n            };\n        });\n}\n\nmodule.exports = getNpmInfo;\n"
  },
  {
    "path": "lib/in/get-unused-packages.js",
    "content": "'use strict';\n\nconst depcheck = require('depcheck');\nconst ora = require('ora');\nconst _ = require('lodash');\nconst { rcFile } = require('rc-config-loader');\n\nfunction skipUnused(currentState) {\n    return currentState.get('skipUnused') ||        // manual option to ignore this\n        currentState.get('global') ||               // global modules\n        currentState.get('update') ||               // in the process of doing an update\n        !currentState.get('cwdPackageJson').name;   // there's no package.json\n}\n\nfunction loadRcFile(rcFileName) {\n    try {\n        const results = rcFile(rcFileName);\n        // Not Found\n        if (!results) {\n            return {};\n        }\n        return results.config;\n    } catch (error) {\n        console.error(`Error parsing rc file; skipping it; error: ${error.message}`);\n        return {}; // default value\n    }\n}\n\nfunction getSpecialParsers(currentState) {\n    const specialsInput = currentState.get('specials');\n    if (!specialsInput) return;\n    return specialsInput\n        .split(',')\n        .map((special) => depcheck.special[special])\n        .filter(Boolean);\n}\n\nfunction checkUnused(currentState) {\n    const spinner = ora(`Checking for unused packages. --skip-unused if you don't want this.`);\n    spinner.enabled = spinner.enabled && currentState.get('spinner');\n    spinner.start();\n\n    return new Promise(resolve => {\n        if (skipUnused(currentState)) {\n            resolve(currentState);\n            return;\n        }\n\n        const depcheckDefaults = {\n            ignoreDirs: [\n                'sandbox',\n                'dist',\n                'generated',\n                '.generated',\n                'build',\n                'fixtures',\n                'jspm_packages'\n            ],\n            ignoreMatches: [\n                'gulp-*',\n                'grunt-*',\n                'karma-*',\n                'angular-*',\n                'babel-*',\n                'metalsmith-*',\n                'eslint-plugin-*',\n                '@types/*',\n                'grunt',\n                'mocha',\n                'ava'\n            ],\n            specials: getSpecialParsers(currentState)\n        };\n\n        const npmCheckRc = loadRcFile('npmcheck');\n\n        const depcheckOptions = {\n            ...depcheckDefaults,\n            ...npmCheckRc.depcheck\n        };\n\n        depcheck(currentState.get('cwd'), depcheckOptions, resolve);\n    }).then(depCheckResults => {\n        spinner.stop();\n        const unusedDependencies = [].concat(depCheckResults.dependencies, depCheckResults.devDependencies);\n        currentState.set('unusedDependencies', unusedDependencies);\n\n        const cwdPackageJson = currentState.get('cwdPackageJson');\n\n        // currently missing will return devDependencies that aren't really missing\n        const missingFromPackageJson = _.omit(depCheckResults.missing || {},\n                    Object.keys(cwdPackageJson.dependencies), Object.keys(cwdPackageJson.devDependencies));\n        currentState.set('missingFromPackageJson', missingFromPackageJson);\n        return currentState;\n    });\n}\n\nmodule.exports = checkUnused;\n"
  },
  {
    "path": "lib/in/index.js",
    "content": "'use strict';\nconst co = require('co');\nconst extend = require('xtend');\nconst ora = require('ora');\nconst getUnusedPackages = require('./get-unused-packages');\nconst createPackageSummary = require('./create-package-summary');\n\nmodule.exports = function (currentState) {\n    return co(function *() {\n        yield getUnusedPackages(currentState);\n\n        const spinner = ora(`Checking npm registries for updated packages.`);\n        spinner.enabled = spinner.enabled && currentState.get('spinner');\n        spinner.start();\n\n        const cwdPackageJson = currentState.get('cwdPackageJson');\n\n        function dependencies(pkg) {\n            if (currentState.get('global')) {\n                return currentState.get('globalPackages');\n            }\n\n            if (currentState.get('ignoreDev')) {\n                return pkg.dependencies;\n            }\n\n            if (currentState.get('devOnly')) {\n                return pkg.devDependencies;\n            }\n\n            return extend(pkg.dependencies, pkg.devDependencies);\n        }\n\n        const allDependencies = dependencies(cwdPackageJson);\n        const allDependenciesIncludingMissing = Object.keys(extend(allDependencies, currentState.get('missingFromPackageJson')));\n\n        const arrayOfPackageInfo = yield allDependenciesIncludingMissing\n            .map(moduleName => createPackageSummary(moduleName, currentState))\n            .filter(Boolean);\n\n        currentState.set('packages', arrayOfPackageInfo);\n\n        spinner.stop();\n        return currentState;\n    });\n};\n"
  },
  {
    "path": "lib/in/read-package-json.js",
    "content": "'use strict';\n\nconst extend = require('xtend');\n\nfunction readPackageJson(filename) {\n    let pkg;\n    let error;\n    try {\n        pkg = require(filename);\n    } catch (e) {\n        if (e.code === 'MODULE_NOT_FOUND') {\n            error = new Error(`A package.json was not found at ${filename}`);\n        } else {\n            error = new Error(`A package.json was found at ${filename}, but it is not valid.`);\n        }\n    }\n    return extend({devDependencies: {}, dependencies: {}, error: error}, pkg)\n}\n\nmodule.exports = readPackageJson;\n"
  },
  {
    "path": "lib/index.js",
    "content": "'use strict';\n\nconst npmCheck = require('./in');\nconst createState = require('./state/state');\n\nasync function init(userOptions) {\n    return npmCheck(await createState(userOptions));\n}\n\nmodule.exports = init;\n"
  },
  {
    "path": "lib/out/emoji.js",
    "content": "'use strict';\n\nconst emoji = require('node-emoji');\n\nlet emojiEnabled = true;\n\nfunction output(name) {\n    if (emojiEnabled) {\n        return emoji.emojify(name);\n    }\n\n    return '';\n}\n\nfunction enabled(val) {\n    emojiEnabled = val;\n}\n\nmodule.exports = output;\nmodule.exports.enabled = enabled;\n"
  },
  {
    "path": "lib/out/install-packages.js",
    "content": "'use strict';\n\nconst chalk = require('chalk');\nconst execa = require('execa');\nconst ora = require('ora');\n\nfunction install(packages, currentState) {\n    if (!packages.length) {\n        return Promise.resolve(currentState);\n    }\n\n    const installer = currentState.get('installer');\n    const color = chalk.supportsColor ? '--color=always' : null;\n\n    const isYarn = installer === 'yarn';\n\n    const installGlobal = currentState.get('global') ? (isYarn ? 'global' : '--global'): null;\n    const saveExact = currentState.get('saveExact') ? (isYarn ? '--exact' : '--save-exact') : null;\n\n    const installCmd = isYarn ? 'add' : 'install';\n\n    const npmArgs = [installCmd]\n        .concat(installGlobal)\n        .concat(saveExact)\n        .concat(packages)\n        .concat(color)\n        .filter(Boolean);\n\n    console.log('');\n    console.log(`$ ${chalk.green(installer)} ${chalk.green(npmArgs.join(' '))}`);\n    const spinner = ora(`Installing using ${chalk.green(installer)}...`);\n    spinner.enabled = spinner.enabled && currentState.get('spinner');\n    spinner.start();\n\n    return execa(installer, npmArgs, {cwd: currentState.get('cwd')}).then(output => {\n        spinner.stop();\n        console.log(output.stdout);\n        console.log(output.stderr);\n\n        return currentState;\n    }).catch(err => {\n        spinner.stop();\n        throw err;\n    });\n}\n\nmodule.exports = install;\n"
  },
  {
    "path": "lib/out/interactive-update.js",
    "content": "'use strict';\n\nconst _ = require('lodash');\nconst inquirer = require('inquirer');\nconst chalk = require('chalk');\nconst table = require('text-table');\nconst installPackages = require('./install-packages');\nconst emoji = require('./emoji');\nconst stripAnsi = require('strip-ansi');\n\nconst UI_GROUPS = [\n    {\n        title: chalk.bold.underline.green('Update package.json to match version installed.'),\n        filter: {mismatch: true, bump: null}\n    },\n    {\n        title: `${chalk.bold.underline.green('Missing.')} ${chalk.green('You probably want these.')}`,\n        filter: {notInstalled: true, bump: null}\n    },\n    {\n        title: `${chalk.bold.underline.green('Patch Update')} ${chalk.green('Backwards-compatible bug fixes.')}`,\n        filter: {bump: 'patch'}\n    },\n    {\n        title: `${chalk.yellow.underline.bold('Minor Update')} ${chalk.yellow('New backwards-compatible features.')}`,\n        bgColor: 'yellow',\n        filter: {bump: 'minor'}\n    },\n    {\n        title: `${chalk.red.underline.bold('Major Update')} ${chalk.red('Potentially breaking API changes. Use caution.')}`,\n        filter: {bump: 'major'}\n    },\n    {\n        title: `${chalk.magenta.underline.bold('Non-Semver')} ${chalk.magenta('Versions less than 1.0.0, caution.')}`,\n        filter: {bump: 'nonSemver'}\n    }\n];\n\nfunction label(pkg) {\n    const bumpInstalled = pkg.bump ? pkg.installed : '';\n    const installed = pkg.mismatch ? pkg.packageJson : bumpInstalled;\n    const name = chalk.yellow(pkg.moduleName);\n    const type = pkg.devDependency ? chalk.green(' devDep') : '';\n    const missing = pkg.notInstalled ? chalk.red(' missing') : '';\n    const homepage = pkg.homepage ? chalk.blue.underline(pkg.homepage) : '';\n    return [\n        name + type + missing,\n        installed,\n        installed && '❯',\n        chalk.bold(pkg.latest || ''),\n        pkg.latest ? homepage : pkg.regError || pkg.pkgError\n    ];\n}\n\nfunction short(pkg) {\n    return `${pkg.moduleName}@${pkg.latest}`;\n}\n\nfunction choice(pkg) {\n    if (!pkg.mismatch && !pkg.bump && !pkg.notInstalled) {\n        return false;\n    }\n\n    return {\n        value: pkg,\n        name: label(pkg),\n        short: short(pkg)\n    };\n}\n\nfunction unselectable(options) {\n    return new inquirer.Separator(chalk.reset(options ? options.title : ' '));\n}\n\nfunction createChoices(packages, options) {\n    const filteredChoices = _.filter(packages, options.filter);\n\n    const choices = filteredChoices.map(choice)\n        .filter(Boolean);\n\n    const choicesAsATable = table(_.map(choices, 'name'), {\n        align: ['l', 'l', 'l'],\n        stringLength: function (str) {\n            return stripAnsi(str).length;\n        }\n    }).split('\\n');\n\n    const choicesWithTableFormating = _.map(choices, (choice, i) => {\n        choice.name = choicesAsATable[i];\n        return choice;\n    });\n\n    if (choicesWithTableFormating.length) {\n        choices.unshift(unselectable(options));\n        choices.unshift(unselectable());\n        return choices;\n    }\n}\n\nfunction buildPackageToUpdate(moduleName, version, isYarn, saveExact) {\n    // handle adding ^ for yarn, npm seems to handle this if not exact\n    return (isYarn && !saveExact) ? moduleName + '@^' + version : moduleName + '@' + version;\n}\n\nfunction interactive(currentState) {\n    const packages = currentState.get('packages');\n\n    if (currentState.get('debug')) {\n        console.log('packages', packages);\n    }\n\n    const choicesGrouped = UI_GROUPS.map(group => createChoices(packages, group))\n        .filter(Boolean);\n\n    const choices = _.flatten(choicesGrouped);\n\n    if (!choices.length) {\n        console.log(`${emoji(':heart:  ')}Your modules look ${chalk.bold('amazing')}. Keep up the great work.${emoji(' :heart:')}`);\n        return;\n    }\n\n    choices.push(unselectable());\n    choices.push(unselectable({title: 'Space to select. Enter to start upgrading. Control-C to cancel.'}));\n\n    const questions = [\n        {\n            name: 'packages',\n            message: 'Choose which packages to update.',\n            type: 'checkbox',\n            choices: choices.concat(unselectable()),\n            pageSize: process.stdout.rows - 2\n        }\n    ];\n\n    return inquirer.prompt(questions).then(answers => {\n        const packagesToUpdate = answers.packages;\n        const isYarn = currentState.get('installer') === 'yarn';\n        const saveExact = currentState.get('saveExact');\n\n        if (!packagesToUpdate || !packagesToUpdate.length) {\n            console.log('No packages selected for update.');\n            return false;\n        }\n\n        const saveDependencies = packagesToUpdate\n            .filter(pkg => !pkg.devDependency)\n            .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact));\n\n        const saveDevDependencies = packagesToUpdate\n            .filter(pkg => pkg.devDependency)\n            .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact));\n\n        const updatedPackages = packagesToUpdate\n            .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact)).join(', ');\n\n        if (!currentState.get('global')) {\n            if (saveDependencies.length) {\n                !isYarn && saveDependencies.push('--save');\n            }\n\n            if (saveDevDependencies.length) {\n                isYarn ? saveDevDependencies.push('--dev') : saveDevDependencies.push('--save-dev');\n            }\n        }\n\n        return installPackages(saveDependencies, currentState)\n            .then(currentState => installPackages(saveDevDependencies, currentState))\n            .then(currentState => {\n                console.log('');\n                console.log(chalk.green(`[npm-check] Update complete!`));\n                console.log(chalk.green('[npm-check] ' + updatedPackages));\n                console.log(chalk.green(`[npm-check] You should re-run your tests to make sure everything works with the updates.`));\n                return currentState;\n            });\n    });\n}\n\nmodule.exports = interactive;\n"
  },
  {
    "path": "lib/out/static-output.js",
    "content": "'use strict';\n\nconst chalk = require('chalk');\nconst _ = require('lodash');\nconst table = require('text-table');\nconst emoji = require('./emoji');\nconst stripAnsi = require('strip-ansi');\n\nfunction uppercaseFirstLetter(str) {\n    return str[0].toUpperCase() + str.substr(1);\n}\n\nfunction render(pkg, currentState) {\n    const packageName = pkg.moduleName;\n    const rows = [];\n\n    const indent = '           ' + emoji('   ');\n\n    const installer = currentState.get('installer');\n    const isYarn = installer === 'yarn';\n\n    const args = [isYarn ? 'add' : 'install'];\n    if (currentState.get('global')) {\n        isYarn ? args.unshift('global') : args.push('--global');\n    }\n\n    const flags = [];\n    if (isYarn) {\n        pkg.devDependency && flags.push('--dev');\n    } else {\n        pkg.devDependency ? flags.push('--save-dev') : flags.push('--save');\n    }\n\n    const upgradeCommand = `${installer} ${args.join(' ')} ${packageName}@${pkg.latest} ${flags.join(' ')}`;\n    const upgradeMessage = `${chalk.green(upgradeCommand)} to go from ${pkg.installed} to ${pkg.latest}`;\n    // DYLAN: clean this up\n    const status = _([\n        pkg.notInstalled ? chalk.bgRed.white.bold(emoji(' :worried: ') + ' MISSING! ') + ' Not installed.' : '',\n        pkg.notInPackageJson ? chalk.bgRed.white.bold(emoji(' :worried: ') + ' PKG ERR! ') + ' Not in the package.json. ' + pkg.notInPackageJson : '',\n        pkg.pkgError && !pkg.notInstalled ? chalk.bgGreen.white.bold(emoji(' :worried: ') + ' PKG ERR! ') + ' ' + chalk.red(pkg.pkgError.message) : '',\n        pkg.bump && pkg.easyUpgrade ? [\n            chalk.bgGreen.white.bold(emoji(' :heart_eyes: ') + ' UPDATE!  ') + ' Your local install is out of date. ' + chalk.blue.underline(pkg.homepage || ''),\n            indent + upgradeMessage\n        ] : '',\n        pkg.bump && !pkg.easyUpgrade ? [\n            chalk.white.bold.bgGreen((pkg.bump === 'nonSemver' ? emoji(' :sunglasses: ') + ' new ver! '.toUpperCase() : emoji(' :sunglasses: ') + ' ' + pkg.bump.toUpperCase() + ' UP ')) + ' ' + uppercaseFirstLetter(pkg.bump) + ' update available. ' + chalk.blue.underline(pkg.homepage || ''),\n            indent + upgradeMessage\n        ] : '',\n        pkg.unused ? [\n            chalk.black.bold.bgWhite(emoji(' :confused: ') + ' NOTUSED? ') + ` ${chalk.yellow(`Still using ${packageName}?`)}`,\n            indent + `Depcheck did not find code similar to ${chalk.green(`require('${packageName}')`)} or ${chalk.green(`import from '${packageName}'`)}.`,\n            indent + `Check your code before removing as depcheck isn't able to foresee all ways dependencies can be used.`,\n            indent + `Use rc file options to remove unused check, but still monitor for outdated version:`,\n            indent + `    .npmcheckrc {\"depcheck\": {\"ignoreMatches\": [\"${packageName}\"]}}`,\n            indent + `Use ${chalk.green('--skip-unused')} to skip this check.`,\n            indent + `To remove this package: ${chalk.green(\n                isYarn\n                    ? `yarn remove ${packageName} ${pkg.devDependency ? '--dev' : ''}`\n                    : `npm uninstall ${packageName} --save${pkg.devDependency ? '-dev' : ''}`\n            )}`\n        ] : '',\n        pkg.mismatch && !pkg.bump ? chalk.bgRed.yellow.bold(emoji(' :interrobang: ') + ' MISMATCH ') + ' Installed version does not match package.json. ' + pkg.installed + ' ≠ ' + pkg.packageJson : '',\n        pkg.regError ? chalk.bgRed.white.bold(emoji(' :no_entry: ') + ' NPM ERR! ') + ' ' + chalk.red(pkg.regError) : ''\n    ])\n    .flatten()\n    .compact()\n    .valueOf();\n\n    if (!status.length) {\n        return false;\n    }\n\n    rows.push(\n        [\n            chalk.yellow(packageName),\n            status.shift()\n        ]);\n\n    while (status.length) {\n        rows.push([\n            ' ',\n            status.shift()\n        ]);\n    }\n\n    rows.push(\n        [\n            ' '\n        ]);\n\n    return rows;\n}\n\nfunction outputConsole(currentState) {\n    const packages = currentState.get('packages');\n\n    const rows = packages.reduce((acc, pkg) => {\n        return acc.concat(render(pkg, currentState));\n    }, [])\n    .filter(Boolean);\n\n    if (rows.length) {\n        const renderedTable = table(rows, {\n            stringLength: s => stripAnsi(s).length\n        });\n\n        console.log('');\n        console.log(renderedTable);\n        console.log(`Use ${chalk.green(`npm-check -${currentState.get('global') ? 'g' : ''}u`)} for interactive update.`);\n        process.exitCode = 1;\n    } else {\n        console.log(`${emoji(':heart:  ')}Your modules look ${chalk.bold('amazing')}. Keep up the great work.${emoji(' :heart:')}`);\n        process.exitCode = 0;\n    }\n}\n\nmodule.exports = outputConsole;\n"
  },
  {
    "path": "lib/out/update-all.js",
    "content": "'use strict';\n\nconst chalk = require('chalk');\nconst installPackages = require('./install-packages');\nconst emoji = require('./emoji');\n\nfunction buildPackageToUpdate(moduleName, version, isYarn, saveExact) {\n    // handle adding ^ for yarn, npm seems to handle this if not exact\n    return (isYarn && !saveExact) ? moduleName + '@^' + version : moduleName + '@' + version;\n}\n\nfunction updateAll(currentState) {\n    const packages = currentState.get('packages');\n\n    if (currentState.get('debug')) {\n        console.log('packages', packages);\n    }\n\n    const packagesToUpdate = packages.filter(packageEntry => packageEntry.mismatch || packageEntry.notInstalled || packageEntry.bump );\n\n    if (!packagesToUpdate.length) {\n        console.log(`${emoji(':heart:  ')}Your modules look ${chalk.bold('amazing')}. Keep up the great work.${emoji(' :heart:')}`);\n        return;\n    }\n\n    const isYarn = currentState.get('installer') === 'yarn';\n    const saveExact = currentState.get('saveExact');\n\n    const saveDependencies = packagesToUpdate\n        .filter(pkg => !pkg.devDependency)\n        .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact));\n\n    const saveDevDependencies = packagesToUpdate\n        .filter(pkg => pkg.devDependency)\n        .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact));\n\n    const updatedPackages = packagesToUpdate\n        .map(pkg => buildPackageToUpdate(pkg.moduleName, pkg.latest, isYarn, saveExact)).join(', ');\n\n    if (!currentState.get('global')) {\n        if (saveDependencies.length) {\n            !isYarn && saveDependencies.push('--save');\n        }\n\n        if (saveDevDependencies.length) {\n            isYarn\n                ? saveDevDependencies.push('--dev')\n                : saveDevDependencies.push('--save-dev');\n        }\n    }\n\n    return installPackages(saveDependencies, currentState)\n        .then(currentState => installPackages(saveDevDependencies, currentState))\n        .then(currentState => {\n            console.log('');\n            console.log(chalk.green(`[npm-check] Update complete!`));\n            console.log(chalk.green('[npm-check] ' + updatedPackages));\n            console.log(chalk.green(`[npm-check] You should re-run your tests to make sure everything works with the updates.`));\n            return currentState;\n        });\n}\n\nmodule.exports = updateAll;\n"
  },
  {
    "path": "lib/state/debug.js",
    "content": "'use strict';\nconst chalk = require('chalk');\n\nfunction debug() {\n    console.log(chalk.green('[npm-check] debug'));\n    console.log.apply(console, arguments);\n    console.log(`${chalk.green('===============================')}`);\n}\n\nmodule.exports = debug;\n"
  },
  {
    "path": "lib/state/init.js",
    "content": "'use strict';\nconst _ = require('lodash');\nconst path = require('path');\nconst globalModulesPath = require('global-modules');\nconst readPackageJson = require('../in/read-package-json');\nconst globalPackages = require('../in/get-installed-packages');\nconst emoji = require('../out/emoji');\nconst fs = require('fs');\nconst chalk = require('chalk');\n\nfunction init(currentState, userOptions) {\n    return new Promise((resolve, reject) => {\n        _.each(userOptions, (value, key) => currentState.set(key, value));\n\n        if (currentState.get('global')) {\n            let modulesPath = globalModulesPath;\n\n            if (process.env.NODE_PATH) {\n                if (process.env.NODE_PATH.indexOf(path.delimiter) !== -1) {\n                    modulesPath = process.env.NODE_PATH.split(path.delimiter)[0];\n                    console.log(chalk.yellow('warning: Using the first of multiple paths specified in NODE_PATH'));\n                } else {\n                    modulesPath = process.env.NODE_PATH;\n                }\n            }\n\n            if (!fs.existsSync(modulesPath)) {\n                throw new Error('Path \"' + modulesPath + '\" does not exist. Please check the NODE_PATH environment variable.');\n            }\n\n            console.log(chalk.green('The global path you are searching is: ' + modulesPath));\n\n            currentState.set('cwd', globalModulesPath);\n            currentState.set('globalPackages', globalPackages(modulesPath));\n        } else {\n            const cwd = path.resolve(currentState.get('cwd'));\n            const pkg = readPackageJson(path.join(cwd, 'package.json'));\n            currentState.set('cwdPackageJson', pkg);\n            currentState.set('cwd', cwd);\n        }\n\n        emoji.enabled(currentState.get('emoji'));\n\n        if (currentState.get('cwdPackageJson').error) {\n            return reject(currentState.get('cwdPackageJson').error);\n        }\n\n        return resolve(currentState);\n    });\n}\n\nmodule.exports = init;\n"
  },
  {
    "path": "lib/state/state.js",
    "content": "'use strict';\nconst extend = require('xtend');\nconst init = require('./init');\nconst debug = require('./debug');\n\nconst defaultOptions = {\n    update: false,\n    updateAll: false,\n    global: false,\n    cwd: process.cwd(),\n    skipUnused: false,\n\n    ignoreDev: false,\n    devOnly: false,\n    forceColor: false,\n    saveExact: false,\n    specials: '',\n    debug: false,\n    emoji: true,\n    spinner: false,\n    installer: 'npm',\n    ignore: [],\n\n    globalPackages: {},\n    cwdPackageJson: {devDependencies: {}, dependencies: {}},\n\n    packages: false,\n    unusedDependencies: false,\n    missingFromPackageJson: {}\n};\n\nfunction state(userOptions) {\n    const currentStateObject = extend(defaultOptions);\n\n    function get(key) {\n        if (!currentStateObject.hasOwnProperty(key)) {\n            throw new Error(`Can't get unknown option \"${key}\".`);\n        }\n        return currentStateObject[key];\n    }\n\n    function set(key, value) {\n        if (get('debug')) {\n            debug('set key', key, 'to value', value);\n        }\n\n        if (currentStateObject.hasOwnProperty(key)) {\n            currentStateObject[key] = value;\n        } else {\n            throw new Error(`unknown option \"${key}\" setting to \"${JSON.stringify(value, false, 4)}\".`);\n        }\n    }\n\n    function inspectIfDebugMode() {\n        if (get('debug')) {\n            inspect();\n        }\n    }\n\n    function inspect() {\n        debug('current state', all());\n    }\n\n    function all() {\n        return currentStateObject;\n    }\n\n    const currentState = {\n        get: get,\n        set: set,\n        all,\n        inspectIfDebugMode\n    };\n\n    return init(currentState, userOptions);\n}\nmodule.exports = state;\n"
  },
  {
    "path": "license",
    "content": "The MIT License (MIT)\n\nCopyright (c) Dylan Greene <dylang@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"npm-check\",\n  \"version\": \"6.0.1\",\n  \"description\": \"Check for outdated, incorrect, and unused dependencies.\",\n  \"main\": \"lib\",\n  \"engines\": {\n    \"node\": \">=24.14.0\"\n  },\n  \"types\": \"./index.d.ts\",\n  \"typings\": \"./index.d.ts\",\n  \"scripts\": {\n    \"lint\": \"xo ./lib/*.js\",\n    \"test\": \"npm run lint && ./bin/cli.js || echo Exit Status: $?.\",\n    \"transpile\": \"babel lib --out-dir lib-es5\",\n    \"watch\": \"babel lib --out-dir lib-es5 --watch\",\n    \"prepublish\": \"npm run transpile\"\n  },\n  \"xo\": {\n    \"space\": 4,\n    \"rules\": {\n      \"no-warning-comments\": [\n        0\n      ],\n      \"global-require\": [\n        0\n      ]\n    }\n  },\n  \"bin\": {\n    \"npm-check\": \"bin/cli.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/dylang/npm-check.git\"\n  },\n  \"keywords\": [\n    \"npm\",\n    \"outdated\",\n    \"dependencies\",\n    \"unused\",\n    \"changelog\",\n    \"check\",\n    \"updates\",\n    \"api\",\n    \"interactive\",\n    \"cli\",\n    \"safe\",\n    \"updating\",\n    \"updater\",\n    \"installer\",\n    \"devDependencies\"\n  ],\n  \"author\": {\n    \"name\": \"Dylan Greene\",\n    \"email\": \"dylang@gmail.com\"\n  },\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/dylang/npm-check/issues\"\n  },\n  \"homepage\": \"https://github.com/dylang/npm-check\",\n  \"files\": [\n    \"bin\",\n    \"lib\",\n    \"lib-es5\"\n  ],\n  \"dependencies\": {\n    \"callsite-record\": \"^4.1.5\",\n    \"chalk\": \"^5.6.2\",\n    \"co\": \"^4.6.0\",\n    \"depcheck\": \"^1.4.7\",\n    \"execa\": \"^9.6.1\",\n    \"giturl\": \"^2.0.0\",\n    \"global-modules\": \"^2.0.0\",\n    \"globby\": \"^16.1.1\",\n    \"inquirer\": \"^13.3.2\",\n    \"is-ci\": \"^4.1.0\",\n    \"lodash\": \"^4.17.23\",\n    \"meow\": \"^14.1.0\",\n    \"minimatch\": \"^10.2.4\",\n    \"node-emoji\": \"^2.2.0\",\n    \"ora\": \"^9.3.0\",\n    \"package-json\": \"^10.0.1\",\n    \"path-exists\": \"^5.0.0\",\n    \"pkg-dir\": \"^9.0.0\",\n    \"preferred-pm\": \"^5.0.0\",\n    \"rc-config-loader\": \"^4.1.4\",\n    \"semver\": \"^7.7.4\",\n    \"semver-diff\": \"^5.0.0\",\n    \"strip-ansi\": \"^7.2.0\",\n    \"text-table\": \"^0.2.0\",\n    \"throat\": \"^6.0.2\",\n    \"update-notifier\": \"^7.3.1\",\n    \"xtend\": \"^4.0.2\"\n  },\n  \"devDependencies\": {\n    \"babel-runtime\": \"^6.26.0\",\n    \"babel-cli\": \"^6.26.0\",\n    \"babel-plugin-transform-object-rest-spread\": \"^6.26.0\",\n    \"babel-plugin-transform-runtime\": \"^6.23.0\",\n    \"babel-preset-es2015\": \"^6.24.1\",\n    \"xo\": \"^0.37.1\"\n  }\n}\n"
  },
  {
    "path": "renovate.json",
    "content": "{\n  \"$schema\": \"https://json.schemastore.org/renovate\",\n  \"extends\": [\n    \"config:base\",\n    \":rebaseStalePrs\",\n    \":semanticCommits\",\n    \":automergeAll\",\n    \":maintainLockFilesWeekly\",\n    \":prHourlyLimitNone\"\n  ],\n  \"timezone\": \"America/New_York\",\n  \"rangeStrategy\": \"bump\",\n  \"schedule\": [ \"every weekend\"],\n  \"updateNotScheduled\": false,\n  \"lockFileMaintenance\": {\n    \"enabled\": true,\n    \"schedule\": [ \"every weekend\" ]\n  }\n}\n"
  }
]