npm-check-updates 16.4.2 → 16.5.0

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.
Files changed (83) hide show
  1. package/README.md +229 -38
  2. package/build/em/src/@types/IndexType.d.ts +5 -0
  3. package/build/em/src/@types/IndexType.js +3 -0
  4. package/build/em/src/@types/IndexType.js.map +1 -0
  5. package/build/em/src/util/keyValueBy.d.ts +5 -0
  6. package/build/em/src/util/keyValueBy.js +18 -0
  7. package/build/em/src/util/keyValueBy.js.map +1 -0
  8. package/build/npm-check-updates/src/bin/cli.d.ts +2 -0
  9. package/build/npm-check-updates/src/index.d.ts +17 -0
  10. package/build/npm-check-updates/src/lib/doctor.d.ts +8 -0
  11. package/build/npm-check-updates/src/lib/getIgnoredUpgrades.d.ts +8 -0
  12. package/build/npm-check-updates/src/lib/getInstalledPackages.d.ts +12 -0
  13. package/build/npm-check-updates/src/lib/getPackageManager.d.ts +12 -0
  14. package/build/npm-check-updates/src/lib/getPeerDependenciesFromRegistry.d.ts +12 -0
  15. package/build/npm-check-updates/src/lib/queryVersions.d.ts +13 -0
  16. package/build/npm-check-updates/src/lib/runGlobal.d.ts +5 -0
  17. package/build/npm-check-updates/src/lib/runLocal.d.ts +18 -0
  18. package/build/npm-check-updates/src/lib/upgradePackageDefinitions.d.ts +13 -0
  19. package/build/npm-check-updates/src/package-managers/index.d.ts +4 -0
  20. package/build/npm-check-updates/src/package-managers/npm.d.ts +133 -0
  21. package/build/npm-check-updates/src/package-managers/npm.js +554 -0
  22. package/build/npm-check-updates/src/package-managers/npm.js.map +1 -0
  23. package/build/npm-check-updates/src/package-managers/yarn.d.ts +105 -0
  24. package/build/package.json +7 -7
  25. package/build/src/bin/cli.js +25 -15
  26. package/build/src/bin/cli.js.map +1 -1
  27. package/build/src/cli-options.d.ts +2 -0
  28. package/build/src/cli-options.js +106 -74
  29. package/build/src/cli-options.js.map +1 -1
  30. package/build/src/index.js +1 -1
  31. package/build/src/index.js.map +1 -1
  32. package/build/src/lib/chalk.d.ts +2 -2
  33. package/build/src/lib/chalk.js +5 -2
  34. package/build/src/lib/chalk.js.map +1 -1
  35. package/build/src/lib/doctor.d.ts +1 -1
  36. package/build/src/lib/doctor.js +31 -14
  37. package/build/src/lib/doctor.js.map +1 -1
  38. package/build/src/lib/keyValueBy.d.ts +1 -1
  39. package/build/src/lib/keyValueBy.js.map +1 -1
  40. package/build/src/lib/logging.d.ts +8 -5
  41. package/build/src/lib/logging.js +8 -4
  42. package/build/src/lib/logging.js.map +1 -1
  43. package/build/src/lib/queryVersions.js +10 -9
  44. package/build/src/lib/queryVersions.js.map +1 -1
  45. package/build/src/lib/runGlobal.js +3 -2
  46. package/build/src/lib/runGlobal.js.map +1 -1
  47. package/build/src/lib/runLocal.js +3 -1
  48. package/build/src/lib/runLocal.js.map +1 -1
  49. package/build/src/lib/version-util.d.ts +2 -2
  50. package/build/src/lib/version-util.js +1 -1
  51. package/build/src/package-managers/gitTags.d.ts +8 -6
  52. package/build/src/package-managers/gitTags.js +8 -8
  53. package/build/src/package-managers/gitTags.js.map +1 -1
  54. package/build/src/package-managers/npm.d.ts +7 -5
  55. package/build/src/package-managers/npm.js +47 -25
  56. package/build/src/package-managers/npm.js.map +1 -1
  57. package/build/src/package-managers/staticRegistry.js +1 -1
  58. package/build/src/package-managers/staticRegistry.js.map +1 -1
  59. package/build/src/package-managers/yarn.d.ts +1 -1
  60. package/build/src/package-managers/yarn.js +5 -1
  61. package/build/src/package-managers/yarn.js.map +1 -1
  62. package/build/src/scripts/build-options.js +63 -17
  63. package/build/src/scripts/build-options.js.map +1 -1
  64. package/build/src/types/Cacher.d.ts +1 -1
  65. package/build/src/types/FilterFunction.d.ts +1 -1
  66. package/build/src/types/FilterRejectPattern.d.ts +1 -1
  67. package/build/src/types/GetVersion.d.ts +2 -1
  68. package/build/src/types/GroupFunction.d.ts +1 -1
  69. package/build/src/types/IndexType.d.ts +1 -1
  70. package/build/src/types/Maybe.d.ts +1 -1
  71. package/build/src/types/NpmConfig.d.ts +1 -1
  72. package/build/src/types/Options.d.ts +1 -1
  73. package/build/src/types/PackageFile.d.ts +1 -0
  74. package/build/src/types/RunOptions.d.ts +1 -1
  75. package/build/src/types/StaticRegistry.d.ts +1 -1
  76. package/build/src/types/Target.d.ts +3 -3
  77. package/build/src/types/TargetFunction.d.ts +1 -1
  78. package/build/src/types/UpgradeGroup.d.ts +1 -1
  79. package/build/src/types/Version.d.ts +1 -1
  80. package/build/src/types/VersionLevel.d.ts +1 -1
  81. package/build/src/types/VersionResult.d.ts +1 -0
  82. package/build/src/types/VersionSpec.d.ts +1 -1
  83. package/package.json +7 -7
