4.0.34 • Published 3 months ago

npm-update-package v4.0.34

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

npm version build lint test

npm-update-package

CLI tool for creating pull requests to update npm packages

Table of Contents

Requirements

  • Node.js v20 or later
  • npm or Yarn
  • Git

Supported platforms

  • GitHub
  • GitHub Enterprise

Usage

The simplest use of npm-update-package is just run the following command:

npx npm-update-package --github-token <github-token>

Alternatively, you can use a specific version as follows:

npx npm-update-package@4 --github-token <github-token>

Options

You can customize behavior via CLI options.
Some options can embed variables like {{packageName}}(HTML-escaped) or {{{packageName}}}(not HTML-escaped).

--additional-labels

Labels other than npm-update-package to add to pull request.

NameValue
typestring[]
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --additional-labels bot dependencies

--assignees

User names to assign to pull request.

NameValue
typestring[]
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --assignees alice bob

--assignees-sample-size

How many members to be assigned to assignees.

NameValue
typenumber
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --assignees alice bob \
  --assignees-sample-size 1

--commit-message

Commit message template.

NameValue
typestring
required
defaultchore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}

Available variables:

VariableDescription
currentVersionCurrent package version
newVersionNew package version
packageNamePackage name
levelSemver level (major/minor/patch)
dependencyTypeDependency type (dependencies/devDependencies/peerDependencies/bundledDependencies/optionalDependencies)

Example:

npx npm-update-package \
  --github-token <github-token> \
  --commit-message "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"

--dependency-types

Dependency types to be updated.

NameValue
typestring[]
required
defaultdependencies, devDependencies, peerDependencies, bundledDependencies, optionalDependencies

Allowed values:

ValueDescription
dependenciesdependencies
devDependenciesdevDependencies
peerDependenciespeerDependencies
bundledDependenciesbundledDependencies
optionalDependenciesoptionalDependencies

Example:

npx npm-update-package \
  --github-token <github-token> \
  --dependency-types dependencies devDependencies

--draft-pr

Whether to create pull request as draft.

NameValue
typeboolean
required
defaultfalse

Example:

npx npm-update-package \
  --github-token <github-token> \
  --draft-pr true

--fetch-interval

Sleep time between fetching (ms).

NameValue
typenumber
required
default1000

Example:

npx npm-update-package \
  --github-token <github-token> \
  --fetch-interval 2000

--fetch-release-notes

Whether to fetch release notes.

NameValue
typeboolean
required
defaulttrue

Example:

npx npm-update-package \
  --github-token <github-token> \
  --fetch-release-notes false

--git-user-email

Git user email.

NameValue
typestring
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --git-user-email alice@example.com

--git-user-name

Git user name.

NameValue
typestring
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --git-user-name alice

--github-token

GitHub token.

NameValue
typestring
required

--ignore-packages

Package names to ignore.

NameValue
typestring[]
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --ignore-packages @types/jest jest

--log-level

Log level to show.

NameValue
typestring
required
defaultinfo

Allowed values:

ValueDescription
offDo not output any logs.
fatalOutput fatal logs.
errorOutput fatal/error logs.
warnOutput fatal/error/warn logs.
infoOutput fatal/error/warn/info logs.
debugOutput fatal/error/warn/info/debug logs.
traceOutput fatal/error/warn/info/debug/trace logs.

Example:

npx npm-update-package \
  --github-token <github-token> \
  --log-level debug

--outdated-pr-strategy

What to do when outdated pull requests exist.

NameValue
typestring
required
defaultrecreate

Allowed values:

ValueDescription
createCreate new pull request.
recreateClose outdated pull requests and create new pull request.
skipSkip creating pull request.

Example:

npx npm-update-package \
  --github-token <github-token> \
  --outdated-pr-strategy create

--package-manager

Package manager of your project.
Since npm-update-package automatically determines which package manager to use, it is usually not necessary to use this option.

NameValue
typestring
required

Allowed values:

ValueDescription
npmUse npm
yarnUse Yarn

Example:

npx npm-update-package \
  --github-token <github-token> \
  --package-manager yarn

--pr-body-github-host

GitHub host of pull request body.

NameValue
typestring
required
defaulttogithub.com

Example:

npx npm-update-package \
  --github-token <github-token> \
  --pr-body-github-host "github.example"

--pr-body-notes

Additional notes for Pull request body.

NameValue
typestring
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --pr-body-notes "**:warning: Please see diff and release notes before merging.**"

--pr-title

Pull request title template.

NameValue
typestring
required
defaultchore(deps): {{{level}}} update {{{packageName}}} to v{{{newVersion}}}

Available variables:

VariableDescription
currentVersionCurrent package version
newVersionNew package version
packageNamePackage name
levelSemver level (major/minor/patch)
dependencyTypeDependency type (dependencies/devDependencies/peerDependencies/bundledDependencies/optionalDependencies)

Example:

npx npm-update-package \
  --github-token <github-token> \
  --pr-title "chore({{{dependencyType}}}): {{{level}}} update {{{packageName}}} from {{{currentVersion}}} to v{{{newVersion}}}"

