npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@modernpoacher/deps

v2.0.31

Published

Update NPM package dependencies from the command line

Downloads

55

Readme

@modernpoacher/deps

Deps updates your package.json dependencies to their latest version.

Deps updates both dependencies and devDependencies by default. You can choose to update only production or development dependencies.

Where a dependency has an exact version, Deps does not update that dependency by default. Deps can be configured to update to an exact version or to latest as an exact version.

Installing Deps

Globally:

npm i -g @modernpoacher/deps

To your project:

npm i -D @modernpoacher/deps

Using Deps

When installed globally, change into the root directory of the package you want to update and execute the command:

deps

When installed locally, or not installed, use npx:

npx @modernpoacher/deps

Alternatively, use npm with a script target in your project's package.json:

{
  "scripts": {
    "deps": "deps"
  }
}

Then:

npm run deps

Updating only production dependencies

To update only production dependencies (on the dependencies field):

deps --save-prod # or -P

Or:

npx @modernpoacher/deps --save-prod # or -P

Or:

npm run deps -- --save-prod # or -P

Updating only development dependencies

To update only development dependencies (dependencies on the devDependencies field):

deps --save-dev # or -D

Or:

npx @modernpoacher/deps --save-dev # or -D

Or:

npm run deps -- --save-dev # or -D

Using .depsrc

To configure Deps create a file named .depsrc in the root directory of the package you want to update.

It should contain JSON and be structured as package.json:

{
  "dependencies": {
    "express": "5.0.0-alpha.8"
  },
  "devDependencies": {
    "gulp": "latest"
  }
}

Author

Add an author field to .depsrc:

{
  "author": "Jonathan Perry <[email protected]>"
}

Ignore

Instruct Deps not to update your package with an ignore field in .depsrc:

{
  "ignore": true
}

Without a .depsrc configuration file, whenever Deps encounters an exact version, it will assume that an exact version should not be updated.

The .depsrc configuration file enables this behaviour to be changed.

In the example above, the dependencies field defines express with an exact version while devDependencies defines gulp with latest.

Configuration with an exact version number

With the .depsrc configuration file as the example above:

  • If package.json defines express at version 5.0.0-alpha.7 then Deps will upgrade to 5.0.0-alpha.8
  • If package.json defines 5.0.0-alpha.8 then Deps will not update the version at all (in which case, the entry in .depsrc is meaningless and can be deleted)
  • If package.json defines 5.0.0-alpha.9 then Deps will downgrade to 5.0.0-alpha.8. (If the entry in .depsrc is out of date, change the entry, or delete it)

Deps only refers to the .depsrc configuration file when it encounters an exact version in package.json. If there is no entry for that dependency in the .depsrc configuration file then Deps will not upgrade, downgrade or otherwise modify it.

You need not duplicate an exact version in .depsrc. (Let package.json be the source of truth.)

Typically, an entry in the .depsrc configuration file will contain latest.

Configuration with latest

Again, with the .depsrc configuration file as the example above:

  • If package.json defines gulp at version 4.0.2 then Deps will update to the latest version

Deps with the shell

deps \
  --save-prod \ # Boolean
  --save-dev \ # Boolean
  --save-optional \ # Boolean
  --save-bundle \ # Boolean
  --registry '<REGISTRY>' \
  --force # Boolean

deps-execute \
  --path '<PATH>' \
  --from '<FROM>' \
  --only '<ONLY>' \
  --registry '<REGISTRY>' \
  --force \ # Boolean
  --message '<MESSAGE>' \
  --author '<AUTHOR>'

deps-install \
  --prod \ # Boolean
  --dev \ # Boolean
  --optional \ # Boolean
  --bundle \ # Boolean
  --peer \ # Boolean
  --save \ # Boolean
  --registry '<REGISTRY>' \
  --force # Boolean

deps-deps \
  --path . \
  --from . \
  --only .

deps-wipe --path .
deps-push --path .
deps-head --path .

Deps with its own script targets

npm run deps -- \
  --save-prod \ # Boolean
  --save-dev \ # Boolean
  --save-optional \ # Boolean
  --save-bundle \ # Boolean
  --registry '<REGISTRY>' \
  --force # Boolean

npm run deps-execute -- \
  --path '<PATH>' \
  --from '<FROM>' \
  --only '<ONLY>' \
  --registry '<REGISTRY>' \
  --force \ # Boolean
  --message '<MESSAGE>' \
  --author '<AUTHOR>'

npm run deps-install -- \
  --prod \ # Boolean
  --dev \ # Boolean
  --optional \ # Boolean
  --bundle \ # Boolean
  --peer \ # Boolean
  --save \ # Boolean
  --registry '<REGISTRY>' \
  --force # Boolean

npm run deps-deps -- \
  --path . \
  --from . \
  --only .

npm run deps-wipe -- --path .
npm run deps-push -- --path .
npm run deps-head -- --path .