package/README.md CHANGED
@@ -130,6 +130,9 @@ ncu "/^(?!react-).*$/" # windows
130
130
 
131
131
  ## Options
132
132
 
133
+ <!-- BEGIN Options -->
134
+ <!-- Do not edit this section by hand. It is auto-generated in build-options.ts. Run "npm run build" or "npm run build:options" to build. -->
135
+
133
136
  ```text
134
137
  --cache Cache versions to the cache file
135
138
  --cacheClear Clear the default cache, or the cache file
@@ -151,7 +154,7 @@ ncu "/^(?!react-).*$/" # windows
151
154
  (comma-delimited). (default:
152
155
  "prod,dev,bundle,optional")
153
156
  --deprecated Include deprecated packages.
154
- --doctor Iteratively installs upgrades and runs tests to
157
+ -d, --doctor Iteratively installs upgrades and runs tests to
155
158
  identify breaking upgrades. Requires "-u" to
156
159
  execute. Run "ncu --help --doctor" for details.
157
160
  --doctorInstall <command> Specifies the install script to use in doctor
@@ -246,64 +249,252 @@ ncu "/^(?!react-).*$/" # windows
246
249
  -h, --help display help for command
247
250
  ```
248
251
 
249
- ## Interactive Mode
252
+ <!-- END Options -->
250
253
 
251
- Choose exactly which upgrades to make in interactive mode:
254
+ ## Advanced Options
252
255
 
253
- ```sh
254
- ncu --interactive
255
- ncu -i
256
- ```
256
+ Some options have advanced usage, or allow per-package values by specifying a function in your ncurc.js file.
257
257
 
258
- Select which upgrades you want:
258
+ Run `ncu --help [OPTION]` to view advanced help for a specific option, or see below:
259
259
 
