@juit/check-updates 2.0.0 → 2.0.1

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/README.md CHANGED
@@ -17,16 +17,17 @@ $ check-updates --help
17
17
  check-updates [--options ...] [package.json ...]
18
18
 
19
19
  Options:
20
- -h, --help Show help [boolean]
21
- -s, --strict Strictly adhere to semver rules for tilde (~x.y.z)
22
- and caret (^x.y.z) dependency ranges [boolean]
23
- -q, --quick Consider dev/peer/optional dependency updates if and
24
- only if the main depenencies also had updates [boolean]
25
- -d, --debug Output debugging informations [boolean]
26
- -b, --bump Bump the version of the package file on changes
20
+ -h, --help Show help [boolean]
21
+ -s, --strict Strictly adhere to semver rules for tilde (~x.y.z)
22
+ and caret (^x.y.z) dependency ranges [boolean]
23
+ -q, --quick Consider dev/peer/optional dependency updates if and
24
+ only if the main depenencies also had updates [boolean]
25
+ -d, --debug Output debugging informations [boolean]
26
+ -n, --no-errors Exit with 0 (zero) in case of no updates [boolean]
27
+ -b, --bump Bump the version of the package file on changes
27
28
  [choices: "major", "minor", "patch"]
28
- -x, --dry-run Only process changes without writing to disk [boolean]
29
- -v, --version Show version number [boolean]
29
+ -x, --dry-run Only process changes without writing to disk [boolean]
30
+ -v, --version Show version number [boolean]
30
31
 
31
32
  Multiple files (or globs) can be specified on the command line.
32
33
 
@@ -35,6 +36,14 @@ in the current directory
35
36
  $
36
37
  ```
37
38
 
39
+ Alternatively it can be invoked via `npx '@juit/check-updates'`.
40
+
41
+ The exit code returned to the caller will be:
42
+
43
+ * `0`: dependencies were updated and `package.json` was changed.
44
+ * `255`: nothing was updated, no changes.
45
+ * _any other_: error from NodeJS.
46
+
38
47
  Legal
39
48
  -----
40
49
 
package/check-updates.js CHANGED
@@ -295,6 +295,10 @@ var parsed = yargs.usage("$0 [--options ...] [package.json ...]").help("h").alia
295
295
  alias: "debug",
296
296
  type: "boolean",
297
297
  description: "Output debugging informations"
298
+ }).option("n", {
299
+ alias: "no-errors",
300
+ type: "boolean",
301
+ description: "Exit with 0 (zero) in case of no updates"
298
302
  }).options("b", {
299
303
  alias: "bump",
300
304
  coerce: (bump) => bump == true ? "patch" : bump,
@@ -308,12 +312,12 @@ var parsed = yargs.usage("$0 [--options ...] [package.json ...]").help("h").alia
308
312
  "Multiple files (or globs) can be specified on the command line.\n",
309
313
  'When no files are specified, the default is to process the "package.json" file in the current directory'
310
314
  ].join("\n")).strictOptions().argv;
311
- Promise.resolve(parsed).then(({ b: bump, s: strict, q: quick, d: debug, x: dryrun, _: args = [] }) => {
315
+ Promise.resolve(parsed).then(({ b: bump, s: strict, q: quick, n: noerr, d: debug, x: dryrun, _: args = [] }) => {
312
316
  const files = args.map((arg) => arg.toString());
313
317
  if (!files.length)
314
318
  files.push("package.json");
315
319
  (0, import_updater.processPackages)(files, { strict, quick, debug, dryrun, bump }).then((changes) => {
316
- process.exit(changes ? 0 : 1);
320
+ process.exit(changes ? 0 : noerr ? 0 : -1);
317
321
  }).catch((error) => {
318
322
  console.error(error);
319
323
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juit/check-updates",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Small and fast utility to update package dependencies",
5
5
  "author": "Team Juit <developers@juit.com>",
6
6
  "license": "Apache-2.0",
package/src/main.ts CHANGED
@@ -35,6 +35,11 @@ const parsed = yargs
35
35
  type: 'boolean',
36
36
  description: 'Output debugging informations',
37
37
  })
38
+ .option('n', {
39
+ alias: 'no-errors',
40
+ type: 'boolean',
41
+ description: 'Exit with 0 (zero) in case of no updates',
42
+ })
38
43
  .options('b', {
39
44
  alias: 'bump',
40
45
  coerce: ((bump): ReleaseType => bump == true ? 'patch' : bump),
@@ -53,7 +58,7 @@ const parsed = yargs
53
58
  .strictOptions()
54
59
  .argv
55
60
 
56
- Promise.resolve(parsed).then(({ b: bump, s: strict, q: quick, d: debug, x: dryrun, _: args = [] }) => {
61
+ Promise.resolve(parsed).then(({ b: bump, s: strict, q: quick, n: noerr, d: debug, x: dryrun, _: args = [] }) => {
57
62
  /* Normalize arguments and default to package.json in the current directory */
58
63
  const files = args.map((arg) => arg.toString())
59
64
  if (! files.length) files.push('package.json')
@@ -61,7 +66,7 @@ Promise.resolve(parsed).then(({ b: bump, s: strict, q: quick, d: debug, x: dryru
61
66
  /* Process packages, one by one */
62
67
  processPackages(files, { strict, quick, debug, dryrun, bump })
63
68
  .then((changes) => {
64
- process.exit(changes ? 0 : 1)
69
+ process.exit(changes ? 0 : noerr ? 0 : -1)
65
70
  })
66
71
  .catch((error) => {
67
72
  console.error(error)