--reviewers

User names to request reviews.

NameValue
typestring[]
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --reviewers alice bob

--reviewers-sample-size

How many members to be assigned to reviewers.

NameValue
typenumber
required

Example:

npx npm-update-package \
  --github-token <github-token> \
  --reviewers alice bob \
  --reviewers-sample-size 1

GitHub token

GitHub token is required to run npm-update-package.
Available tokens and permissions required for each token are as follows.

Features of each token are as follows.

GitHub ActionsGitHub AppPersonal access token
Owner of tokenGitHuborganization or useruser
Author of pull requestsgithub-actionsappuser
Trigger other actions-

We recommend using GitHub App for the following reasons.

  • When you use the token of GitHub Actions, the job will not trigger other actions.
  • Personal access token relies on personal account.
  • When you use the Personal access token, the author of pull requests will be the user who issued the token.

How to run on GitHub Actions

Use token of GitHub Actions

name: npm-update-package
on:
  schedule:
    - cron: '0 0 * * *'
jobs:
  npm-update-package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - run: |
          npx npm-update-package \
            --github-token $GITHUB_TOKEN \
            --git-user-name $GIT_USER_NAME \
            --git-user-email $GIT_USER_EMAIL
        env:
          GIT_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
          GIT_USER_NAME: github-actions[bot]
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Use token of GitHub App

name: npm-update-package
on:
  schedule:
    - cron: '0 0 * * *'
jobs:
  npm-update-package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - name: Generate token
        id: generate_token
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.APP_ID }}
          private_key: ${{ secrets.PRIVATE_KEY }}
      - run: |
          npx npm-update-package \
            --github-token $GITHUB_TOKEN \
            --git-user-name $GIT_USER_NAME \
            --git-user-email $GIT_USER_EMAIL
        env:
          # TODO: Replace with your GitHub App's email
          GIT_USER_EMAIL: 97396142+npm-update-package[bot]@users.noreply.github.com
          # TODO: Replace with your GitHub App's user name
          GIT_USER_NAME: npm-update-package[bot]
          GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

Use Personal access token

name: npm-update-package
on:
  schedule:
    - cron: '0 0 * * *'
jobs:
  npm-update-package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
      - run: |
          npx npm-update-package \
            --github-token $GITHUB_TOKEN \
            --git-user-name $GIT_USER_NAME \
            --git-user-email $GIT_USER_EMAIL
        env:
          # TODO: Replace with your email
          GIT_USER_EMAIL: 97961304+npm-update-package-bot@users.noreply.github.com
          # TODO: Replace with your name
          GIT_USER_NAME: npm-update-package-bot
          GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

Architecture

The following shows the process flow of npm-update-package.

npm.io

FAQ

What is the purpose of npm-update-package?

npm-update-package can be used in environments where Renovate cannot be used for some reason.

What should I do if conflicts occurred in the pull request?

If you have difficulty resolving it manually, close the pull request and run npm-update-package again.

How to development

See Wiki.

4.0.30

7 months ago

4.0.32

5 months ago

4.0.31

6 months ago

4.0.34

3 months ago

4.0.33

4 months ago

4.0.29

9 months ago

4.0.28

9 months ago

4.0.10-alpha.3

1 year ago

4.0.10-alpha.2

1 year ago

4.0.10-alpha.5

1 year ago

4.0.10-alpha.4

1 year ago

4.0.9

1 year ago

4.0.8

1 year ago

4.0.10-alpha.1

1 year ago

4.0.10-alpha.0

1 year ago

4.0.10-alpha.7

1 year ago

4.0.10-alpha.6

1 year ago

4.0.10-alpha.8

1 year ago

4.0.19

12 months ago

4.0.21

12 months ago

4.0.20

12 months ago

4.0.27

10 months ago

4.0.26

11 months ago

4.0.23

11 months ago

4.0.22

11 months ago

4.0.25

11 months ago

4.0.24

11 months ago

4.0.10

1 year ago

4.0.16

1 year ago

4.0.15

1 year ago

4.0.18

12 months ago

4.0.17

1 year ago

4.0.12

1 year ago

4.0.11

1 year ago

4.0.14

1 year ago

4.0.13

1 year ago

4.0.5

1 year ago

4.0.4

1 year ago

4.0.7

1 year ago

4.0.6

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.0-0

1 year ago

4.0.0-1

1 year ago

4.0.0-2

1 year ago

3.0.22

1 year ago

3.0.21

1 year ago

3.0.20

1 year ago

3.0.18

1 year ago

3.0.19

1 year ago

3.0.17

1 year ago

3.0.16

1 year ago

3.0.15

1 year ago

3.0.14

1 year ago

3.0.13

2 years ago

3.0.12

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.9

2 years ago

3.0.10

2 years ago

3.0.11

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.5.23

2 years ago

1.5.22

2 years ago

1.5.24

2 years ago

1.5.12

2 years ago

1.5.14

2 years ago

1.5.13

2 years ago

1.5.16

2 years ago

1.5.15

2 years ago

1.5.18

2 years ago

1.5.17

