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

packages-update

v2.0.0

Published

📦 A flexible and lightweight updater for packages

Downloads

320

Readme

Why

Allows you to update, customize according to your needs and easily automate mono repositories.

I plan to expand this project into an GitHub Actions project in the future. You can see a prototype here.

Some features

  • [x] CLI and API (in-code) usage
  • [x] Custom rules per dependency
  • [x] Global and custom rules per dependency for mono repositories
  • [x] Filter and exclude dependencies
  • [x] Zero configurations (unless you want to)
  • [x] Custom package.json and configuration files
  • [x] Dynamic update according to version operator prefixer per dependency

And much more.


Table of Contents


Install

Install Size

npm i -D packages-update

Usage

CLI

npx pu

You can use latest, minor, patch or major as the last CLI parameter.

API (in-code)

import { pu } from 'packages-update';

await pu();

You can also use all available options:

await pu({
  target: 'latest',
});

Aliases

npx pu
npx packages-update

Configs

You can customize the global settings by creating a .purc.json config file.

  • CLI and API (in-code) options will overwrite the global options.

| Option | CLI | Description | Default Value | | ------------ | --------------- | ------------------------------------------------------------------------ | ---------------------- | | packageFile | --package-file | Relative path to package.json file | "./package.json" | | followPrefix | --follow-prefix | Update dependencies respecting version prefixes | false | | target | --target | Type of update strategy (e.g., latest, major, minor and patch) | "latest" | | filter | --filter | Filter the specified dependencies to include in the update | [] | | exclude | --exclude | Exclude the specified dependencies to exclude from the update | [] | | peer | --peer | Update peer dependencies | false | | indentation | --indentation | JSON indentation level | 2 | | registry | --registry | Specify the registry URL | "registry.npmjs.org" | | quiet | --quiet | Suppress output messages | false | | checkOnly | --check-only | Perform checks without applying updates | false | | configFile | --config-file | Custom config path | "./.purc.json" | | overrides | | Override update strategy for specific packages | |


packageFile

CLI
npx pu --package-file="./custom/package.json"
.purc.json and API (in-code)
{
  "packageFile": "./custom/package.json"
}

followPrefix

CLI
npx pu --follow-prefix
.purc.json and API (in-code)
{
  "followPrefix": true
}

filter

CLI
npx pu --filter=react,vue
.purc.json and API (in-code)
{
  "filter": ["react", "vue"]
}

exclude

CLI
npx pu --exclude=react,vue
.purc.json and API (in-code)
{
  "exclude": ["react", "vue"]
}

peer

CLI
npx pu --peer
.purc.json and API (in-code)
{
  "peer": true
}

indentation

CLI
npx pu --indentation=4
.purc.json and API (in-code)
{
  "indentation": 4
}

registry

https only.

CLI
npx pu --registry="registry.custom.org"
.purc.json and API (in-code)
{
  "registry": "registry.custom.org"
}

quiet

CLI
npx pu --quiet
.purc.json and API (in-code)
{
  "quiet": true
}

checkOnly

CLI
npx pu --check-only
.purc.json and API (in-code)
{
  "checkOnly": true
}

configFile

Not available in the configuration file itself.

CLI
npx pu --config-file=./custom/.purc.json
API (in-code)
await pu({
  configFile: './custom/.purc.json';
})

overrides

Not available for CLI.

.purc.json and API (in-code)
{
  "overrides": {
    "eslint": {
      "target": "minor"
    },
    "custom-package": {
      "registry": "custom.registry.org"
    }
  }
}

Examples

Update to latest version

Get the default latest version for each package.

npx pu
npx pu latest
npx pu --target=latest  # alt.
# prettier: ^1.4.2 ➜ ^2.8.1
# ...

Update to latest minor version

Get the latest minor version for each package.

npx pu minor
npx pu --target=minor  # alt.
# prettier: ^1.4.2 ➜ ^1.19.1
# ...

Update to latest patch version

Get the latest patch version for each package.

npx pu patch
npx pu --target=patch  # alt.
# prettier: ^1.4.2 ➜ ^1.4.4
# ...

Update to greatest version

Get the highest version for each package, even if it is not the default latest.

npx pu major
npx pu --target=major  # alt.
# prettier: ^1.4.2 ➜ ^2.8.1
# ...

Limitations

  • After updating package.json, run npm i, yarn install, pnpm install or bun install to install new versions.
  • This updater looks the package.json for devDependencies, dependencies and (if configured) peerDependencies.
  • This updater doesn't search or update for tag and local versions (alpha, beta, rc, etc.).

Acknowledgements

Contributors