@smarlhens/npm-check-engines 0.4.3 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0](https://github.com/smarlhens/npm-check-engines/compare/v0.6.0...v0.7.0) (2022-07-03)
4
+
5
+
6
+ ### Features
7
+
8
+ * tips to upgrade package.json when new computed range constraints are available ([17ea35f](https://github.com/smarlhens/npm-check-engines/commit/17ea35f2e0eb2240c85c46fc16fdef25411d0188))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * **readme:** add missing thanks link in toc ([0e579a4](https://github.com/smarlhens/npm-check-engines/commit/0e579a4d475936c59595ac18301c0ac0c600fe76))
14
+
15
+ ## [0.6.0](https://github.com/smarlhens/npm-check-engines/compare/v0.5.0...v0.6.0) (2022-07-03)
16
+
17
+
18
+ ### Features
19
+
20
+ * use update-notifier to check for tool updates ([17fa3d9](https://github.com/smarlhens/npm-check-engines/commit/17fa3d95a60f5234b3f1583a8a9c9f0616dd80df))
21
+
22
+
23
+ ### Miscellaneous
24
+
25
+ * simplify imports ([084f677](https://github.com/smarlhens/npm-check-engines/commit/084f677d488f0cf3845a80d474d20d0773a04834))
26
+
27
+
28
+ ### Chores
29
+
30
+ * clarify imports order using prettier plugin ([530dec3](https://github.com/smarlhens/npm-check-engines/commit/530dec38837d60d5dbf8fa8dd6a2fc87b646aa1c))
31
+ * **deps:** update dependency @types/node to v18 ([23efdfd](https://github.com/smarlhens/npm-check-engines/commit/23efdfddcda846b30a2c9cec6c2e9c156f0aec7f))
32
+ * **typescript:** enforce tsconfig & type checking ([b39f097](https://github.com/smarlhens/npm-check-engines/commit/b39f097b51e4aa130f0708276e16cc7096424c89))
33
+
34
+ ## [0.5.0](https://github.com/smarlhens/npm-check-engines/compare/v0.4.3...v0.5.0) (2022-07-03)
35
+
36
+
37
+ ### Features
38
+
39
+ * clarify computed engines range constraints using table with before & after ([e675e3b](https://github.com/smarlhens/npm-check-engines/commit/e675e3ba7de42b564d1b479573af12fa4c023485))
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * **npm:** remove minimist overrides ([78337f7](https://github.com/smarlhens/npm-check-engines/commit/78337f75a94f99d6504244ca784d5a7c3c6354ed))
45
+
46
+
47
+ ### Documentation
48
+
49
+ * **readme:** add thanks section ([d4517d8](https://github.com/smarlhens/npm-check-engines/commit/d4517d816868314915d3d94e686ebb65cf1ab2c5))
50
+ * **readme:** reduce width of text ([ad721ed](https://github.com/smarlhens/npm-check-engines/commit/ad721ed304259cca43a0ef7022d684917246d162))
51
+
52
+
53
+ ### Chores
54
+
55
+ * add format markdown files using prettier ([bae0798](https://github.com/smarlhens/npm-check-engines/commit/bae07988821c4a4009f38ef29aae3ed7f3a659ab))
56
+ * **deps:** update babel monorepo to v7.18.6 ([a869dcf](https://github.com/smarlhens/npm-check-engines/commit/a869dcf9e92ee0904e43192b5c0c4802bd4474b4))
57
+ * **deps:** update commitlint monorepo to v17.0.3 ([8ed112a](https://github.com/smarlhens/npm-check-engines/commit/8ed112a50300bb5965aaa6bf96620dad783f9c1e))
58
+ * **deps:** update dependency @types/jest to v28.1.3 ([f44cdbe](https://github.com/smarlhens/npm-check-engines/commit/f44cdbe1f299d3ff552b91f22e158e3d78968235))
59
+ * **deps:** update dependency @types/jest to v28.1.4 ([2280e9a](https://github.com/smarlhens/npm-check-engines/commit/2280e9a12db283775bd7f1cdb29157a61e095f3c))
60
+ * **deps:** update dependency lint-staged to v13.0.3 ([d02aea3](https://github.com/smarlhens/npm-check-engines/commit/d02aea3328de97105a88482e739d8e6e72d5392f))
61
+ * **deps:** update dependency ts-node to v10.8.2 ([94e2b98](https://github.com/smarlhens/npm-check-engines/commit/94e2b987b2ee7bc1b1b66a1e79d9a5289e9bb3a7))
62
+ * **deps:** update jest monorepo to v28.1.2 ([c72c044](https://github.com/smarlhens/npm-check-engines/commit/c72c0443f102a0944fc08f6181ae289cfbaf3588))
63
+ * **gh-actions:** pin-down node version used in ci jobs ([0dd7936](https://github.com/smarlhens/npm-check-engines/commit/0dd793631a8c7a6b1868b8d16c59c8ebf2794dd3))
64
+ * remove unused commitizen related dependency & badge ([b0cbf83](https://github.com/smarlhens/npm-check-engines/commit/b0cbf836dca5ee75b493e885bce37ce8d0849160))
65
+
3
66
  ## [0.4.3](https://github.com/smarlhens/npm-check-engines/compare/v0.4.2...v0.4.3) (2022-06-18)
4
67
 
5
68
 
package/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/smarlhens/npm-check-engines.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/smarlhens/npm-check-engines/context:javascript)
6
6
  ![node-current (scoped)](https://img.shields.io/node/v/@smarlhens/npm-check-engines)
7
7
  [![GitHub license](https://img.shields.io/github/license/smarlhens/npm-check-engines)](https://github.com/smarlhens/npm-check-engines)
8
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
9
8
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
10
9
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
11
10
 
@@ -20,6 +19,7 @@
20
19
  - [Usage](#usage)
21
20
  - [Options](#options)
22
21
  - [Debug](#debug)
22
+ - [Thanks](#thanks)
23
23
 
24
24
  ---
25
25
 
@@ -52,7 +52,10 @@ Show the most restrictive constraint (**opinionated**) of the node engine for th
52
52
  ```sh
53
53
  $ nce
54
54
  ✔ Computed engines range constraints:
55
- - node: ^14.17.0 || ^16.10.0 || >=17.0.0
55
+
56
+ node * → ^14.17.0 || ^16.10.0 || >=17.0.0
57
+
58
+ Run nce -u to upgrade package.json.
56
59
  ```
57
60
 
58
61
  Upgrade a project's `package.json` file:
@@ -60,7 +63,8 @@ Upgrade a project's `package.json` file:
60
63
  ```sh
61
64
  $ nce -u
62
65
  ✔ Computed engines range constraints:
63
- - node: ^14.17.0 || ^16.10.0 || >=17.0.0
66
+
67
+ node * → ^14.17.0 || ^16.10.0 || >=17.0.0
64
68
  ```
65
69
 
66
70
  ---
@@ -71,13 +75,15 @@ $ nce -u
71
75
  Usage: nce [options]
72
76
 
73
77
  Options:
74
- -p, --path Path to the NPM package folder. Default will use current folder. [string]
75
- -q, --quiet Enable quiet mode. [boolean] [default: false]
76
- -d, --debug Enable debug mode. Can be used with environment variable DEBUG=nce.[boolean] [default: false]
77
- -v, --verbose A little more detailed than the default output. [boolean] [default: false]
78
- -u, --update Update engines in package.json file. [boolean] [default: false]
79
- --help Show help [boolean]
80
- --version Show version number [boolean]
78
+ -p, --path Path to the NPM package folder. Default will use current folder. [string]
79
+ -q, --quiet Enable quiet mode. [boolean] [default: false]
80
+ -d, --debug Enable debug mode. Can be used with environment variable DEBUG=nce.
81
+ [boolean] [default: false]
82
+ -v, --verbose A little more detailed than the default output. [boolean] [default: false]
83
+ -e, --engines Select engines to check. Default will check all engines defined. [array]
84
+ -u, --update Update engines in package.json file. [boolean] [default: false]
85
+ --help Show help [boolean]
86
+ --version Show version number [boolean]
81
87
 
82
88
  Examples:
83
89
  nce Check package-lock.json file in current working directory.
@@ -102,42 +108,85 @@ $ DEBUG=* nce -d
102
108
  ```text
103
109
  [STARTED] Checking npm package engines range constraints in package-lock.json file...
104
110
  [TITLE] Checking npm package engines range constraints in examples\package-lock.json file...
111
+ [STARTED] Load package.json file...
112
+ nce Relative path to package.json: examples\package.json +0ms
113
+ nce Validate JSON schema of examples\package.json +3ms
114
+ [SUCCESS] Load package.json file...
105
115
  [STARTED] Load package-lock.json file...
116
+ nce Relative path to package-lock.json: examples\package-lock.json +7ms
117
+ nce Validate JSON schema of examples\package-lock.json +1ms
106
118
  [SUCCESS] Load package-lock.json file...
107
119
  [STARTED] Compute engines range constraints...
108
120
  nce:node Package has no constraints for current engine +0ms
109
- nce:node New most restrictive range: >=6.9.0 +2ms
110
- nce:node Compare: >=6.9.0 and >=12.22.0 +2ms
111
- nce:node Range >=12.22.0 is a subset of >=6.9.0 +0ms
121
+ nce:node Final computed engine range constraint: * +0ms
122
+ nce:node Package has no constraints for current engine +0ms
123
+ nce:node Compare: * and >=6.9.0 +1ms
124
+ nce:node Range >=6.9.0 is a subset of * +1ms
125
+ nce:node New most restrictive range: >=6.9.0 +0ms
126
+ nce:node Compare: >=6.9.0 and >=12.22.0 +0ms
127
+ nce:node Range >=12.22.0 is a subset of >=6.9.0 +1ms
112
128
  nce:node New most restrictive range: >=12.22.0 +0ms
113
- nce:node Compare: >=12.22.0 and * +1ms
114
- nce:node Range >=12.22.0 is a subset of * +0ms
129
+ nce:node Ignored range: * +0ms
115
130
  nce:node Compare: >=12.22.0 and >=7.0.0 +0ms
116
131
  nce:node Range >=12.22.0 is a subset of >=7.0.0 +0ms
117
- nce:node Package node_modules/noengines has no constraints for current engine +0ms
132
+ nce:node Package node_modules/noengines has no constraints for current engine +1ms
118
133
  nce:node Compare: >=12.22.0 and >=12.13.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 +1ms
119
- nce:node Applying minimal version 12.22.0 to both ranges. +1ms
134
+ nce:node Applying minimal version 12.22.0 to both ranges. +0ms
120
135
  nce:node Compare: >=12.22.0 and >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 +1ms
121
- nce:node Range >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 is a subset of >=12.22.0 +0ms
136
+ nce:node Range >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 is a subset of >=12.22.0 +1ms
122
137
  nce:node New most restrictive range: >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 +0ms
123
- nce:node Compare: >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 and >=16.0.0||>=14.17.0 <15.0.0-0 +1ms
124
- nce:node Applying minimal version 14.17.0 to both ranges. +0ms
138
+ nce:node Compare: >=12.22.0 <13.0.0-0||>=14.15.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 and >=16.0.0||>=14.17.0 <15.0.0-0 +0ms
139
+ nce:node Applying minimal version 14.17.0 to both ranges. +1ms
125
140
  nce:node Compare: >=14.17.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 and >=14.17.0 <15.0.0-0||>=16.0.0 +0ms
126
- nce:node Range >=14.17.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 is a subset of >=14.17.0 <15.0.0-0||>=16.0.0 +1ms
141
+ nce:node Range >=14.17.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 is a subset of >=14.17.0 <15.0.0-0||>=16.0.0 +0ms
127
142
  nce:node New most restrictive range: >=14.17.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 +0ms
128
143
  nce:node Final computed engine range constraint: >=14.17.0 <15.0.0-0||>=16.10.0 <17.0.0-0||>=17.0.0 +0ms
144
+ nce:npm Package has no constraints for current engine +0ms
145
+ nce:npm Final computed engine range constraint: * +0ms
146
+ nce:npm Package has no constraints for current engine +0ms
147
+ nce:npm Package node_modules/foo has no constraints for current engine +0ms
148
+ nce:npm Package node_modules/bar has no constraints for current engine +0ms
149
+ nce:npm Package node_modules/all has no constraints for current engine +0ms
150
+ nce:npm Package node_modules/arr has no constraints for current engine +0ms
151
+ nce:npm Package node_modules/noengines has no constraints for current engine +0ms
152
+ nce:npm Package node_modules/complex1 has no constraints for current engine +1ms
153
+ nce:npm Package node_modules/complex2 has no constraints for current engine +0ms
154
+ nce:npm Final computed engine range constraint: * +0ms
155
+ nce:yarn Package has no constraints for current engine +0ms
156
+ nce:yarn Final computed engine range constraint: * +0ms
157
+ nce:yarn Package has no constraints for current engine +0ms
158
+ nce:yarn Package node_modules/foo has no constraints for current engine +0ms
159
+ nce:yarn Package node_modules/bar has no constraints for current engine +0ms
160
+ nce:yarn Package node_modules/all has no constraints for current engine +0ms
161
+ nce:yarn Package node_modules/arr has no constraints for current engine +1ms
162
+ nce:yarn Package node_modules/noengines has no constraints for current engine +0ms
163
+ nce:yarn Package node_modules/complex1 has no constraints for current engine +0ms
164
+ nce:yarn Package node_modules/complex2 has no constraints for current engine +0ms
165
+ nce:yarn Final computed engine range constraint: * +0ms
129
166
  [SUCCESS] Compute engines range constraints...
130
167
  [STARTED] Output computed engines range constraints...
131
168
  nce:node Simplified computed engine range constraint: ^14.17.0 || ^16.10.0 || >=17.0.0 +0ms
132
169
  [TITLE] Computed engines range constraints:
133
- [TITLE] - node: ^14.17.0 || ^16.10.0 || >=17.0.0
170
+ [TITLE]
171
+ [TITLE] node * → ^14.17.0 || ^16.10.0 || >=17.0.0
172
+ [TITLE]
173
+ [TITLE] Run nce -p examples -d -u to upgrade package.json.
134
174
  [SUCCESS] Output computed engines range constraints...
135
175
  [STARTED] Update package.json file...
136
176
  [SKIPPED] Update is disabled by default.
137
177
  [SUCCESS] Computed engines range constraints:
138
- [SUCCESS] - node: ^14.17.0 || ^16.10.0 || >=17.0.0
178
+ [SUCCESS]
179
+ [SUCCESS] node * → ^14.17.0 || ^16.10.0 || >=17.0.0
180
+ [SUCCESS]
181
+ [SUCCESS] Run nce -p examples -d -u to upgrade package.json.
139
182
  ```
140
183
 
141
184
  </details>
142
185
 
143
186
  ---
187
+
188
+ ## Thanks
189
+
190
+ This project is heavily inspired by the following awesome project: [npm-check-updates](https://github.com/raineorshine/npm-check-updates).
191
+
192
+ ---
package/dist/bin/nce.js CHANGED
@@ -1,6 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const yargs_1 = require("../lib/yargs");
4
+ const tslib_1 = require("tslib");
5
+ const update_notifier_1 = tslib_1.__importDefault(require("update-notifier"));
5
6
  const index_1 = require("../lib/index");
7
+ const yargs_1 = require("../lib/yargs");
8
+ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
9
+ const notifier = (0, update_notifier_1.default)({
10
+ pkg: package_json_1.default,
11
+ updateCheckInterval: 1000 * 60,
12
+ shouldNotifyInNpmScript: true,
13
+ });
14
+ if (notifier.update && notifier.update.latest !== package_json_1.default.version) {
15
+ notifier.notify({
16
+ defer: false,
17
+ isGlobal: true,
18
+ });
19
+ }
6
20
  (0, index_1.nce)(yargs_1.cli);
package/dist/lib/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nce = void 0;
4
- const tasks_1 = require("./tasks");
5
- const renderer_1 = require("./renderer");
6
- const debug_1 = require("./debug");
7
4
  const path_1 = require("path");
5
+ const debug_1 = require("./debug");
6
+ const renderer_1 = require("./renderer");
7
+ const tasks_1 = require("./tasks");
8
+ const types_1 = require("./types");
8
9
  const nce = async (args) => {
9
10
  const cliArgs = await args;
10
11
  let context = {
@@ -15,14 +16,14 @@ const nce = async (args) => {
15
16
  quiet: cliArgs.quiet || false,
16
17
  debug: cliArgs.debug || false,
17
18
  engines: cliArgs.engines,
19
+ packageObject: { filename: types_1.packageJSONFilename },
20
+ packageLockObject: { filename: types_1.packageLockJSONFilename },
18
21
  };
19
- const options = Object.assign({}, (0, renderer_1.renderer)({ quiet: context.quiet, debug: context.debug, verbose: context.verbose }));
22
+ const options = Object.assign(Object.assign({}, (0, renderer_1.renderer)({ quiet: context.quiet, debug: context.debug, verbose: context.verbose })), { ctx: context });
20
23
  const debugNamespaces = (0, debug_1.namespaces)();
21
24
  if (context.debug) {
22
25
  (0, debug_1.enableNamespaces)(debugNamespaces);
23
26
  }
24
- const cmd = (0, tasks_1.cliCommandTask)(options, debug_1.debug);
25
- const ctx = context;
26
- return cmd.run(ctx);
27
+ return (0, tasks_1.cliCommandTask)(options, debug_1.debug).run();
27
28
  };
28
29
  exports.nce = nce;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validatePackageLockJSONFn = exports.validatePackageJSONFn = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ajv_draft_04_1 = tslib_1.__importDefault(require("ajv-draft-04"));
6
- const packageJSONSchema = tslib_1.__importStar(require("../schemas/package.json"));
7
- const packageLockJSONSchema = tslib_1.__importStar(require("../schemas/package-lock.json"));
8
6
  const ajv_formats_1 = tslib_1.__importDefault(require("ajv-formats"));
7
+ const packageLockJSONSchema = tslib_1.__importStar(require("../schemas/package-lock.json"));
8
+ const packageJSONSchema = tslib_1.__importStar(require("../schemas/package.json"));
9
9
  const ajv = (0, ajv_formats_1.default)(new ajv_draft_04_1.default({
10
10
  allErrors: true,
11
11
  coerceTypes: true,
package/dist/lib/tasks.js CHANGED
@@ -1,46 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cliCommandTask = exports.checkCommandTasks = exports.updatePackageJson = exports.outputComputedConstraints = exports.computeEnginesConstraints = exports.computeEnginesConstraint = exports.getConstraintFromEngines = exports.loadLockFile = exports.humanizeRange = exports.restrictiveRange = exports.applyMinVersionToRangeSet = exports.setToRange = exports.sortRangeSet = exports.rangeOptions = void 0;
3
+ exports.cliCommandTask = exports.checkCommandTasks = exports.updatePackageJson = exports.outputComputedConstraints = exports.generateUpdateCommandFromContext = exports.computeEnginesConstraints = exports.loadPackageLockFile = exports.loadPackageFile = exports.humanizeRange = exports.restrictiveRange = exports.applyMinVersionToRangeSet = exports.setToRange = exports.sortRangeSet = exports.rangeOptions = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const cli_table_1 = tslib_1.__importDefault(require("cli-table"));
6
+ const colorette_1 = require("colorette");
7
+ const fs_extra_1 = require("fs-extra");
5
8
  const listr2_1 = require("listr2");
6
- const types_1 = require("./types");
7
- const utils_1 = require("./utils");
8
- const json_schema_validator_1 = require("./json-schema-validator");
9
9
  const lodash_1 = require("lodash");
10
- const comparator_1 = tslib_1.__importDefault(require("semver/classes/comparator"));
11
- const compare_1 = tslib_1.__importDefault(require("semver/functions/compare"));
12
- const range_1 = tslib_1.__importDefault(require("semver/classes/range"));
13
- const valid_1 = tslib_1.__importDefault(require("semver/ranges/valid"));
14
- const subset_1 = tslib_1.__importDefault(require("semver/ranges/subset"));
15
- const fs_extra_1 = require("fs-extra");
16
- const sort_package_json_1 = tslib_1.__importDefault(require("sort-package-json"));
17
- const colorette_1 = require("colorette");
18
- const semver_1 = require("semver");
19
10
  const path_1 = require("path");
11
+ const semver_1 = require("semver");
12
+ const sort_package_json_1 = tslib_1.__importDefault(require("sort-package-json"));
13
+ const json_schema_validator_1 = require("./json-schema-validator");
14
+ const types_1 = require("./types");
15
+ const utils_1 = require("./utils");
20
16
  exports.rangeOptions = { loose: false, includePrerelease: false };
21
- const packageJSONFilename = 'package.json';
22
- const packageLockJSONFilename = 'package-lock.json';
23
- const sortRangeSet = (set) => [...set.map(comp => [...comp])].sort((a, b) => (0, compare_1.default)(a[0].semver, b[0].semver));
17
+ const sortRangeSet = (set) => [...set.map(comp => [...comp])].sort((a, b) => (0, semver_1.compare)(a[0].semver, b[0].semver));
24
18
  exports.sortRangeSet = sortRangeSet;
25
- const setToRange = (set) => new range_1.default(set.map(tuple => tuple.map(comp => comp.value).join(' ')).join('||'), exports.rangeOptions);
19
+ const setToRange = (set) => new semver_1.Range(set.map(tuple => tuple.map(comp => comp.value).join(' ')).join('||'), exports.rangeOptions);
26
20
  exports.setToRange = setToRange;
27
21
  const applyMinVersionToRangeSet = (set, minVersion) => [...set.map(comp => [...comp])]
28
22
  .filter(c => c[0].semver.major >= minVersion.major)
29
23
  .map(c => {
30
24
  if (c[0].semver.major === minVersion.major && (0, semver_1.gte)(minVersion, c[0].semver, exports.rangeOptions)) {
31
- c[0] = new comparator_1.default(`${c[0].operator}${minVersion.raw}`);
25
+ c[0] = new semver_1.Comparator(`${c[0].operator}${minVersion.raw}`);
32
26
  }
33
27
  return c;
34
28
  });
35
29
  exports.applyMinVersionToRangeSet = applyMinVersionToRangeSet;
36
30
  const restrictiveRange = (r1, r2, ignoredRanges, debug) => {
37
31
  debug(`${(0, colorette_1.white)('Compare:')} ${(0, colorette_1.blue)(r1.raw)} ${(0, colorette_1.white)('and')} ${(0, colorette_1.blue)(r2.raw)}`);
38
- if ((0, subset_1.default)(r1, r2)) {
32
+ if ((0, semver_1.subset)(r1, r2)) {
39
33
  debug(`${(0, colorette_1.white)('Range')} ${(0, colorette_1.green)(r1.raw)} ${(0, colorette_1.white)('is a subset of')} ${(0, colorette_1.blue)(r2.raw)}`);
40
34
  ignoredRanges.push(r2.raw);
41
35
  return r1;
42
36
  }
43
- else if ((0, subset_1.default)(r2, r1)) {
37
+ else if ((0, semver_1.subset)(r2, r1)) {
44
38
  debug(`${(0, colorette_1.white)('Range')} ${(0, colorette_1.green)(r2.raw)} ${(0, colorette_1.white)('is a subset of')} ${(0, colorette_1.blue)(r1.raw)}`);
45
39
  ignoredRanges.push(r1.raw);
46
40
  return r2;
@@ -50,7 +44,7 @@ const restrictiveRange = (r1, r2, ignoredRanges, debug) => {
50
44
  const sortedR1 = (0, exports.sortRangeSet)(r1.set);
51
45
  const sortedR2 = (0, exports.sortRangeSet)(r2.set);
52
46
  if (!(0, semver_1.eq)(minVersion1, minVersion2, exports.rangeOptions)) {
53
- const minSemver = (0, compare_1.default)(minVersion1, minVersion2) === -1 ? minVersion2 : minVersion1;
47
+ const minSemver = (0, semver_1.compare)(minVersion1, minVersion2) === -1 ? minVersion2 : minVersion1;
54
48
  debug(`${(0, colorette_1.white)('Applying minimal version')} ${(0, colorette_1.yellow)(minSemver.version)} ${(0, colorette_1.white)('to both ranges.')}`);
55
49
  const newR1 = (0, exports.setToRange)((0, exports.applyMinVersionToRangeSet)(sortedR1, minSemver));
56
50
  const newR2 = (0, exports.setToRange)((0, exports.applyMinVersionToRangeSet)(sortedR2, minSemver));
@@ -76,8 +70,8 @@ const restrictiveRange = (r1, r2, ignoredRanges, debug) => {
76
70
  };
77
71
  exports.restrictiveRange = restrictiveRange;
78
72
  const humanizeRange = (range) => {
79
- if (!range) {
80
- return;
73
+ if (!range || '*' === range.raw) {
74
+ return '*';
81
75
  }
82
76
  const res = [];
83
77
  const set = (0, exports.sortRangeSet)(range.set);
@@ -99,22 +93,46 @@ const humanizeRange = (range) => {
99
93
  return res.join(' || ');
100
94
  };
101
95
  exports.humanizeRange = humanizeRange;
102
- const loadLockFile = async ({ ctx }) => {
96
+ const loadFile = async ({ fileObject, path, workingDir, debug, validateFn, }) => {
103
97
  var _a;
104
- const { path, workingDir } = ctx;
105
- const pathToFile = (0, utils_1.joinPath)(path || '', packageLockJSONFilename);
98
+ const pathToFile = (0, utils_1.joinPath)(path, fileObject.filename);
106
99
  const relativePath = (0, utils_1.getRelativePath)({ path: pathToFile, workingDir });
107
- const packageLockJSON = await (0, utils_1.getJson)(relativePath).catch(() => undefined);
108
- if (!packageLockJSON) {
100
+ debug(`${(0, colorette_1.white)(`Relative path to ${fileObject.filename}:`)} ${(0, colorette_1.blue)(relativePath)}`);
101
+ const jsonObject = await (0, utils_1.getJson)(relativePath).catch(() => undefined);
102
+ if (!jsonObject) {
109
103
  throw new Error(`${relativePath} is not defined.`);
110
104
  }
111
- const packageLockData = (0, json_schema_validator_1.validatePackageLockJSONFn)(packageLockJSON);
112
- if (!packageLockData) {
113
- throw new Error((_a = json_schema_validator_1.validatePackageLockJSONFn.errors) === null || _a === void 0 ? void 0 : _a.map(e => e.message).join('\n'));
105
+ debug(`${(0, colorette_1.white)(`Validate JSON schema of`)} ${(0, colorette_1.blue)(relativePath)}`);
106
+ const data = validateFn(jsonObject);
107
+ if (!data) {
108
+ throw new Error((_a = validateFn.errors) === null || _a === void 0 ? void 0 : _a.map(e => e.message).join('\n'));
114
109
  }
115
- ctx.packageLockObject = packageLockJSON;
110
+ fileObject.relativePath = relativePath;
111
+ fileObject.data = jsonObject;
112
+ return fileObject;
116
113
  };
117
- exports.loadLockFile = loadLockFile;
114
+ const loadPackageFile = async ({ ctx, debug }) => {
115
+ const { path, workingDir, packageObject } = ctx;
116
+ ctx.packageObject = await loadFile({
117
+ fileObject: packageObject,
118
+ path,
119
+ debug,
120
+ workingDir,
121
+ validateFn: json_schema_validator_1.validatePackageJSONFn,
122
+ });
123
+ };
124
+ exports.loadPackageFile = loadPackageFile;
125
+ const loadPackageLockFile = async ({ ctx, debug }) => {
126
+ const { path, workingDir, packageLockObject } = ctx;
127
+ ctx.packageLockObject = await loadFile({
128
+ fileObject: packageLockObject,
129
+ path,
130
+ debug,
131
+ workingDir,
132
+ validateFn: json_schema_validator_1.validatePackageLockJSONFn,
133
+ });
134
+ };
135
+ exports.loadPackageLockFile = loadPackageLockFile;
118
136
  const getConstraintFromEngines = (engines, constraintKey) => {
119
137
  var _a;
120
138
  if (typeof engines === 'object' && constraintKey in engines) {
@@ -125,19 +143,18 @@ const getConstraintFromEngines = (engines, constraintKey) => {
125
143
  }
126
144
  return undefined;
127
145
  };
128
- exports.getConstraintFromEngines = getConstraintFromEngines;
129
146
  const computeEnginesConstraint = ({ packages, constraintKey, debug, }) => {
130
- let mrr;
147
+ let mrr = new semver_1.Range('*');
131
148
  const ignoredRanges = [];
132
149
  const debugConstraint = debug.extend(constraintKey);
133
150
  for (const [pkgName, pkg] of packages) {
134
151
  const { engines } = pkg;
135
- let constraint = (0, exports.getConstraintFromEngines)(engines, constraintKey);
152
+ let constraint = getConstraintFromEngines(engines, constraintKey);
136
153
  if (!constraint) {
137
154
  debugConstraint(`${(0, colorette_1.white)('Package')} ${(0, colorette_1.gray)(pkgName)} ${(0, colorette_1.white)('has no constraints for current engine')}`);
138
155
  continue;
139
156
  }
140
- const rawValidRange = (0, valid_1.default)(constraint);
157
+ const rawValidRange = (0, semver_1.validRange)(constraint);
141
158
  if (!rawValidRange) {
142
159
  debugConstraint(`${(0, colorette_1.red)(constraint)} ${(0, colorette_1.white)('is not a valid semver range')}`);
143
160
  continue;
@@ -146,7 +163,7 @@ const computeEnginesConstraint = ({ packages, constraintKey, debug, }) => {
146
163
  debugConstraint(`${(0, colorette_1.white)('Ignored range:')} ${(0, colorette_1.gray)(rawValidRange)}`);
147
164
  continue;
148
165
  }
149
- const range = new range_1.default(rawValidRange, exports.rangeOptions);
166
+ const range = new semver_1.Range(rawValidRange, exports.rangeOptions);
150
167
  if (!mrr) {
151
168
  mrr = range;
152
169
  debugConstraint(`${(0, colorette_1.white)('New most restrictive range:')} ${(0, colorette_1.green)(mrr.raw)}`);
@@ -166,78 +183,160 @@ const computeEnginesConstraint = ({ packages, constraintKey, debug, }) => {
166
183
  }
167
184
  return mrr;
168
185
  };
169
- exports.computeEnginesConstraint = computeEnginesConstraint;
170
186
  const computeEnginesConstraints = ({ ctx, debug }) => {
171
- const { packageLockObject, engines } = ctx;
172
- if (!packageLockObject) {
173
- throw new Error(`${packageLockJSONFilename} data is not defined.`);
187
+ const { packageObject, packageLockObject, engines } = ctx;
188
+ if (!packageObject.data) {
189
+ throw new Error(`${packageObject.filename} data is not defined.`);
190
+ }
191
+ if (!packageLockObject.data) {
192
+ throw new Error(`${packageLockObject.filename} data is not defined.`);
174
193
  }
175
- if (!('packages' in packageLockObject)) {
176
- throw new Error(`${packageLockJSONFilename} does not contain packages property.`);
194
+ if (!('packages' in packageLockObject.data)) {
195
+ throw new Error(`${packageLockObject.filename} does not contain packages property.`);
177
196
  }
178
197
  const filterEngineConstraintKey = (key) => -1 !== types_1.EngineConstraintKeys.indexOf(key);
179
- const packages = Object.entries(packageLockObject.packages);
198
+ const packages = Object.entries(packageLockObject.data.packages);
180
199
  const ranges = new Map();
181
200
  const constraintKeys = (engines === null || engines === void 0 ? void 0 : engines.filter(filterEngineConstraintKey)) || [...types_1.EngineConstraintKeys];
182
201
  if (0 === constraintKeys.length) {
183
202
  throw new Error(`No valid constraint key(s).`);
184
203
  }
185
204
  for (const constraintKey of constraintKeys) {
186
- ranges.set(constraintKey, (0, exports.computeEnginesConstraint)({ packages, constraintKey, debug }));
205
+ ranges.set(constraintKey, {
206
+ from: computeEnginesConstraint({
207
+ packages: [['', { engines: packageObject.data.engines || {} }]],
208
+ constraintKey,
209
+ debug,
210
+ }),
211
+ to: computeEnginesConstraint({ packages, constraintKey, debug }),
212
+ });
187
213
  }
188
214
  ctx.ranges = ranges;
189
215
  };
190
216
  exports.computeEnginesConstraints = computeEnginesConstraints;
217
+ const createEnginesTable = (colWidths) => {
218
+ return new cli_table_1.default({
219
+ style: {
220
+ head: [],
221
+ border: [],
222
+ compact: false,
223
+ 'padding-left': 1,
224
+ 'padding-right': 1,
225
+ },
226
+ colWidths,
227
+ colAligns: ['left', 'left', 'left', 'left'],
228
+ chars: {
229
+ top: '',
230
+ 'top-mid': '',
231
+ 'top-left': '',
232
+ 'top-right': '',
233
+ bottom: '',
234
+ 'bottom-mid': '',
235
+ 'bottom-left': '',
236
+ 'bottom-right': '',
237
+ left: '',
238
+ 'left-mid': '',
239
+ mid: '',
240
+ 'mid-mid': '',
241
+ right: '',
242
+ 'right-mid': '',
243
+ middle: '',
244
+ },
245
+ });
246
+ };
247
+ const generateUpdateCommandFromContext = (ctx) => {
248
+ const argv = ['nce'];
249
+ let path = undefined;
250
+ if (typeof ctx.path === 'string' && ctx.path.length > 0) {
251
+ path = (0, utils_1.getRelativePath)({ path: ctx.path, workingDir: ctx.workingDir });
252
+ }
253
+ if (typeof path === 'string' && path.length > 0) {
254
+ argv.push(...['-p', path]);
255
+ }
256
+ if (ctx.engines) {
257
+ argv.push(...ctx.engines.map(e => ['-e', e]).flat());
258
+ }
259
+ if (ctx.quiet) {
260
+ argv.push('-q');
261
+ }
262
+ if (ctx.debug) {
263
+ argv.push('-d');
264
+ }
265
+ if (ctx.verbose) {
266
+ argv.push('-v');
267
+ }
268
+ argv.push('-u');
269
+ return argv.join(' ');
270
+ };
271
+ exports.generateUpdateCommandFromContext = generateUpdateCommandFromContext;
191
272
  const outputComputedConstraints = ({ ctx, parent, debug }) => {
192
- const { ranges } = ctx;
273
+ const { ranges, packageObject, update } = ctx;
193
274
  if (!ranges) {
194
275
  throw new Error(`Computed engines range constraints are not defined.`);
195
276
  }
196
277
  const rangesSimplified = new Map();
197
- let title = `Computed engines range constraints:`;
198
- for (const [key, range] of ranges.entries()) {
199
- const rangeHumanized = (0, exports.humanizeRange)(range);
200
- if (!rangeHumanized) {
278
+ const arrowSeparator = '→';
279
+ let colWidths = [2, 2, 2, 2];
280
+ let colValues = [];
281
+ for (const [engine, range] of ranges.entries()) {
282
+ const rangeToHumanized = (0, exports.humanizeRange)(range.to);
283
+ const rangeFromHumanized = (0, exports.humanizeRange)(range.from);
284
+ if (rangeToHumanized === rangeFromHumanized) {
201
285
  continue;
202
286
  }
203
- rangesSimplified.set(key, rangeHumanized);
204
- debug.extend(key)(`${(0, colorette_1.white)(`Simplified computed engine range constraint:`)} ${(0, colorette_1.blue)(rangeHumanized)}`);
205
- title += `\n${!ctx.debug ? ' ' : ''}- ${(0, colorette_1.yellow)(key)}: ${(0, colorette_1.blue)(rangeHumanized)}`;
287
+ rangesSimplified.set(engine, rangeToHumanized);
288
+ debug.extend(engine)(`${(0, colorette_1.white)(`Simplified computed engine range constraint:`)} ${(0, colorette_1.blue)(rangeToHumanized)}`);
289
+ colWidths = [
290
+ Math.max(colWidths[0], engine.length + 2),
291
+ Math.max(colWidths[1], rangeFromHumanized.length + 2),
292
+ arrowSeparator.length + 2,
293
+ Math.max(colWidths[3], rangeToHumanized.length + 2),
294
+ ];
295
+ colValues.push([engine, rangeFromHumanized, arrowSeparator, rangeToHumanized]);
206
296
  }
207
297
  if (0 === rangesSimplified.size) {
208
- throw new Error('Simplified engines range constraints are not defined.');
298
+ parent.title = `All computed engines range constraints are up-to-date ${(0, colorette_1.green)(':)')}`;
299
+ }
300
+ else {
301
+ const table = createEnginesTable(colWidths);
302
+ table.push(...colValues);
303
+ let title = `Computed engines range constraints:\n\n${table.toString()}`;
304
+ if (!update) {
305
+ title += `\n\nRun ${(0, colorette_1.cyan)((0, exports.generateUpdateCommandFromContext)(ctx))} to upgrade ${packageObject.filename}.`;
306
+ }
307
+ parent.title = title;
209
308
  }
210
- parent.title = title;
211
309
  ctx.rangesSimplified = rangesSimplified;
212
310
  };
213
311
  exports.outputComputedConstraints = outputComputedConstraints;
214
312
  const updatePackageJson = async ({ ctx, debug }) => {
215
- var _a;
216
- const { path, workingDir, rangesSimplified } = ctx;
313
+ const { packageObject, rangesSimplified } = ctx;
217
314
  if (!rangesSimplified) {
218
315
  throw new Error(`Simplified computed engines range constraints are not defined.`);
219
316
  }
220
- const pathToFile = (0, utils_1.joinPath)(path, packageJSONFilename);
221
- const relativePath = (0, utils_1.getRelativePath)({ path: pathToFile, workingDir });
222
- debug(`${(0, colorette_1.white)(`Relative path to ${packageJSONFilename}:`)} ${(0, colorette_1.blue)(relativePath)}`);
223
- const packageJSON = await (0, utils_1.getJson)(relativePath).catch(() => undefined);
224
- if (!packageJSON) {
225
- throw new Error(`${relativePath} is not defined.`);
317
+ if (!packageObject.data) {
318
+ throw new Error(`${packageObject.filename} data is not defined.`);
226
319
  }
227
- debug(`${(0, colorette_1.white)(`Validate JSON schema of`)} ${(0, colorette_1.blue)(relativePath)}`);
228
- let packageLockData = (0, json_schema_validator_1.validatePackageJSONFn)(packageJSON);
229
- if (!packageLockData) {
230
- throw new Error((_a = json_schema_validator_1.validatePackageJSONFn.errors) === null || _a === void 0 ? void 0 : _a.map(e => e.message).join('\n'));
320
+ if (!packageObject.relativePath) {
321
+ throw new Error(`${packageObject.filename} path is not defined.`);
231
322
  }
232
- packageJSON.engines = (0, lodash_1.merge)({}, packageJSON.engines, Object.fromEntries(rangesSimplified));
233
- debug(`${(0, colorette_1.white)(`Write JSON to`)} ${(0, colorette_1.blue)(relativePath)}`);
234
- return (0, fs_extra_1.writeJson)(relativePath, (0, sort_package_json_1.default)(packageJSON), { encoding: 'utf8', replacer: null, spaces: 2 });
323
+ packageObject.data.engines = (0, lodash_1.merge)({}, packageObject.data.engines, Object.fromEntries(rangesSimplified));
324
+ debug(`${(0, colorette_1.white)(`Write JSON to`)} ${(0, colorette_1.blue)(packageObject.relativePath)}`);
325
+ return (0, fs_extra_1.writeJson)(packageObject.relativePath, (0, sort_package_json_1.default)(packageObject.data), {
326
+ encoding: 'utf8',
327
+ replacer: null,
328
+ spaces: 2,
329
+ });
235
330
  };
236
331
  exports.updatePackageJson = updatePackageJson;
237
- const checkCommandTasks = (parent, debug) => [
332
+ const checkCommandTasks = ({ context, parent, debug, }) => [
238
333
  {
239
- title: `Load ${packageLockJSONFilename} file...`,
240
- task: (ctx, task) => (0, exports.loadLockFile)({ ctx, task, parent, debug }),
334
+ title: `Load ${context.packageObject.filename} file...`,
335
+ task: (ctx, task) => (0, exports.loadPackageFile)({ ctx, task, parent, debug }),
336
+ },
337
+ {
338
+ title: `Load ${context.packageLockObject.filename} file...`,
339
+ task: (ctx, task) => (0, exports.loadPackageLockFile)({ ctx, task, parent, debug }),
241
340
  },
242
341
  {
243
342
  title: 'Compute engines range constraints...',
@@ -248,21 +347,24 @@ const checkCommandTasks = (parent, debug) => [
248
347
  task: (ctx, task) => (0, exports.outputComputedConstraints)({ ctx, task, parent, debug }),
249
348
  },
250
349
  {
251
- title: `Update ${packageJSONFilename} file...`,
350
+ title: `Update ${context.packageObject.filename} file...`,
252
351
  skip: ({ update }) => (!update ? 'Update is disabled by default.' : !update),
253
352
  task: (ctx, task) => (0, exports.updatePackageJson)({ ctx, task, parent, debug }),
254
353
  },
255
354
  ];
256
355
  exports.checkCommandTasks = checkCommandTasks;
257
- const cliCommandTask = (options, debug) => new listr2_1.Listr([
258
- {
259
- title: 'Checking npm package engines range constraints in package-lock.json file...',
260
- task: (ctx, task) => {
261
- const { path, workingDir } = ctx;
262
- const completePath = (0, utils_1.joinPath)(workingDir, path, packageLockJSONFilename);
263
- task.title = `Checking npm package engines range constraints in ${completePath.replace(`${workingDir}${path_1.sep}`, '')} file...`;
264
- return task.newListr(parent => (0, exports.checkCommandTasks)(parent, debug));
356
+ const cliCommandTask = (options, debug) => {
357
+ var _a;
358
+ return new listr2_1.Listr([
359
+ {
360
+ title: `Checking npm package engines range constraints in ${(_a = options.ctx) === null || _a === void 0 ? void 0 : _a.packageLockObject.filename} file...`,
361
+ task: (ctx, task) => {
362
+ const { path, workingDir, packageLockObject } = ctx;
363
+ const completePath = (0, utils_1.joinPath)(workingDir, path, packageLockObject.filename);
364
+ task.title = `Checking npm package engines range constraints in ${completePath.replace(`${workingDir}${path_1.sep}`, '')} file...`;
365
+ return task.newListr(parent => (0, exports.checkCommandTasks)({ context: ctx, parent, debug }));
366
+ },
265
367
  },
266
- },
267
- ], options);
368
+ ], options);
369
+ };
268
370
  exports.cliCommandTask = cliCommandTask;
package/dist/lib/types.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EngineConstraintKeys = void 0;
3
+ exports.EngineConstraintKeys = exports.packageLockJSONFilename = exports.packageJSONFilename = void 0;
4
+ exports.packageJSONFilename = 'package.json';
5
+ exports.packageLockJSONFilename = 'package-lock.json';
4
6
  exports.EngineConstraintKeys = ['node', 'npm', 'yarn'];
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@smarlhens/npm-check-engines",
3
+ "version": "0.7.0",
4
+ "description": "Node.JS engines constraint checker written in TypeScript.",
5
+ "keywords": [
6
+ "node",
7
+ "npm",
8
+ "engines",
9
+ "typescript"
10
+ ],
11
+ "homepage": "https://github.com/smarlhens/npm-check-engines#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/smarlhens/npm-check-engines/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/smarlhens/npm-check-engines.git"
18
+ },
19
+ "license": "MIT",
20
+ "author": {
21
+ "name": "Samuel MARLHENS",
22
+ "email": "samuel.marlhens@gmail.com",
23
+ "url": "https://github.com/smarlhens"
24
+ },
25
+ "bin": {
26
+ "nce": "./dist/bin/nce.js",
27
+ "npm-check-engines": "./dist/bin/nce.js"
28
+ },
29
+ "scripts": {
30
+ "prebuild": "rimraf dist",
31
+ "build": "tsc",
32
+ "dev": "ts-node ./bin/nce.ts",
33
+ "postinstall": "npm run sort-package-json",
34
+ "lint": "npm run prettier:check",
35
+ "lint-staged": "lint-staged",
36
+ "precommit": "npm run lint-staged && npm run build",
37
+ "prepare": "husky install",
38
+ "prettier:check": "prettier --check ./**/*.{ts,json,yml,md}",
39
+ "prettier:write": "prettier --write ./**/*.{ts,json,yml,md}",
40
+ "sort-package-json": "sort-package-json",
41
+ "test": "jest --watchAll=false",
42
+ "test:ci": "npm run test:coverage",
43
+ "test:coverage": "npm run test -- --coverage",
44
+ "test:e2e": "npm run test -- --selectProjects e2e",
45
+ "test:e2e:coverage": "npm run test:e2e -- --coverage",
46
+ "test:unit": "npm run test -- --selectProjects unit",
47
+ "test:unit:coverage": "npm run test:unit -- --coverage",
48
+ "test:watch": "jest"
49
+ },
50
+ "dependencies": {
51
+ "ajv": "8.11.0",
52
+ "ajv-draft-04": "1.0.0",
53
+ "ajv-formats": "2.1.1",
54
+ "cli-table": "0.3.11",
55
+ "colorette": "2.0.19",
56
+ "debug": "4.3.4",
57
+ "fs-extra": "10.1.0",
58
+ "listr2": "4.0.5",
59
+ "lodash": "4.17.21",
60
+ "semver": "7.3.7",
61
+ "sort-package-json": "1.57.0",
62
+ "update-notifier": "5.1.0",
63
+ "yargs": "17.5.1"
64
+ },
65
+ "devDependencies": {
66
+ "@babel/core": "7.18.6",
67
+ "@babel/preset-env": "7.18.6",
68
+ "@babel/preset-typescript": "7.18.6",
69
+ "@commitlint/cli": "17.0.3",
70
+ "@commitlint/config-conventional": "17.0.3",
71
+ "@trivago/prettier-plugin-sort-imports": "3.2.0",
72
+ "@types/cli-table": "0.3.0",
73
+ "@types/debug": "4.1.7",
74
+ "@types/fs-extra": "9.0.13",
75
+ "@types/jest": "28.1.4",
76
+ "@types/lodash": "4.14.182",
77
+ "@types/node": "18.0.1",
78
+ "@types/semver": "7.3.10",
79
+ "@types/update-notifier": "5.1.0",
80
+ "@types/yargs": "17.0.10",
81
+ "babel-jest": "28.1.2",
82
+ "execa": "5.1.1",
83
+ "husky": "8.0.1",
84
+ "jest": "28.1.2",
85
+ "lint-staged": "13.0.3",
86
+ "prettier": "2.7.1",
87
+ "rimraf": "3.0.2",
88
+ "ts-node": "10.8.2",
89
+ "tslib": "2.4.0",
90
+ "typescript": "4.7.4"
91
+ },
92
+ "engines": {
93
+ "node": "^14.17.0 || ^16.10.0 || ^18.0.0",
94
+ "npm": ">=6.0.0"
95
+ }
96
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarlhens/npm-check-engines",
3
- "version": "0.4.3",
3
+ "version": "0.7.0",
4
4
  "description": "Node.JS engines constraint checker written in TypeScript.",
5
5
  "keywords": [
6
6
  "node",
@@ -35,8 +35,8 @@
35
35
  "lint-staged": "lint-staged",
36
36
  "precommit": "npm run lint-staged && npm run build",
37
37
  "prepare": "husky install",
38
- "prettier:check": "prettier --check ./**/*.{ts,json,yml}",
39
- "prettier:write": "prettier --write ./**/*.{ts,json,yml}",
38
+ "prettier:check": "prettier --check ./**/*.{ts,json,yml,md}",
39
+ "prettier:write": "prettier --write ./**/*.{ts,json,yml,md}",
40
40
  "sort-package-json": "sort-package-json",
41
41
  "test": "jest --watchAll=false",
42
42
  "test:ci": "npm run test:coverage",
@@ -51,6 +51,7 @@
51
51
  "ajv": "8.11.0",
52
52
  "ajv-draft-04": "1.0.0",
53
53
  "ajv-formats": "2.1.1",
54
+ "cli-table": "0.3.11",
54
55
  "colorette": "2.0.19",
55
56
  "debug": "4.3.4",
56
57
  "fs-extra": "10.1.0",
@@ -58,42 +59,38 @@
58
59
  "lodash": "4.17.21",
59
60
  "semver": "7.3.7",
60
61
  "sort-package-json": "1.57.0",
62
+ "update-notifier": "5.1.0",
61
63
  "yargs": "17.5.1"
62
64
  },
63
65
  "devDependencies": {
64
- "@babel/core": "7.18.5",
65
- "@babel/preset-env": "7.18.2",
66
- "@babel/preset-typescript": "7.17.12",
67
- "@commitlint/cli": "17.0.2",
68
- "@commitlint/config-conventional": "17.0.2",
66
+ "@babel/core": "7.18.6",
67
+ "@babel/preset-env": "7.18.6",
68
+ "@babel/preset-typescript": "7.18.6",
69
+ "@commitlint/cli": "17.0.3",
70
+ "@commitlint/config-conventional": "17.0.3",
71
+ "@trivago/prettier-plugin-sort-imports": "3.2.0",
72
+ "@types/cli-table": "0.3.0",
69
73
  "@types/debug": "4.1.7",
70
74
  "@types/fs-extra": "9.0.13",
71
- "@types/jest": "28.1.2",
75
+ "@types/jest": "28.1.4",
72
76
  "@types/lodash": "4.14.182",
73
- "@types/node": "17.0.36",
77
+ "@types/node": "18.0.1",
74
78
  "@types/semver": "7.3.10",
79
+ "@types/update-notifier": "5.1.0",
75
80
  "@types/yargs": "17.0.10",
76
- "babel-jest": "28.1.1",
77
- "cz-conventional-changelog": "3.3.0",
81
+ "babel-jest": "28.1.2",
78
82
  "execa": "5.1.1",
79
83
  "husky": "8.0.1",
80
- "jest": "28.1.1",
81
- "lint-staged": "13.0.2",
84
+ "jest": "28.1.2",
85
+ "lint-staged": "13.0.3",
82
86
  "prettier": "2.7.1",
83
87
  "rimraf": "3.0.2",
84
- "ts-node": "10.8.1",
88
+ "ts-node": "10.8.2",
85
89
  "tslib": "2.4.0",
86
90
  "typescript": "4.7.4"
87
91
  },
88
92
  "engines": {
89
93
  "node": "^14.17.0 || ^16.10.0 || ^18.0.0",
90
94
  "npm": ">=6.0.0"
91
- },
92
- "publishConfig": {
93
- "tag": "latest"
94
- },
95
- "overrides": {
96
- "minimist": "1.2.6",
97
- "lodash": "4.17.21"
98
95
  }
99
96
  }