2 years ago

1.5.19

2 years ago

1.5.21

2 years ago

1.5.20

2 years ago

1.4.20

3 years ago

1.4.22

3 years ago

1.4.21

3 years ago

1.4.24

3 years ago

1.4.23

3 years ago

1.4.26

3 years ago

1.4.25

3 years ago

1.4.28

3 years ago

1.4.27

3 years ago

1.4.29

3 years ago

1.4.31

3 years ago

1.4.30

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.13

3 years ago

1.4.15

3 years ago

1.4.14

3 years ago

1.4.17

3 years ago

1.4.16

3 years ago

1.4.19

3 years ago

1.4.18

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.10

2 years ago

1.5.11

2 years ago

1.4.11

3 years ago

1.4.10

3 years ago

1.4.12

3 years ago

1.4.6

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.2.0

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.12

3 years ago

1.2.13

3 years ago

1.2.10

3 years ago

1.2.11

3 years ago

1.2.16

3 years ago

1.2.17

3 years ago

1.2.14

3 years ago

1.2.15

3 years ago

1.1.0

3 years ago

1.2.9

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.18

3 years ago

1.2.19

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.20

3 years ago

1.2.23

3 years ago

1.2.24

3 years ago

1.2.21

3 years ago

1.2.22

3 years ago

1.2.25

3 years ago

1.2.26

3 years ago

0.59.0

3 years ago

0.58.10

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.58.9

3 years ago

0.58.8

3 years ago

0.45.10

3 years ago

0.45.11

3 years ago

0.45.12

3 years ago

0.45.13

3 years ago

0.45.14

3 years ago

0.45.15

3 years ago

0.45.16

3 years ago

0.55.0

3 years ago

0.51.0

3 years ago

0.48.2

3 years ago

0.48.3

3 years ago

0.48.0

3 years ago

0.48.1

3 years ago

0.44.0

3 years ago

0.48.4

3 years ago

0.56.0

3 years ago

0.52.1

3 years ago

0.52.0

3 years ago

0.49.1

3 years ago

0.45.5

3 years ago

0.45.6

3 years ago

0.45.3

3 years ago

0.49.0

3 years ago

0.45.4

3 years ago

0.45.1

3 years ago

0.45.2

3 years ago

0.45.0

3 years ago

0.45.9

3 years ago

0.45.7

3 years ago

0.45.8

3 years ago

0.57.0

3 years ago

0.53.0

3 years ago

0.53.1

3 years ago

0.46.4

3 years ago

0.46.5

3 years ago

0.46.2

3 years ago

0.46.3

3 years ago

0.46.0

3 years ago

0.46.1

3 years ago

0.46.6

3 years ago

0.46.7

3 years ago

0.58.3

3 years ago

0.58.4

3 years ago

0.58.1

3 years ago

0.58.2

3 years ago

0.58.0

3 years ago

0.58.7

3 years ago

0.58.5

3 years ago

0.58.6

3 years ago

0.54.0

3 years ago

0.50.0

3 years ago

0.43.5

3 years ago

0.43.6

3 years ago

0.47.0

3 years ago

0.43.4

3 years ago

0.41.1

3 years ago

0.43.0

3 years ago

0.41.2

3 years ago

0.41.0

3 years ago

0.38.0

3 years ago

0.42.0

3 years ago

0.40.0

3 years ago

0.39.0

3 years ago

0.43.3

3 years ago

0.43.1

3 years ago

0.41.3

3 years ago

0.43.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.0

3 years ago

0.17.2

3 years ago

0.19.1

3 years ago

0.19.2

3 years ago

0.36.0

3 years ago

0.34.0

3 years ago

0.11.0

4 years ago

0.11.1

4 years ago

0.13.0

4 years ago

0.11.2

4 years ago

0.15.0

3 years ago

0.17.0

3 years ago

0.17.1

3 years ago

0.32.0

3 years ago

0.30.0

3 years ago

0.29.0

3 years ago

0.27.0

3 years ago

0.25.0

3 years ago

0.23.2

3 years ago

0.23.1

3 years ago

0.23.0

3 years ago

0.9.1

4 years ago

0.21.0

3 years ago

0.37.0

3 years ago

0.31.5

3 years ago

0.35.0

3 years ago

0.31.4

3 years ago

0.31.3

3 years ago

0.33.0

3 years ago

0.31.2

3 years ago

0.12.0

4 years ago

0.14.0

4 years ago

0.16.0

3 years ago

0.16.1

3 years ago

0.18.0

3 years ago

0.16.2

3 years ago

0.10.0

4 years ago

0.31.1

3 years ago

0.31.0

3 years ago

0.28.1

3 years ago

0.28.0

3 years ago

0.26.1

3 years ago

0.24.3

3 years ago

0.26.0

3 years ago

0.24.2

3 years ago

0.22.4

3 years ago

0.24.1

3 years ago

0.22.3

3 years ago

0.24.0

3 years ago

0.22.2

3 years ago

0.22.1

3 years ago

0.22.0

3 years ago

0.28.3

3 years ago

0.28.2

3 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago