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

@coorpacademy/update-node

v7.2.0

Published

Update your node dependencies while you sleep

Downloads

4,189

Readme

Update node :outbox_tray:

Npm version Build Status Github Actions Status codecov

Options :gear:

$ update-node [command]

Commands:
  update-node bump-dependencies  Upgrades defined dependencies and open Pull
                                 request for them            [aliases: upgrade, bd]
  update-node auto-bump          Auto Bump package version   [aliases: version, ab]
  update-node validate           Validate a update-node configuration
                                                                   [aliases: check]
  update-node setup              Scaffold a update-node configuration
                                                                [aliases: scaffold]

Options:
      --version                        Show version number             [boolean]
  -l, --local                          Run in local mode with github publication
                                                                       [boolean]
  -v, --verbose                        More log outputs                [boolean]
  -t, --token                          Token to authentificate to github[string]
  -a, --autoToken, --at, --auto-token  Get authentificated github token from gh
                                       cli                             [boolean]
  -A, --auto                           Select automatically behavior to adopt
                                       based on current commit and branch
                                                                       [boolean]
  -F, --folder                         Run in a specific folder         [string]
  -s, --scope                          Apply to a scope of the repository
                                       (impact on title and branch name)[string]
  -C, --config                         Override update-node configuration
                                       default path                     [string]
  -d, --default-config, --default      Override update-node configuration
                                       default path                    [boolean]
  -c, --clean                          Run on a clean state            [boolean]
      --sync-lock                      Run npm install or yarn after patching
                                       package.json (default, disable with
                                       --no-sync-lock) [boolean] [default: true]
  -b, --pre-commit-bump-command        Command to run before to commit (changes
                                       will be commited)                 [array]
  -p, --pre-clean-command              Run before to clean state         [array]
  -P, --post-clean-command             Run on a clean state              [array]
  -f, --force                          Git Push with force changes
                                       (--force-with-lease is used by default)
                                                                       [boolean]
  -h, --help                           Show help                       [boolean]

Upgrade related options:
  -T, --target                           Node version to target         [string]
      --ignoreDependencies, --only-node  Ignore depencies              [boolean]
      --lerna                            Consider as learna monorepo (only
                                         applies for node bump)        [boolean]
  -m, --message                          Optional extra message to attach to the
                                         commit and pull request        [string]
  -r, --reviewers                        Extra reviewers to add to the pull
                                         request                        [string]
  -R, --teamReviewers                    Extra team reviewers to add to the pull
                                         request                        [string]
      --exact                            Keep exact version in engine version
                                                      [boolean] [default: false]
      --loose                            For loose version for nodes version.
                                         This will replace exisiting range
                                         constraint (^, ~ or none).
                                         Use --no-loose to disable or place
                                         loose: false in config in the node
                                         section)      [boolean] [default: true]

Examples
    update-node --token=TKN

    update-node -t TKN --config .my-update-node-config.json

Configuration

Configuration goes in a .update-node.json at the top level of your repository.

Base Configuration

Here are the main configuration items:

  • repoSlug: the github account + repo name
  • reviewers, teamReviewers: array of reviewers or team reviewers, default []
  • baseBranch: the branch to target, default master
  • label: the tabel to attach to the update Pull request (default Upgrades :outbox_tray:)
  • packageManager: the package manager to use (default npm unless a yarn.lock)

Three more complex items to configure the node bump logic, dependencies bump logic auto-bump, and the PR updates dependencies, see below in the sections below.

Auto-Bump

You can configure the ability to make a new version with the top level auto-bump key.

If you want the new package version to be publiished, just the the publish subproperty to true. (Default command npm publish, repleaceable with publish-command)

The default mecanism to select which semver level is based on a keyword mechanism. major, minor, patch that are provided to npm version. noop is also used to prevent a new version to be made.

For the bump, default keywords are the following

  • major: #major
  • minor: #noop #noRelease (was an accepted _ or - between no and release)
  • patch: #patch, #bug, #fix, #tweak, #updates
  • noop: #minor

Order of preference is noop, major, parch, minor. If none match, the latest is selected. By default minor

You can either add your custom keywords with custom-keywords or replace default with yours using keywords. Both of them accept an object {[priority]: [keywordOrList]}. (if you have only one keyword pattern for one given semver level, you can just provide it as a string)/

Pattern matching is insensitive.

You can also provide minimatch glob patterns as value.

If ever you want a custom, external selection mecanism just put your command in the release-type-command property.

node

This property helps to configure the files that are related to a node version, and that you wish to be updated when trying the bump the node version.

Here is the list of config properties:

  • branch: the branch prefix for the node updates to be perform
  • nvrmc: should a .nvmrc file be udpated (default true), can be an array of files
  • dockerfile: should a Dockerfile be udpated (default false), can be an array of files
  • travis: should a .travis.yml be udpated (default false), can be an array of files
  • package: should package engine in package.json be updated (default false), can be an array of files

Dependencies Updates

The dependencies item is here to define the set of dependencies clusters you want to upgrade. A cluster config have the following properties:

  • name: The name of the cluster
  • message: The name of the commit, and the Pull Request
  • branch: The branch to use to open the pull request
  • dependencies: The (production) dependencies to be updated.
  • devDependencies: The dev dependencies to be updated.

The dependecies can either be a full match, or a glob using minimatch. For instance eslint, eslint-plugin-* @babel/*

Example:

Here is the config of the repo itself:

{
  "repoSlug": "Coorpacademy/update-node",
  "baseBranch": "master",
  "packageManager": "npm",
  "reviewers": [],
  "teamReviewers": [
    "env:TEAM_REVIEWERS"
  ],
  "label": "Upgrades :outbox_tray:",
  "auto-bump": {
    "publish": true,
    "keywords": {
      "noop": ["#noop", "Update *#*"],
      "major": "#major",
      "minor": true,
      "patch": ["#bug", "#tweak", "plugging", "#updates"]
    }
  },
  "node": false,
  "dependencies": [
    {
      "name": "core",
      "message": "Update core dependencies",
      "branch": "update-core",
      "dependencies": [
        "bluebird",
        "yaml",
        "lodash",
        "minimatch",
        "yargs",
        "protocall",
        "request",
        "semver",
        "shelljs"
      ]
    },
    {
      "name": "testing-tools",
      "message": "Update Testing dependencies",
      "devDependencies": [
        "ava",
        "istanbul",
        "codecov",
        "nyc"
      ]
    },
    {
      "name": "eslint",
      "message": "Update eslint",
      "devDependencies": [
        "eslint",
        "@coorpacademy/eslint-plugin-coorpacademy"
      ]
    }
  ]
}

You can also check the validation schema or test sample