npm-check-updates 6.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ https://github.com/raineorshine/npm-check-updates/releases
package/README.md CHANGED
@@ -1,12 +1,11 @@
1
- [![npm](https://badge.fury.io/js/npm-check-updates.svg)](http://badge.fury.io/js/npm-check-updates)
2
- [![Build Status](https://travis-ci.org/tjunnone/npm-check-updates.svg?branch=master)](https://travis-ci.org/tjunnone/npm-check-updates)
1
+ # npm-check-updates [![npm version](https://badge.fury.io/js/npm-check-updates.svg)](https://www.npmjs.com/package/npm-check-updates) [![Build Status](https://github.com/raineorshine/npm-check-updates/workflows/Tests/badge.svg?branch=master)](https://github.com/raineorshine/npm-check-updates/actions?query=workflow%3ATests+branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/raineorshine/npm-check-updates/badge.svg?branch=master)](https://coveralls.io/github/raineorshine/npm-check-updates?branch=master)
3
2
 
4
3
  **npm-check-updates upgrades your package.json dependencies to the *latest* versions, ignoring specified versions.**
5
4
 
6
5
  - maintains existing semantic versioning *policies*, i.e. `"express": "^4.0.0"` to `"express": "^5.0.0"`.
7
6
  - *only* modifies package.json file. Run `npm install` to update your installed packages and package-lock.json.
8
7
 
9
- ![npm-check-updates-screenshot](https://github.com/tjunnone/npm-check-updates/blob/master/.github/screenshot.png?raw=true)
8
+ ![npm-check-updates-screenshot](https://github.com/raineorshine/npm-check-updates/blob/master/.github/screenshot.png?raw=true)
10
9
 
11
10
  - Red = major upgrade (and all [major version zero](https://semver.org/#spec-item-4))
12
11
  - Cyan = minor upgrade
@@ -14,18 +13,17 @@
14
13
 
15
14
  You may also want to consider [npm-check](https://github.com/dylang/npm-check). Similar purpose, different features.
16
15
 
17
- Installation
18
- --------------
16
+ ## Installation
19
17
 
20
18
  ```sh
21
19
  npm install -g npm-check-updates
22
20
  ```
23
21
 
24
- Usage
25
- --------------
22
+ ## Usage
23
+
26
24
  Show any new dependencies for the project in the current directory:
27
25
 
28
- ```sh
26
+ ```console
29
27
  $ ncu
30
28
  Checking package.json
31
29
  [====================] 5/5 100%
@@ -43,7 +41,7 @@ Upgrade a project's package file:
43
41
 
44
42
  > **Make sure your package file is in version control and all changes have been committed. This *will* overwrite your package file.**
45
43
 
46
- ```sh
44
+ ```console
47
45
  $ ncu -u
48
46
  Upgrading package.json
49
47
  [====================] 1/1 100%
@@ -58,7 +56,7 @@ $ npm install # update installed packages and package-lock.json
58
56
  Check global packages:
59
57
 
60
58
  ```sh
61
- $ ncu -g # add -u to get a one-line command for upgrading
59
+ ncu -g # add -u to get a one-line command for upgrading
62
60
  ```
63
61
 
64
62
  You can include or exclude specific packages using the `--filter` and `--reject` options. They accept strings, comma-or-space-delimited lists, or regular expressions:
@@ -79,83 +77,83 @@ $ ncu '/^(?!gulp-).*$/' # mac/linux
79
77
  $ ncu "/^(?!gulp-).*$/" # windows
80
78
  ```
81
79
 
82
- Options
83
- --------------
84
-
85
- --concurrency max number of concurrent HTTP requests to npm registry
86
- (default: 8)
87
- --configFilePath rc config file path (default: directory of
88
- `packageFile` or ./ otherwise)
89
- --configFileName rc config file name (default: .ncurc.{json,yml,js}) --cwd Used as current working directory for `spawn` in npm
90
- listing
91
- --dep check only a specific section(s) of dependencies:
92
- prod|dev|peer|optional|bundle (comma-delimited)
93
- --engines-node include only packages that satisfy engines.node as
94
- specified in the package file
95
- -e, --error-level set the error-level. 1: exits with error code 0 if no
96
- errors occur. 2: exits with error code 0 if no
97
- packages need updating (useful for continuous
98
- integration)
99
- -f, --filter include only package names matching the given string,
100
- comma-or-space-delimited list, or /regex/
101
- -g, --global check global packages instead of in the current project
102
- -i, --interactive Enable interactive prompts for each dependency;
103
- Implies -u unless one of the json options are set
104
- -j, --jsonAll output new package file instead of human-readable
105
- message
106
- --jsonDeps returns output like `jsonAll` but only lists
107
- `dependencies`, `devDependencies`, and
108
- `optionalDependencies` of the new package data.
109
- --jsonUpgraded output upgraded dependencies in json
110
- -l, --loglevel what level of logs to report: silent, error, warn,
111
- info, verbose, silly (default: warn)
112
- -m, --minimal do not upgrade to newer versions that are already
113
- satisfied by the existing version range (v2 behavior).
114
- -n, --newest find the newest published versions available instead
115
- of the latest stable versions
116
- -p, --packageManager npm or bower (default: npm)
117
- --packageData include stringified package file (use stdin instead)
118
- --packageFile package file location (default: ./package.json)
119
- --pre include -alpha, -beta, -rc. (default: 0; default
120
- with --newest and --greatest: 1)
121
- --prefix Used as current working directory in bower and npm
122
- -r, --registry specify third-party NPM registry
123
- --removeRange remove version ranges from the final package version
124
- -s, --silent don't output anything (--loglevel silent)
125
- --semverLevel find the highest version within "major" or "minor"
126
- -t, --greatest find the highest versions available instead of the
127
- latest stable versions
128
- --timeout a global timeout in milliseconds. (default: no global
129
- timeout and 30 seconds per npm-registery-fetch)
130
- -u, --upgrade overwrite package file
131
- -v, --version get version
132
- -V get version
133
- -x, --reject exclude packages matching the given string, comma-
134
- delimited list, or regex
135
-
136
- How dependency updates are determined
137
- --------------
138
-
139
- - Direct dependencies will be increased to the latest stable version:
80
+ ## Options
81
+
82
+ ```text
83
+ --concurrency max number of concurrent HTTP requests to npm registry
84
+ (default: 8)
85
+ --configFilePath rc config file path (default: directory of
86
+ `packageFile` or ./ otherwise)
87
+ --configFileName rc config file name (default: .ncurc.{json,yml,js}) --cwd
88
+ Used as current working directory for `spawn` in npm listing
89
+ --dep check only a specific section(s) of dependencies:
90
+ prod|dev|peer|optional|bundle (comma-delimited)
91
+ --engines-node include only packages that satisfy engines.node as
92
+ specified in the package file
93
+ -e, --error-level set the error-level. 1: exits with error code 0 if no
94
+ errors occur. 2: exits with error code 0 if no
95
+ packages need updating (useful for continuous
96
+ integration)
97
+ -f, --filter include only package names matching the given string,
98
+ comma-or-space-delimited list, or /regex/
99
+ -g, --global check global packages instead of in the current project
100
+ -i, --interactive Enable interactive prompts for each dependency;
101
+ Implies -u unless one of the json options are set
102
+ -j, --jsonAll output new package file instead of human-readable
103
+ message
104
+ --jsonDeps returns output like `jsonAll` but only lists
105
+ `dependencies`, `devDependencies`, and
106
+ `optionalDependencies` of the new package data.
107
+ --jsonUpgraded output upgraded dependencies in json
108
+ -l, --loglevel what level of logs to report: silent, error, warn,
109
+ info, verbose, silly (default: warn)
110
+ -m, --minimal do not upgrade to newer versions that are already
111
+ satisfied by the existing version range (v2 behavior).
112
+ -n, --newest find the newest published versions available instead
113
+ of the latest stable versions
114
+ -p, --packageManager npm (default: npm)
115
+ --packageData include stringified package file (use stdin instead)
116
+ --packageFile package file location (default: ./package.json)
117
+ --pre include -alpha, -beta, -rc. (default: 0; default
118
+ with --newest and --greatest: 1)
119
+ --prefix Used as current working directory in npm
120
+ -r, --registry specify third-party NPM registry
121
+ --removeRange remove version ranges from the final package version
122
+ -s, --silent don't output anything (--loglevel silent)
123
+ --semverLevel find the highest version within "major" or "minor"
124
+ -t, --greatest find the highest versions available instead of the
125
+ latest stable versions
126
+ --timeout a global timeout in milliseconds. (default: no global
127
+ timeout and 30 seconds per npm-registery-fetch)
128
+ -u, --upgrade overwrite package file
129
+ -v, --version get version
130
+ -V get version
131
+ -x, --reject exclude packages matching the given string, comma-
132
+ delimited list, or regex
133
+ ```
134
+
135
+ ## How dependency updates are determined
136
+
137
+ - Direct dependencies are updated to the latest stable version:
140
138
  - `2.0.1` → `2.2.0`
141
139
  - `1.2` → `1.3`
142
140
  - `0.1.0` → `1.0.1`
143
- - with `--semverLevel major`
144
- - `0.1.0` → `0.2.1`
145
- - with `--semverLevel minor`
146
- - `0.1.0` → `0.1.2`
147
- - Semantic versioning policies for levels are maintained while satisfying the latest version:
141
+ - Range operators are preserved and the version is updated:
148
142
  - `^1.2.0` → `^2.0.0`
149
143
  - `1.x` → `2.x`
150
- - "Any version" is maintained:
151
- - `*` → `*`
152
- - "Greater than" is maintained:
153
144
  - `>0.2.0` → `>0.3.0`
154
- - Closed ranges are replaced with a wildcard:
145
+ - "Less than" is replaced with a wildcard:
146
+ - `<2.0.0` → `^3.0.0`
155
147
  - `1.0.0 < 2.0.0` → `^3.0.0`
148
+ - "Any version" is preserved:
149
+ - `*` → `*`
150
+ - with `--semverLevel major`, the major version is preserved:
151
+ - `0.1.0` → `0.2.1`
152
+ - with `--semverLevel minor`, the major and minor versions are preserved:
153
+ - `0.1.0` → `0.1.2`
154
+
155
+ ## Configuration Files
156
156
 
157
- Configuration Files
158
- --------------
159
157
  Use a `.ncurc.{json,yml,js}` file to specify configuration information.
160
158
  You can specify file name and path using `--configFileName` and `--configFilePath`
161
159
  command line options.
@@ -173,8 +171,8 @@ For example, `.ncurc.json`:
173
171
  }
174
172
  ```
175
173
 
176
- Module Use
177
- --------------
174
+ ## Module Use
175
+
178
176
  npm-check-updates can be required:
179
177
 
180
178
  ```js
@@ -191,15 +189,12 @@ ncu.run({
191
189
  });
192
190
  ```
193
191
 
194
- Known Issues
195
- --------------
196
-
197
- - Windows: If npm-check-updates hangs, run `ncu --loglevel verbose` to see if it is waiting for stdin. If so, try setting the package file explicitly: `ncu -g --packageFile package.json`. See [#136](https://github.com/tjunnone/npm-check-updates/issues/136#issuecomment-155721102).
192
+ ## Known Issues
198
193
 
199
- Also search the [issues page](https://github.com/tjunnone/npm-check-updates/issues).
194
+ - Windows: If npm-check-updates hangs, run `ncu --loglevel verbose` to see if it is waiting for stdin. If so, try setting the package file explicitly: `ncu -g --packageFile package.json`. See [#136](https://github.com/raineorshine/npm-check-updates/issues/136#issuecomment-155721102).
200
195
 
196
+ Also search the [issues page](https://github.com/raineorshine/npm-check-updates/issues).
201
197
 
202
- Problems?
203
- --------------
198
+ ## Problems?
204
199
 
205
- Please [file an issue](https://github.com/tjunnone/npm-check-updates/issues)! But always [search existing issues](https://github.com/tjunnone/npm-check-updates/issues?utf8=%E2%9C%93&q=is%3Aissue) first!
200
+ Please [file an issue](https://github.com/raineorshine/npm-check-updates/issues)! But always [search existing issues](https://github.com/raineorshine/npm-check-updates/issues?utf8=%E2%9C%93&q=is%3Aissue) first!
package/bin/ncu.js ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict'
4
+
5
+ const program = require('commander')
6
+ const updateNotifier = require('update-notifier')
7
+ const _ = require('lodash')
8
+ const ncu = require('../lib/npm-check-updates')
9
+ const pkg = require('../package.json')
10
+
11
+ // check if a new version of ncu is available and print an update notification
12
+ const notifier = updateNotifier({ pkg })
13
+ if (notifier.update && notifier.update.latest !== pkg.version) {
14
+ notifier.notify({ defer: false, isGlobal: true })
15
+ }
16
+
17
+ program
18
+ .description('[filter] is a list or regex of package names to check (all others will be ignored).')
19
+ .usage('[options] [filter]')
20
+ .version(pkg.version)
21
+ .option('--concurrency <n>', 'max number of concurrent HTTP requests to npm registry.', s => parseInt(s, 10), 8)
22
+ .option('--configFilePath <path>', 'rc config file path (default: directory of `packageFile` or ./ otherwise)')
23
+ .option('--configFileName <path>', 'rc config file name (default: .ncurc.{json,yml,js})')
24
+ .option('--cwd <path>', 'Used as current working directory for `spawn` in npm listing')
25
+ .option('--dep <dep>', 'check only a specific section(s) of dependencies: prod|dev|peer|optional|bundle (comma-delimited)')
26
+ .option('-e, --error-level <n>', 'set the error-level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration).', s => parseInt(s, 10), 1)
27
+ .option('--engines-node', 'upgrade to version which satisfies engines.node range')
28
+ .option('-f, --filter <matches>', 'include only package names matching the given string, comma-or-space-delimited list, or /regex/')
29
+ .option('-g, --global', 'check global packages instead of in the current project')
30
+ // program.json is set to true in programInit if any options that begin with 'json' are true
31
+ .option('-i, --interactive', 'Enable interactive prompts for each dependency; implies -u unless one of the json options are set')
32
+ .option('-j, --jsonAll', 'output new package file instead of human-readable message')
33
+ .option('--jsonDeps', 'Will return output like `jsonAll` but only lists `dependencies`, `devDependencies`, and `optionalDependencies` of the new package data.')
34
+ .option('--jsonUpgraded', 'output upgraded dependencies in json')
35
+ .option('-l, --loglevel <n>', 'what level of logs to report: silent, error, minimal, warn, info, verbose, silly', 'warn')
36
+ .option('-m, --minimal', 'do not upgrade newer versions that are already satisfied by the version range according to semver')
37
+ .option('-n, --newest', 'find the newest versions available instead of the latest stable versions')
38
+ .option('-p, --packageManager <name>', 'npm (default)', 'npm')
39
+ .option('--packageData', 'include stringified package file (use stdin instead)')
40
+ .option('--packageFile <filename>', 'package file location (default: ./package.json)')
41
+ .option('--pre <n>', 'Include -alpha, -beta, -rc. (default: 0; default with --newest and --greatest: 1)')
42
+ .option('--prefix <path>', 'Used as current working directory in npm')
43
+ .option('-r, --registry <url>', 'specify third-party npm registry')
44
+ .option('--removeRange', 'remove version ranges from the final package version')
45
+ .option('-s, --silent', 'don\'t output anything (--loglevel silent)')
46
+ .option('--semverLevel <level>', 'find the highest version within "major" or "minor"')
47
+ .option('-t, --greatest', 'find the highest versions available instead of the latest stable versions')
48
+ .option('--timeout <ms>', 'a global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registery-fetch)')
49
+ .option('-u, --upgrade', 'overwrite package file')
50
+ .option('-x, --reject <matches>', 'exclude packages matching the given string, comma-or-space-delimited list, or /regex/')
51
+
52
+ program.parse(process.argv)
53
+
54
+ const { configFileName, configFilePath, packageFile } = program
55
+
56
+ // load .ncurc
57
+ // NOTE: Do not load .ncurc from project directory when tests are running
58
+ // Can be overridden if configFilePath is set explicitly
59
+ let rcArguments = []
60
+ if (!process.env.NCU_TESTS || configFilePath) {
61
+ const rcConfig = ncu.getNcurc({
62
+ configFileName,
63
+ configFilePath,
64
+ packageFile
65
+ })
66
+ rcArguments = rcConfig ?
67
+ _.flatten(_.map(rcConfig, (value, name) =>
68
+ value === true ? [`--${name}`] : [`--${name}`, value]
69
+ )) : []
70
+
71
+ }
72
+ const combinedArguments = process.argv.slice(0, 2).concat(rcArguments, process.argv.slice(2))
73
+
74
+ program.parse(combinedArguments)
75
+
76
+ program.cli = true
77
+ program.filter = program.args.join(' ') || program.filter
78
+
79
+ ncu.run(program)
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict'
4
+
5
+ require('./ncu')
@@ -89,7 +89,7 @@ declare namespace ncu {
89
89
  newest?: boolean;
90
90
 
91
91
  /**
92
- * npm (default) or bower
92
+ * npm (default)
93
93
  */
94
94
  packageManager?: string;
95
95
 
@@ -110,7 +110,7 @@ declare namespace ncu {
110
110
  pre?: boolean;
111
111
 
112
112
  /**
113
- * Used as current working directory in bower and npm
113
+ * Used as current working directory in npm
114
114
  */
115
115
  prefix?: string;
116
116
 
@@ -151,9 +151,9 @@ declare namespace ncu {
151
151
  upgrade?: boolean;
152
152
  }
153
153
 
154
- type RunResults = Record<string, string>;
154
+ type RunResults = Record<string, string>
155
155
 
156
- function run(options?: RunOptions): Promise<RunResults>;
156
+ function run(options?: RunOptions): Promise<RunResults>
157
157
  }
158
158
 
159
- export = ncu;
159
+ export = ncu