@smarlhens/npm-check-engines 0.3.0 → 0.4.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 +49 -0
- package/README.md +2 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/tasks.js +16 -7
- package/dist/lib/types.js +1 -1
- package/dist/lib/yargs.js +5 -0
- package/package.json +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.2](https://github.com/smarlhens/npm-check-engines/compare/v0.4.1...v0.4.2) (2022-06-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Chores
|
|
7
|
+
|
|
8
|
+
* **deps:** update dependency @types/jest to v28.1.1 ([990732b](https://github.com/smarlhens/npm-check-engines/commit/990732b13009c8350232d112822589d7a9f9301c))
|
|
9
|
+
* **deps:** update jest monorepo to v28.1.1 ([a05193b](https://github.com/smarlhens/npm-check-engines/commit/a05193b59324f417241b3e460f0e77fb322a9a5b))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* **readme:** add lgtm badges ([2dac6ac](https://github.com/smarlhens/npm-check-engines/commit/2dac6ac13c2b5568f1b84d3b623343275de3404f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Miscellaneous
|
|
18
|
+
|
|
19
|
+
* **release-please:** remove signoff option ([5ad0155](https://github.com/smarlhens/npm-check-engines/commit/5ad0155693846b1424e5592972aeee072cfddbb3))
|
|
20
|
+
|
|
21
|
+
## [0.4.1](https://github.com/smarlhens/npm-check-engines/compare/v0.4.0...v0.4.1) (2022-06-04)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** update dependency colorette to v2.0.17 ([624217c](https://github.com/smarlhens/npm-check-engines/commit/624217cb2dfdb56149fc29b8461e814f7186902c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Chores
|
|
30
|
+
|
|
31
|
+
* **deps:** move form dependencies to devDependencies ([310248f](https://github.com/smarlhens/npm-check-engines/commit/310248fb9fb5e4b621b73c7784ac49ff415f9d2a))
|
|
32
|
+
* **deps:** update commitlint monorepo to v17.0.2 ([9a05965](https://github.com/smarlhens/npm-check-engines/commit/9a059657a6a5a4a07e48323506a8d47360c7cf15))
|
|
33
|
+
* **deps:** update dependency @types/jest to v28 ([63ce9fc](https://github.com/smarlhens/npm-check-engines/commit/63ce9fce0c86eb37903d790f94dbea01d727ee5d))
|
|
34
|
+
* **deps:** update dependency lint-staged to v13 ([6b92d2e](https://github.com/smarlhens/npm-check-engines/commit/6b92d2eb4715d8832dc91262f500615562343878))
|
|
35
|
+
* **deps:** update dependency ts-node to v10.8.1 ([82538fb](https://github.com/smarlhens/npm-check-engines/commit/82538fbdd2cdb74fba73a6d2080a67706e311ba2))
|
|
36
|
+
* **deps:** update dependency typescript to v4.7.3 ([56913f7](https://github.com/smarlhens/npm-check-engines/commit/56913f7f21c0558564b1d6f43844489ad2fb7084))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Miscellaneous
|
|
40
|
+
|
|
41
|
+
* **release-please:** update changelog-types, add documentation & chores sections ([710a11c](https://github.com/smarlhens/npm-check-engines/commit/710a11cb1c94b06e02d9bfa8399c9d29205ec6a4))
|
|
42
|
+
|
|
43
|
+
## [0.4.0](https://github.com/smarlhens/npm-check-engines/compare/v0.3.0...v0.4.0) (2022-05-31)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* add cli engines option to choose specific engine(s) ([ec06756](https://github.com/smarlhens/npm-check-engines/commit/ec06756f34f0189689bf56670d8ae79c97ec6ce9))
|
|
49
|
+
* add support for npm engine ([ae7df76](https://github.com/smarlhens/npm-check-engines/commit/ae7df76a7a695dd4d26e5ded05ecea3d85bde227))
|
|
50
|
+
* add yarn engine ([69a4268](https://github.com/smarlhens/npm-check-engines/commit/69a4268a948762c942eb2aadf75d8db029da46f5))
|
|
51
|
+
|
|
3
52
|
## [0.3.0](https://github.com/smarlhens/npm-check-engines/compare/v0.2.0...v0.3.0) (2022-05-31)
|
|
4
53
|
|
|
5
54
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# NPM check engines
|
|
2
2
|
|
|
3
3
|
[](https://github.com/smarlhens/npm-check-engines/actions/workflows/ci.yml)
|
|
4
|
+
[](https://lgtm.com/projects/g/smarlhens/npm-check-engines/alerts/)
|
|
5
|
+
[](https://lgtm.com/projects/g/smarlhens/npm-check-engines/context:javascript)
|
|
4
6
|

|
|
5
7
|
[](https://github.com/smarlhens/npm-check-engines)
|
|
6
8
|
[](http://commitizen.github.io/cz-cli/)
|
package/dist/lib/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const nce = async (args) => {
|
|
|
14
14
|
verbose: cliArgs.verbose || false,
|
|
15
15
|
quiet: cliArgs.quiet || false,
|
|
16
16
|
debug: cliArgs.debug || false,
|
|
17
|
+
engines: cliArgs.engines,
|
|
17
18
|
};
|
|
18
19
|
const options = Object.assign({}, (0, renderer_1.renderer)({ quiet: context.quiet, debug: context.debug, verbose: context.verbose }));
|
|
19
20
|
const debugNamespaces = (0, debug_1.namespaces)();
|
package/dist/lib/tasks.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
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;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const listr2_1 = require("listr2");
|
|
6
|
+
const types_1 = require("./types");
|
|
6
7
|
const utils_1 = require("./utils");
|
|
7
8
|
const json_schema_validator_1 = require("./json-schema-validator");
|
|
8
9
|
const lodash_1 = require("lodash");
|
|
@@ -117,7 +118,7 @@ exports.loadLockFile = loadLockFile;
|
|
|
117
118
|
const getConstraintFromEngines = (engines, constraintKey) => {
|
|
118
119
|
var _a;
|
|
119
120
|
if (typeof engines === 'object' && constraintKey in engines) {
|
|
120
|
-
return engines
|
|
121
|
+
return engines[constraintKey];
|
|
121
122
|
}
|
|
122
123
|
else if ((0, lodash_1.isArray)(engines) && engines.some(constraint => constraint.includes(constraintKey))) {
|
|
123
124
|
return (_a = engines.find(constraint => constraint.includes(constraintKey))) === null || _a === void 0 ? void 0 : _a.replace(constraintKey, '');
|
|
@@ -157,25 +158,33 @@ const computeEnginesConstraint = ({ packages, constraintKey, debug, }) => {
|
|
|
157
158
|
debugConstraint(`${(0, colorette_1.white)('New most restrictive range:')} ${(0, colorette_1.green)(mrr.raw)}`);
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
if (
|
|
161
|
-
|
|
161
|
+
if (mrr) {
|
|
162
|
+
debugConstraint(`${(0, colorette_1.white)(`Final computed engine range constraint:`)} ${(0, colorette_1.blue)(mrr.raw)}`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
debugConstraint(`${(0, colorette_1.white)(`No computed engine range constraint`)}`);
|
|
162
166
|
}
|
|
163
|
-
debugConstraint(`${(0, colorette_1.white)(`Final computed engine range constraint:`)} ${(0, colorette_1.blue)(mrr.raw)}`);
|
|
164
167
|
return mrr;
|
|
165
168
|
};
|
|
166
169
|
exports.computeEnginesConstraint = computeEnginesConstraint;
|
|
167
170
|
const computeEnginesConstraints = ({ ctx, debug }) => {
|
|
168
|
-
const { packageLockObject } = ctx;
|
|
171
|
+
const { packageLockObject, engines } = ctx;
|
|
169
172
|
if (!packageLockObject) {
|
|
170
173
|
throw new Error(`${packageLockJSONFilename} data is not defined.`);
|
|
171
174
|
}
|
|
172
175
|
if (!('packages' in packageLockObject)) {
|
|
173
176
|
throw new Error(`${packageLockJSONFilename} does not contain packages property.`);
|
|
174
177
|
}
|
|
178
|
+
const filterEngineConstraintKey = (key) => -1 !== types_1.EngineConstraintKeys.indexOf(key);
|
|
175
179
|
const packages = Object.entries(packageLockObject.packages);
|
|
176
180
|
const ranges = new Map();
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
const constraintKeys = (engines === null || engines === void 0 ? void 0 : engines.filter(filterEngineConstraintKey)) || [...types_1.EngineConstraintKeys];
|
|
182
|
+
if (0 === constraintKeys.length) {
|
|
183
|
+
throw new Error(`No valid constraint key(s).`);
|
|
184
|
+
}
|
|
185
|
+
for (const constraintKey of constraintKeys) {
|
|
186
|
+
ranges.set(constraintKey, (0, exports.computeEnginesConstraint)({ packages, constraintKey, debug }));
|
|
187
|
+
}
|
|
179
188
|
ctx.ranges = ranges;
|
|
180
189
|
};
|
|
181
190
|
exports.computeEnginesConstraints = computeEnginesConstraints;
|
package/dist/lib/types.js
CHANGED
package/dist/lib/yargs.js
CHANGED
|
@@ -34,6 +34,11 @@ exports.cli = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
|
34
34
|
default: false,
|
|
35
35
|
description: 'A little more detailed than the default output.',
|
|
36
36
|
},
|
|
37
|
+
engines: {
|
|
38
|
+
array: true,
|
|
39
|
+
alias: 'e',
|
|
40
|
+
description: 'Select engines to check. Default will check all engines defined.',
|
|
41
|
+
},
|
|
37
42
|
update: {
|
|
38
43
|
boolean: true,
|
|
39
44
|
alias: 'u',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smarlhens/npm-check-engines",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Node.JS engines constraint checker written in TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -51,42 +51,43 @@
|
|
|
51
51
|
"ajv": "8.11.0",
|
|
52
52
|
"ajv-draft-04": "1.0.0",
|
|
53
53
|
"ajv-formats": "2.1.1",
|
|
54
|
-
"colorette": "2.0.
|
|
54
|
+
"colorette": "2.0.17",
|
|
55
55
|
"debug": "4.3.4",
|
|
56
56
|
"fs-extra": "10.1.0",
|
|
57
57
|
"listr2": "4.0.5",
|
|
58
58
|
"lodash": "4.17.21",
|
|
59
|
-
"rimraf": "3.0.2",
|
|
60
59
|
"semver": "7.3.7",
|
|
61
60
|
"sort-package-json": "1.57.0",
|
|
62
|
-
"tslib": "2.4.0",
|
|
63
61
|
"yargs": "17.5.1"
|
|
64
62
|
},
|
|
65
63
|
"devDependencies": {
|
|
66
64
|
"@babel/core": "7.18.2",
|
|
67
65
|
"@babel/preset-env": "7.18.2",
|
|
68
66
|
"@babel/preset-typescript": "7.17.12",
|
|
69
|
-
"@commitlint/cli": "17.0.
|
|
70
|
-
"@commitlint/config-conventional": "17.0.
|
|
67
|
+
"@commitlint/cli": "17.0.2",
|
|
68
|
+
"@commitlint/config-conventional": "17.0.2",
|
|
71
69
|
"@types/debug": "4.1.7",
|
|
72
70
|
"@types/fs-extra": "9.0.13",
|
|
73
|
-
"@types/jest": "
|
|
71
|
+
"@types/jest": "28.1.1",
|
|
74
72
|
"@types/lodash": "4.14.182",
|
|
75
73
|
"@types/node": "17.0.36",
|
|
76
74
|
"@types/semver": "7.3.9",
|
|
77
75
|
"@types/yargs": "17.0.10",
|
|
78
|
-
"babel-jest": "28.1.
|
|
76
|
+
"babel-jest": "28.1.1",
|
|
79
77
|
"cz-conventional-changelog": "3.3.0",
|
|
80
78
|
"execa": "5.1.1",
|
|
81
79
|
"husky": "8.0.1",
|
|
82
|
-
"jest": "28.1.
|
|
83
|
-
"lint-staged": "
|
|
80
|
+
"jest": "28.1.1",
|
|
81
|
+
"lint-staged": "13.0.0",
|
|
84
82
|
"prettier": "2.6.2",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
83
|
+
"rimraf": "3.0.2",
|
|
84
|
+
"ts-node": "10.8.1",
|
|
85
|
+
"tslib": "2.4.0",
|
|
86
|
+
"typescript": "4.7.3"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
|
-
"node": "^14.17.0 || ^16.10.0 || ^18.0.0"
|
|
89
|
+
"node": "^14.17.0 || ^16.10.0 || ^18.0.0",
|
|
90
|
+
"npm": ">=6.0.0"
|
|
90
91
|
},
|
|
91
92
|
"publishConfig": {
|
|
92
93
|
"tag": "latest"
|