npm-check-updates 사용법

서해빈·2021년 4월 6일
4

Javascript

목록 보기
3/11

npm update 명령어로는 package.json의 dependencies의 한도 내에만 update가 수행된다.
의존성이 훼손되지 않는 선에서 최신 버전으로 업데이트를 하고 싶다면 npm-check-updates를 사용하면 된다.

npm-check-updates

npm-check-updates는 package.json의 dependencies와 devDependencies에 기록되어있는 패키지들을
현재기준 최신버전으로 업데이트 시켜준다.

Installation

$ npm install -g npm-check-updates

Usage

$ ncu
Checking package.json
[====================] 5/5 100%

 express           4.12.x  →   4.13.x
 multer            ^0.1.8  →   ^1.0.1
 react-bootstrap  ^0.22.6  →  ^0.24.0
 react-a11y        ^0.1.1  →   ^0.2.6
 webpack          ~1.9.10  →  ~1.10.5

Run ncu -u to upgrade package.json

Upgrade a project's package file

$ ncu -u
Upgrading package.json
[====================] 1/1 100%

 express           4.12.x  →   4.13.x

Run npm install to install new versions.

$ npm install      # update installed packages and package-lock.json

How dependency updates are determined

Direct dependencies are updated to the latest stable version:

  • 2.0.1 → 2.2.0
  • 1.2 → 1.3
  • 0.1.0 → 1.0.1

Range operators are preserved and the version is updated:

  • ^1.2.0 → ^2.0.0
  • 1.x → 2.x
  • >0.2.0 → >0.3.0

"Less than" is replaced with a wildcard:

  • <2.0.0 → ^3.0.0
  • 1.0.0 < 2.0.0 → ^3.0.0

"Any version" is preserved:

  • * → *

Prerelease and deprecated versions are ignored by default.

  • Use --pre to include prerelease versions (e.g. alpha, beta, build1235)
  • Use --deprecated to include deprecated versions

With --target minor, only update patch and minor:

  • 0.1.0 → 0.2.1

With --target patch, only update patch:

  • 0.1.0 → 0.1.2

출처 및 참고

npm 홈페이지 - 바로가기

0개의 댓글