All Projects → th0r → Npm Upgrade

th0r / Npm Upgrade

Licence: mit
Interactive CLI utility to easily update outdated NPM dependencies

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Npm Upgrade

Npmvet
A simple CLI tool for vetting npm package versions
Stars: ✭ 193 (-21.22%)
Mutual labels:  cli, npm, packages
Release It
🚀 Automate versioning and package publishing
Stars: ✭ 4,773 (+1848.16%)
Mutual labels:  cli, npm, changelog
Npm Compare
Compare npm packages from your terminal
Stars: ✭ 55 (-77.55%)
Mutual labels:  cli, npm, packages
Syncpack
Manage multiple package.json files, such as in Lerna Monorepos and Yarn/Pnpm Workspaces
Stars: ✭ 356 (+45.31%)
Mutual labels:  cli, npm, packages
Pizza Cli
🍕 Order a pizza in a CLI app (just for fun!)
Stars: ✭ 58 (-76.33%)
Mutual labels:  cli, npm, interactive
Keep A Changelog
Tools for manipulating CHANGELOG.md files in Keep A Changelog format, including tagging and releasing.
Stars: ✭ 155 (-36.73%)
Mutual labels:  cli, changelog
Ndash
your npm dashboard! (react-native app)
Stars: ✭ 158 (-35.51%)
Mutual labels:  npm, packages
Cash Cli
💰💰 Convert currency rates directly from your terminal!
Stars: ✭ 168 (-31.43%)
Mutual labels:  cli, npm
Qoa
Minimal interactive command-line prompts
Stars: ✭ 2,007 (+719.18%)
Mutual labels:  cli, interactive
Script Progress
Estimate script execution time
Stars: ✭ 175 (-28.57%)
Mutual labels:  cli, npm
Ni
💡 Use the right package manager
Stars: ✭ 179 (-26.94%)
Mutual labels:  cli, npm
Ohshitgit
⁉️Oh shit! A cli tool to help you unfuck your git mistakes
Stars: ✭ 135 (-44.9%)
Mutual labels:  cli, npm
Atbmarket
🎉 JUST FOR FUN :: npm package of ATB plastic bag
Stars: ✭ 123 (-49.8%)
Mutual labels:  cli, npm
Jira Cli
A jira user friendly command line client
Stars: ✭ 167 (-31.84%)
Mutual labels:  cli, npm
Create New Cli
Create your own CLI using a series of simple commands.
Stars: ✭ 122 (-50.2%)
Mutual labels:  cli, npm
Getme
CLI utility for everyday tasks. With getme you get weather, forecast, currency rate, upload files, IP address, word definitions, text translations, internet speed, do google searches, get inspirational quotes and get Chuck Norris jokes
Stars: ✭ 118 (-51.84%)
Mutual labels:  cli, npm
Gem updater
Update gems in your Gemfile and fetch their changelogs
Stars: ✭ 206 (-15.92%)
Mutual labels:  update, changelog
Survey
A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
Stars: ✭ 2,843 (+1060.41%)
Mutual labels:  cli, interactive
Stow
GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
Stars: ✭ 207 (-15.51%)
Mutual labels:  cli, packages
Semana Js Expert30
Aulas da Semana JS Expert 3.0 - Construindo um chat multiplataforma usando linha de comando e JavaScript Avançado
Stars: ✭ 238 (-2.86%)
Mutual labels:  cli, npm

npm-upgrade

Interactive CLI utility to easily update outdated NPM dependencies with changelogs inspection support.

NPM version Downloads

What is this for?

If you are tired of manually upgrading package.json every time your package dependencies are getting out of date then this utility is for you.

Take a look at this demo:

npm-upgrade outdated packages

Installation

First, install Node.js (at least v10.19).

Then install this utility as global npm-module:

npm i -g npm-upgrade

Usage

This utility is supposed to be run in the root directory of your Node.js project (that contains package.json). Run npm-upgrade --help to see all available top-level commands:

check [filter]          Check for outdated modules
ignore <command>        Manage ignored modules
changelog <moduleName>  Show changelog for a module

Run npm-upgrade <command> --help to see usage help for corresponding command. check is the default command and can be omitted so running npm-upgrade [filter] is the same as npm-upgrade check [filter].

check command

It will find all your outdated deps and will ask to updated their versions in package.json, one by one. For example, here is what you will see if you use outdated version of @angular/common module:

Update "@angular/common" in package.json from 2.4.8 to 2.4.10? (Use arrow keys)
❯ Yes
  No
  Show changelog
  Ignore
  Finish update process
  • Yes will update @angular/common version in package.json to 2.4.10, but not immediately (see explanation below)
  • No will not update this module version.
  • Show changelog will try to find changelog url for the current module and open it in default browser.
  • Ignore will add this module to the ignored list (see details in Ignoring module section below).
  • Finish update process will ...hm... finish update process and save all the changes to package.json.

A note on saving changes to package.json: when you choose Yes to update some module's version, package.json won't be immediately updated. It will be updated only after you will process all the outdated modules and confirm update or when you choose Finish update process. So if in the middle of the update process you've changed your mind just press Ctrl+C and package.json will remain untouched.

If you want to check only some deps, you can use filter argument:

# Will check only `babel-core` module:
npm-upgrade babel-core

# Will check all the deps with `babel` in the name:
npm-upgrade '*babel*'

# Note quotes around `filter`. They are necessary because without them bash may interpret `*` as wildcard character.

# Will check all the deps, excluding any with `babel` in the name:
npm-upgrade '!*babel*'

# You can combine including and excluding rules:
npm-upgrade '*babel* !babel-transform-* !babel-preset-*'

If you want to check only a group of deps use these options:

-p, --production   Check only "dependencies"
-d, --development  Check only "devDependencies"
-o, --optional     Check only "optionalDependencies"

Ignoring module

Sometimes you just want to ignore newer versions of some dependency for some reason. For example, you use jquery v2 because of the old IE support and don't want npm-upgrade to suggest you updating it to v3. Or you use [email protected] and know that the new version 6.6.6 contains a bug that breaks your app.

You can handle these situations by ignoring such modules. You can do it in two ways: choosing Ignore during update process or using npm ignore add command.

You will asked two questions. First is a version range to ignore. It should be a valid semver version. Here are a few examples:

  • 6.6.6 - will ignore only version 6.6.6. When the next version after 6.6.6 will be published npm-upgrade will suggest to update it. Can be used in some-funky-module example above.
  • >2 - will ignore all versions starting from 3.0.0. Can be used in jquery v2 example above.
  • 6.6.x || 6.7.x - will ignore all 6.6.x and 6.7.x versions.
  • * - will ignore all new versions.

And after that npm-upgrade will ask about the ignore reason. The answer is optional but is strongly recommended because it will help to explain your motivation to your сolleagues and to yourself after a few months.

All the data about ignored modules will be stored in .npm-upgrade.json file next to your project's package.json.

ignore command

It will help you manage ignored modules. See Ignoring module section for more details. It has the following subcommands:

npm-upgrade ignore <command>

Commands:
  add [module]        Add module to ignored list
  list                Show the list of ignored modules
  reset [modules...]  Reset ignored modules
  • add - will add a module from your deps to ignored list. You can either provide module name as optional module argument or interactively select it from the list of project's deps.
  • list - will show the list of currently ignored modules along with their ignored versions and reasons.
  • reset - will remove modules from the ignored list. You can either provide module names as modules argument (separated by space) or interactively select them from the list of project's deps.

changelog command

npm-upgrade changelog <moduleName>

Will try to find changelog url for provided module and open it in default browser.

Troubleshooting

Wrong changelog shown for <moduleName> or not shown at all!

Yes, It can happen sometimes. This is because there is no standardized way to specify changelog location for the module, so it tries to guess it, using these rules one by one:

  1. Check db/changelogUrls.json from master branch on GitHub or the local copy if it's unreachable.
  2. Check changelog field from module's package.json.
  3. Parse module's repository.url field and if it's on GitHub, try to request some common changelog files (CHANGELOG.md, History.md etc.) from master branch and if it fails, open Releases page.

So, if it guessed wrong it would be great if you could either fill an issue about this or submit a PR which adds proper changelog URL to db/changelogUrls.json. There is a tool in the repository for you to make it as easy as possible:

./tools/addModuleChangelogUrlToDb.js <moduleName> <changelogUrl>

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].