260
- ![ncu --interactive](https://user-images.githubusercontent.com/750276/175337598-cdbb2c46-64f8-44f5-b54e-4ad74d7b52b4.png)
260
+ <!-- BEGIN Advanced Options -->
261
+ <!-- Do not edit this section by hand. It is auto-generated in build-options.ts. Run "npm run build" or "npm run build:options" to build. -->
261
262
 
262
- Combine with `--format group` for a truly _luxe_ experience:
263
+ ## doctor
263
264
 
264
- ![ncu --interactive --format group](https://user-images.githubusercontent.com/750276/175336533-539261e4-5cf1-458f-9fbb-a7be2b477ebb.png)
265
+ Usage:
265
266
 
266
- ## Doctor Mode
267
+ ncu --doctor
268
+ ncu -d
267
269
 
268
- Usage: `ncu --doctor [-u] [options]`
270
+ Iteratively installs upgrades and runs tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
269
271
 
270
- Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires `-u` to execute (modifies your package file, lock file, and node_modules).
272
+ Add "-u" to execute (modifies your package file, lock file, and node_modules)
271
273
 
272
274
  To be more precise:
273
275
 
274
- 1. Runs `npm install` (or `yarn`) and `npm test` to ensure tests are currently passing. You can specify your own scripts with `--doctorInstall` and `--doctorTest`.
275
- 2. Runs `ncu -u` to optimistically upgrade all dependencies.
276
+ 1. Runs "npm install" and "npm test" to ensure tests are currently passing.
277
+ 2. Runs "ncu -u" to optimistically upgrade all dependencies.
276
278
  3. If tests pass, hurray!
277
279
  4. If tests fail, restores package file and lock file.
278
280
  5. For each dependency, install upgrade and run tests.
279
- 6. When the breaking upgrade is found, saves partially upgraded package.json (not including the breaking upgrade) and exits.
281
+ 6. Prints broken upgrades with test error.
282
+ 7. Saves working upgrades to package.json.
283
+
284
+ Additional options:
285
+
286
+ --doctorInstall specify a custom install script (default: "npm install" or "yarn")
287
+ --doctorTest specify a custom test script (default: "npm test")
288
+
289
+ Example:
290
+
291
+ $ ncu --doctor -u
292
+ Running tests before upgrading
293
+ npm install
294
+ npm run test
295
+ Upgrading all dependencies and re-running tests
296
+ ncu -u
297
+ npm install
298
+ npm run test
299
+ Tests failed
300
+ Identifying broken dependencies
301
+ npm install
302
+ npm install --no-save react@16.0.0
303
+ npm run test
304
+ ✓ react 15.0.0 → 16.0.0
305
+ npm install --no-save react-redux@7.0.0
306
+ npm run test
307
+ ✗ react-redux 6.0.0 → 7.0.0
308
+
309
+ /projects/myproject/test.js:13
310
+ throw new Error('Test failed!')
311
+ ^
312
+
313
+ npm install --no-save react-dnd@11.1.3
314
+ npm run test
315
+ ✓ react-dnd 10.0.0 → 11.1.3
316
+ Saving partially upgraded package.json
317
+
318
+ ## format
319
+
320
+ Usage:
321
+
322
+ ncu --format [value]
323
+
324
+ Modify the output formatting or show additional information. Specify one or more comma-delimited values.
325
+
326
+ ┌──────────────┬─────────────────────────────────────────────────────────────────────────┐
327
+ │ group │ Groups packages by major, minor, patch, and major version zero updates. │
328
+ ├──────────────┼─────────────────────────────────────────────────────────────────────────┤
329
+ │ ownerChanged │ Shows if the package owner has changed. │
330
+ ├──────────────┼─────────────────────────────────────────────────────────────────────────┤
331
+ │ repo │ Infers and displays links to the package's source code repository. │
332
+ ├──────────────┼─────────────────────────────────────────────────────────────────────────┤
333
+ │ time │ Shows the publish time of each upgrade. │
334
+ └──────────────┴─────────────────────────────────────────────────────────────────────────┘
335
+
336
+ ## groupFunction
337
+
338
+ Usage:
339
+
340
+ ncu --groupFunction [fn]
341
+
342
+ Customize how packages are divided into groups when using '--format group'. Only available in .ncurc.js or when importing npm-check-updates as a module:
343
+
344
+ /**
345
+ @param name The name of the dependency.
346
+ @param defaultGroup The predefined group name which will be used by default.
347
+ @param currentSpec The current version range in your package.json.
348
+ @param upgradedSpec The upgraded version range that will be written to your package.json.
349
+ @param upgradedVersion The upgraded version number returned by the registry.
350
+ @returns A predefined group name ('major' | 'minor' | 'patch' | 'majorVersionZero' | 'none') or a custom string to create your own group.
351
+ */
352
+ groupFunction: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion} {
353
+ if (name === 'typescript' && defaultGroup === 'minor') {
354
+ return 'major'
355
+ }
356
+ if (name.startsWith('@myorg/')) {
357
+ return 'My Org'
358
+ }
359
+ return defaultGroup
360
+ }
361
+
362
+ ## packageManager
363
+
364
+ Usage:
365
+
366
+ ncu --packageManager [s]
367
+ ncu -p [s]
368
+
369
+ Specifies the package manager to use when looking up version numbers.
370
+
371
+ ┌────────────────┬───────────────────────────────────────────────────────────────────────────────────────────┐
372
+ │ npm │ System-installed npm. Default. │
373
+ ├────────────────┼───────────────────────────────────────────────────────────────────────────────────────────┤
374
+ │ yarn │ System-installed yarn. Automatically used if yarn.lock is present. │
375
+ ├────────────────┼───────────────────────────────────────────────────────────────────────────────────────────┤
376
+ │ staticRegistry │ Checks versions from a static file. Must include the --registry option with the path to a │
377
+ │ │ JSON registry file. │
378
+ │ │ │
379
+ │ │ Example: │
380
+ │ │ │
381
+ │ │ $ ncu --packageManager staticRegistry --registry ./my-registry.json │
382
+ │ │ │
383
+ │ │ my-registry.json: │
384
+ │ │ │
385
+ │ │ { │
386
+ │ │ "prettier": "2.7.1", │
387
+ │ │ "typescript": "4.7.4" │
388
+ │ │ } │
389
+ └────────────────┴───────────────────────────────────────────────────────────────────────────────────────────┘
390
+
391
+ ## peer
392
+
393
+ Usage:
394
+
395
+ ncu --peer
396
+
397
+ Check peer dependencies of installed packages and filter updates to compatible versions.
280
398
 
281
399
  Example:
282
400
 
401
+ The following example demonstrates how --peer works, and how it uses peer dependencies from upgraded modules.
402
+
403
+ The package ncu-test-peer-update has two versions published:
404
+
405
+ - 1.0.0 has peer dependency "ncu-test-return-version": "1.0.x"
406
+ - 1.1.0 has peer dependency "ncu-test-return-version": "1.1.x"
407
+
408
+ Our test app has the following dependencies:
409
+
410
+ "ncu-test-peer-update": "1.0.0",
411
+ "ncu-test-return-version": "1.0.0"
412
+
413
+ The latest versions of these packages are:
414
+
415
+ "ncu-test-peer-update": "1.1.0",
416
+ "ncu-test-return-version": "2.0.0"
417
+
418
+ With --peer:
419
+
420
+ ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:
421
+
422
+ ncu-test-peer-update 1.0.0 → 1.1.0
423
+ ncu-test-return-version 1.0.0 → 1.1.0
424
+
425
+ Without --peer:
426
+
427
+ As a comparison: without using the --peer option, ncu will suggest the latest versions, ignoring peer dependencies:
428
+
429
+ ncu-test-peer-update 1.0.0 → 1.1.0
430
+ ncu-test-return-version 1.0.0 → 2.0.0
431
+
432
+ ## registry
433
+
434
+ Usage:
435
+
436
+ ncu --registry [uri]
437
+ ncu -r [uri]
438
+
439
+ Specify the registry to use when looking up package version numbers.
440
+
441
+ When --packageManager staticRegistry is set, --registry must specify a path to a JSON
442
+ registry file.
443
+
444
+ ## target
445
+
446
+ Usage:
447
+
448
+ ncu --target [value]
449
+ ncu -t [value]
450
+
451
+ Determines the version to upgrade to. (default: "latest")
452
+
453
+ ┌──────────┬──────────────────────────────────────────────────────────────────────────────────────────────┐
454
+ │ greatest │ Upgrade to the highest version number published, regardless of release date or tag. Includes │
455
+ ├──────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
456
+ │ latest │ Upgrade to whatever the package's "latest" git tag points to. Excludes pre is specified. │
457
+ ├──────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
458
+ │ minor │ Upgrade to the highest minor version without bumping the major version. │
459
+ ├──────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
460
+ │ newest │ Upgrade to the version with the most recent publish date, even if there are other version │
461
+ │ │ numbers that are higher. Includes prereleases. │
462
+ ├──────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
463
+ │ patch │ Upgrade to the highest patch version without bumping the minor or major versions. │
464
+ ├──────────┼──────────────────────────────────────────────────────────────────────────────────────────────┤
465
+ │ @[tag] │ Upgrade to the version published to a specific tag, e.g. 'next' or 'beta'. │
466
+ └──────────┴──────────────────────────────────────────────────────────────────────────────────────────────┘
467
+
468
+ You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module:
469
+
470
+ /** Custom target.
471
+ @param dependencyName The name of the dependency.
472
+ @param parsedVersion A parsed Semver object from semver-utils.
473
+ (See https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
474
+ @returns One of the valid target values (specified in the table above).
475
+ */
476
+ target: (dependencyName, [{ semver, version, operator, major, minor, patch, release, build }]) => {
477
+ if (major === '0') return 'minor'
478
+ return 'latest'
479
+ }
480
+
481
+ <!-- END Advanced Options -->
482
+
483
+ ## Interactive Mode
484
+
485
+ Choose which packages to update in interactive mode:
486
+
283
487
  ```sh
284
- $ ncu --doctor -u
285
- npm install
286
- npm run test
287
- ncu -u
288
- npm install
289
- npm run test
290
- Failing tests found:
291
- /projects/myproject/test.js:13
292
- throw new Error('Test failed!')
293
- ^
294
- Now let's identify the culprit, shall we?
295
- Restoring package.json
296
- Restoring package-lock.json
297
- npm install
298
- npm install --no-save react@16.0.0
299
- npm run test
300
- ✓ react 15.0.0 → 16.0.0
301
- npm install --no-save react-redux@7.0.0
302
- npm run test
303
- ✗ react-redux 6.0.0 → 7.0.0
304
- Saving partially upgraded package.json
488
+ ncu --interactive
489
+ ncu -i
305
490
  ```
306
491
 
492
+ ![ncu --interactive](https://user-images.githubusercontent.com/750276/175337598-cdbb2c46-64f8-44f5-b54e-4ad74d7b52b4.png)
493
+
494
+ Combine with `--format group` for a truly _luxe_ experience:
495
+
496
+ ![ncu --interactive --format group](https://user-images.githubusercontent.com/750276/175336533-539261e4-5cf1-458f-9fbb-a7be2b477ebb.png)
497
+
307
498
  ## Config File
308
499
 
309
500
  Use a `.ncurc.{json,yml,js}` file to specify configuration information.
@@ -0,0 +1,5 @@
1
+ /** A very generic object. */
2
+ declare type Index<T = any> = {
3
+ [key: string]: T;
4
+ };
5
+ export default Index;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IndexType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexType.js","sourceRoot":"","sources":["../../../../../em/src/@types/IndexType.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import Index from '../@types/IndexType';
2
+ declare type KeyValueGenerator<K, V, R> = (key: K, value: V, accum: Index<R>) => Index<R> | null;
3
+ declare function keyValueBy<T, R>(arr: T[], keyValue: KeyValueGenerator<T, number, R>, initialValue?: Index<R>): Index<R>;
4
+ declare function keyValueBy<T, R>(obj: Index<T>, keyValue: KeyValueGenerator<string, T, R>, initialValue?: Index<R>): Index<R>;
5
+ export default keyValueBy;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** Generates an object from an array or object. Simpler than reduce or _.transform. The KeyValueGenerator passes (key, value) if the input is an object, and (value, i) if it is an array. The return object from each iteration is merged into the accumulated object. Return null to skip an item. */
4
+ function keyValueBy(input, keyValue, accum = {}) {
5
+ const isArray = Array.isArray(input);
6
+ // considerably faster than Array.prototype.reduce
7
+ Object.entries(input || {}).forEach(([key, value], i) => {
8
+ const o = isArray
9
+ ? keyValue(value, i, accum)
10
+ : keyValue(key, value, accum);
11
+ Object.entries(o || {}).forEach(entry => {
12
+ accum[entry[0]] = entry[1];
13
+ });
14
+ });
15
+ return accum;
16
+ }
17
+ exports.default = keyValueBy;
18
+ //# sourceMappingURL=keyValueBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyValueBy.js","sourceRoot":"","sources":["../../../../../em/src/util/keyValueBy.ts"],"names":[],"mappings":";;AASA,wSAAwS;AACxS,SAAS,UAAU,CACjB,KAAqB,EACrB,QAAsE,EACtE,QAAkB,EAAE;IAEpB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,kDAAkD;IAClD,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE;QACtD,MAAM,CAAC,GAAG,OAAO;YACf,CAAC,CAAE,QAAyC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC;YAC7D,CAAC,CAAE,QAA0C,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QAClE,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACtC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,kBAAe,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Index } from './types/IndexType';
2
+ import { PackageFile } from './types/PackageFile';
3
+ import { RunOptions } from './types/RunOptions';
4
+ import { VersionSpec } from './types/VersionSpec';
5
+ /** Main entry point.
6
+ *
7
+ * @returns Promise<
8
+ * PackageFile Default returns upgraded package file.
9
+ * | Index<VersionSpec> --jsonUpgraded returns only upgraded dependencies.
10
+ * | void --global upgrade returns void.
11
+ * >
12
+ */
13
+ export declare function run(runOptions?: RunOptions, { cli }?: {
14
+ cli?: boolean;
15
+ }): Promise<PackageFile | Index<VersionSpec> | void>;
16
+ export default run;
17
+ export type { RunOptions };
@@ -0,0 +1,8 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Options } from '../types/Options';
3
+ import { PackageFile } from '../types/PackageFile';
4
+ import { VersionSpec } from '../types/VersionSpec';
5
+ declare type Run = (options?: Options) => Promise<PackageFile | Index<VersionSpec> | void>;
6
+ /** Iteratively installs upgrades and runs tests to identify breaking upgrades. */
7
+ declare const doctor: (run: Run, options: Options) => Promise<void>;
8
+ export default doctor;
@@ -0,0 +1,8 @@
1
+ import { IgnoredUpgrade } from '../types/IgnoredUpgrade';
2
+ import { Index } from '../types/IndexType';
3
+ import { Options } from '../types/Options';
4
+ import { Version } from '../types/Version';
5
+ import { VersionSpec } from '../types/VersionSpec';
6
+ /** Get all upgrades that are ignored due to incompatible peer dependencies. */
7
+ export declare function getIgnoredUpgrades(current: Index<VersionSpec>, upgraded: Index<VersionSpec>, upgradedPeerDependencies: Index<Index<Version>>, options?: Options): Promise<Index<IgnoredUpgrade>>;
8
+ export default getIgnoredUpgrades;
@@ -0,0 +1,12 @@
1
+ import { Options } from '../types/Options';
2
+ /**
3
+ * @param [options]
4
+ * @param options.cwd
5
+ * @param options.filter
6
+ * @param options.global
7
+ * @param options.packageManager
8
+ * @param options.prefix
9
+ * @param options.reject
10
+ */
11
+ declare function getInstalledPackages(options?: Options): Promise<import("../types/IndexType").Index<string>>;
12
+ export default getInstalledPackages;
@@ -0,0 +1,12 @@
1
+ import { Maybe } from '../types/Maybe';
2
+ import { PackageManager } from '../types/PackageManager';
3
+ /**
4
+ * Initialize the version manager with the given package manager.
5
+ *
6
+ * @param packageManagerNameOrObject
7
+ * @param packageManagerNameOrObject.global
8
+ * @param packageManagerNameOrObject.packageManager
9
+ * @returns
10
+ */
11
+ declare function getPackageManager(packageManagerNameOrObject: Maybe<string | PackageManager>): PackageManager;
12
+ export default getPackageManager;
@@ -0,0 +1,12 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Options } from '../types/Options';
3
+ import { VersionSpec } from '../types/VersionSpec';
4
+ /**
5
+ * Get the latest or greatest versions from the NPM repository based on the version target.
6
+ *
7
+ * @param packageMap An object whose keys are package name and values are version
8
+ * @param [options={}] Options.
9
+ * @returns Promised {packageName: peer dependencies} collection
10
+ */
11
+ declare function getPeerDependenciesFromRegistry(packageMap: Index<VersionSpec>, options: Options): Promise<{}>;
12
+ export default getPeerDependenciesFromRegistry;
@@ -0,0 +1,13 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Options } from '../types/Options';
3
+ import { VersionResult } from '../types/VersionResult';
4
+ import { VersionSpec } from '../types/VersionSpec';
5
+ /**
6
+ * Get the latest or greatest versions from the NPM repository based on the version target.
7
+ *
8
+ * @param packageMap An object whose keys are package name and values are current versions. May include npm aliases, i.e. { "package": "npm:other-package@1.0.0" }
9
+ * @param [options={}] Options. Default: { target: 'latest' }.
10
+ * @returns Promised {packageName: version} collection
11
+ */
12
+ declare function queryVersions(packageMap: Index<VersionSpec>, options?: Options): Promise<Index<VersionResult>>;
13
+ export default queryVersions;
@@ -0,0 +1,5 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Options } from '../types/Options';
3
+ /** Checks global dependencies for upgrades. */
4
+ declare function runGlobal(options: Options): Promise<Index<string> | void>;
5
+ export default runGlobal;
@@ -0,0 +1,18 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Maybe } from '../types/Maybe';
3
+ import { Options } from '../types/Options';
4
+ import { PackageFile } from '../types/PackageFile';
5
+ import { Version } from '../types/Version';
6
+ import { VersionSpec } from '../types/VersionSpec';
7
+ /**
8
+ * Return a promise which resolves to object storing package owner changed status for each dependency.
9
+ *
10
+ * @param fromVersion current packages version.
11
+ * @param toVersion target packages version.
12
+ * @param options
13
+ * @returns
14
+ */
15
+ export declare function getOwnerPerDependency(fromVersion: Index<Version>, toVersion: Index<Version>, options: Options): Promise<Index<boolean>>;
16
+ /** Checks local project dependencies for upgrades. */
17
+ declare function runLocal(options: Options, pkgData?: Maybe<string>, pkgFile?: Maybe<string>): Promise<PackageFile | Index<VersionSpec>>;
18
+ export default runLocal;
@@ -0,0 +1,13 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { Options } from '../types/Options';
3
+ import { VersionResult } from '../types/VersionResult';
4
+ import { VersionSpec } from '../types/VersionSpec';
5
+ /**
6
+ * Returns a 3-tuple of upgradedDependencies, their latest versions and the resulting peer dependencies.
7
+ *
8
+ * @param currentDependencies
9
+ * @param options
10
+ * @returns
11
+ */
12
+ export declare function upgradePackageDefinitions(currentDependencies: Index<VersionSpec>, options: Options): Promise<[Index<VersionSpec>, Index<VersionResult>, Index<Index<VersionSpec>>?]>;
13
+ export default upgradePackageDefinitions;
@@ -0,0 +1,4 @@
1
+ import { Index } from '../types/IndexType';
2
+ import { PackageManager } from '../types/PackageManager';
3
+ declare const _default: Index<PackageManager>;
4
+ export default _default;
@@ -0,0 +1,133 @@
1
+ import { GetVersion } from '../types/GetVersion';
2
+ import { Index } from '../types/IndexType';
3
+ import { NpmConfig } from '../types/NpmConfig';
4
+ import { NpmOptions } from '../types/NpmOptions';
5
+ import { Options } from '../types/Options';
6
+ import { Packument } from '../types/Packument';
7
+ import { Version } from '../types/Version';
8
+ import { VersionSpec } from '../types/VersionSpec';
9
+ /**
10
+ * Check if package author changed between current and upgraded version.
11
+ *
12
+ * @param packageName Name of the package
13
+ * @param currentVersion Current version declaration (may be range)
14
+ * @param upgradedVersion Upgraded version declaration (may be range)
15
+ * @param npmConfigLocal Additional npm config variables that are merged into the system npm config
16
+ * @returns A promise that fulfills with boolean value.
17
+ */
18
+ export declare function packageAuthorChanged(packageName: string, currentVersion: VersionSpec, upgradedVersion: VersionSpec, options?: Options, npmConfigLocal?: NpmConfig): Promise<boolean>;
19
+ /**
20
+ * Returns an object of specified values retrieved by npm view.
21
+ *
22
+ * @param packageName Name of the package
23
+ * @param fields Array of fields like versions, time, version
24
+ * @param currentVersion
25
+ * @returns Promised result
26
+ */
27
+ export declare function viewMany(packageName: string, fields: string[], currentVersion: Version, options: Options, retried?: number, npmConfigLocal?: NpmConfig): Promise<Packument>;
28
+ /** Memoize viewMany for --deep performance. */
29
+ export declare const viewManyMemoized: typeof viewMany;
30
+ /**
31
+ * Returns the value of one of the properties retrieved by npm view.
32
+ *
33
+ * @param packageName Name of the package
34
+ * @param field Field such as "versions" or "dist-tags.latest" are parsed from the pacote result (https://www.npmjs.com/package/pacote#packument)
35
+ * @param currentVersion
36
+ * @returns Promised result
37
+ */
38
+ export declare function viewOne(packageName: string, field: string, currentVersion: Version, options: Options, npmConfigLocal?: NpmConfig): Promise<string | boolean | {
39
+ engines: {
40
+ node: string;
41
+ };
42
+ } | undefined | Index<string> | Packument[]>;
43
+ /**
44
+ * Spawns npm. Handles different commands for Window and Linux/OSX, and automatically converts --location=global to --global on node < 8.11.0.
45
+ *
46
+ * @param args
47
+ * @param [npmOptions={}]
48
+ * @param [spawnOptions={}]
49
+ * @returns
50
+ */
51
+ declare function spawnNpm(args: string | string[], npmOptions?: NpmOptions, spawnOptions?: Index<any>): Promise<any>;
52
+ /**
53
+ * Get platform-specific default prefix to pass on to npm.
54
+ *
55
+ * @param options
56
+ * @param [options.global]
57
+ * @param [options.prefix]
58
+ * @returns
59
+ */
60
+ export declare function defaultPrefix(options: Options): Promise<string | undefined>;
61
+ /**
62
+ * Fetches the highest version number, regardless of tag or publish time.
63
+ *
64
+ * @param packageName
65
+ * @param currentVersion
66
+ * @param options
67
+ * @returns
68
+ */
69
+ export declare const greatest: GetVersion;
70
+ /**
71
+ * Fetches the list of peer dependencies for a specific package version.
72
+ *
73
+ * @param packageName
74
+ * @param version
75
+ * @returns Promised {packageName: version} collection
76
+ */
77
+ export declare const getPeerDependencies: (packageName: string, version: Version) => Promise<Index<Version>>;
78
+ /**
79
+ * Fetches the list of all installed packages.
80
+ *
81
+ * @param [options]
82
+ * @param [options.cwd]
83
+ * @param [options.global]
84
+ * @param [options.prefix]
85
+ * @returns
86
+ */
87
+ export declare const list: (options?: Options) => Promise<Index<string | undefined>>;
88
+ /**
89
+ * Fetches the version of a package published to options.distTag.
90
+ *
91
+ * @param packageName
92
+ * @param currentVersion
93
+ * @param options
94
+ * @returns
95
+ */
96
+ export declare const distTag: GetVersion;
97
+ /**
98
+ * Fetches the version published to the latest tag.
99
+ *
100
+ * @param packageName
101
+ * @param currentVersion
102
+ * @param options
103
+ * @returns
104
+ */
105
+ export declare const latest: GetVersion;
106
+ /**
107
+ * Fetches the most recently published version, regardless of version number.
108
+ *
109
+ * @param packageName
110
+ * @param currentVersion
111
+ * @param options
112
+ * @returns
113
+ */
114
+ export declare const newest: GetVersion;
115
+ /**
116
+ * Fetches the highest version with the same major version as currentVersion.
117
+ *
118
+ * @param packageName
119
+ * @param currentVersion
120
+ * @param options
121
+ * @returns
122
+ */
123
+ export declare const minor: GetVersion;
124
+ /**
125
+ * Fetches the highest version with the same minor and major version as currentVersion.
126
+ *
127
+ * @param packageName
128
+ * @param currentVersion
129
+ * @param options
130
+ * @returns
131
+ */
132
+ export declare const patch: GetVersion;
133
+ export default spawnNpm;