syncpack 10.1.0 → 10.2.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/dist/bin-lint/lint-cli.js +3 -2
- package/package.json +1 -1
- package/dist/bin-lint/lint.d.ts +0 -2
- package/dist/bin-lint/lint.js +0 -116
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lintCli = void 0;
|
|
4
4
|
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
+
const lint_semver_ranges_1 = require("../bin-lint-semver-ranges/lint-semver-ranges");
|
|
6
|
+
const list_mismatches_1 = require("../bin-list-mismatches/list-mismatches");
|
|
5
7
|
const get_context_1 = require("../get-context");
|
|
6
8
|
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
7
|
-
const lint_1 = require("./lint");
|
|
8
9
|
function lintCli(input, disk) {
|
|
9
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk),
|
|
10
|
+
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), list_mismatches_1.listMismatches, lint_semver_ranges_1.lintSemverRanges, exit_if_invalid_1.exitIfInvalid);
|
|
10
11
|
}
|
|
11
12
|
exports.lintCli = lintCli;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "syncpack",
|
|
3
3
|
"description": "Consistent dependency versions in large JavaScript Monorepos",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.2.0",
|
|
5
5
|
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"syncpack": "dist/bin.js",
|
package/dist/bin-lint/lint.d.ts
DELETED
package/dist/bin-lint/lint.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.lint = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const get_semver_groups_1 = require("../get-semver-groups");
|
|
10
|
-
const get_version_groups_1 = require("../get-version-groups");
|
|
11
|
-
function lint(ctx) {
|
|
12
|
-
let totalInstances = 0;
|
|
13
|
-
const instanceCounts = {};
|
|
14
|
-
const versionGroups = (0, get_version_groups_1.getVersionGroups)(ctx);
|
|
15
|
-
const versionCounts = {
|
|
16
|
-
BANNED: 0,
|
|
17
|
-
FILTERED_OUT: 0,
|
|
18
|
-
HIGHEST_SEMVER_MISMATCH: 0,
|
|
19
|
-
IGNORED: 0,
|
|
20
|
-
LOWEST_SEMVER_MISMATCH: 0,
|
|
21
|
-
PINNED_MISMATCH: 0,
|
|
22
|
-
SEMVER_UNSATISFIED: 0,
|
|
23
|
-
SNAPPED_TO_MISMATCH: 0,
|
|
24
|
-
UNSUPPORTED_MISMATCH: 0,
|
|
25
|
-
VALID: 0,
|
|
26
|
-
WORKSPACE_MISMATCH: 0,
|
|
27
|
-
WORKSPACE_UNSATISFIED: 0,
|
|
28
|
-
};
|
|
29
|
-
versionGroups.forEach((group) => {
|
|
30
|
-
group.inspect().forEach((report) => {
|
|
31
|
-
if (!report.isValid)
|
|
32
|
-
ctx.isInvalid = true;
|
|
33
|
-
if (!versionCounts[report.status]) {
|
|
34
|
-
versionCounts[report.status] = 0;
|
|
35
|
-
}
|
|
36
|
-
versionCounts[report.status]++;
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
const semverGroups = (0, get_semver_groups_1.getSemverGroups)(ctx);
|
|
40
|
-
const semverCounts = {
|
|
41
|
-
FILTERED_OUT: 0,
|
|
42
|
-
IGNORED: 0,
|
|
43
|
-
VALID: 0,
|
|
44
|
-
WORKSPACE_SEMVER_RANGE_MISMATCH: 0,
|
|
45
|
-
SEMVER_RANGE_MISMATCH: 0,
|
|
46
|
-
UNSUPPORTED_VERSION: 0,
|
|
47
|
-
};
|
|
48
|
-
semverGroups.forEach((group) => {
|
|
49
|
-
group.inspect().forEach((report) => {
|
|
50
|
-
const status = report.status;
|
|
51
|
-
const strategyName = report.instance.strategy.name;
|
|
52
|
-
if (!report.isValid)
|
|
53
|
-
ctx.isInvalid = true;
|
|
54
|
-
if (!semverCounts[status])
|
|
55
|
-
semverCounts[status] = 0;
|
|
56
|
-
semverCounts[status]++;
|
|
57
|
-
if (!instanceCounts[strategyName])
|
|
58
|
-
instanceCounts[strategyName] = 0;
|
|
59
|
-
instanceCounts[strategyName]++;
|
|
60
|
-
totalInstances++;
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
const fileCount = ctx.packageJsonFiles.length;
|
|
64
|
-
info(fileCount, `package.json file${fileCount > 1 ? 's' : ''}`);
|
|
65
|
-
info(totalInstances, 'total dependences');
|
|
66
|
-
Object.entries(instanceCounts).forEach(([name, count]) => {
|
|
67
|
-
info(count, `in package.${name
|
|
68
|
-
.replace(/^dev$/, 'devDependencies')
|
|
69
|
-
.replace(/^peer$/, 'peerDependencies')
|
|
70
|
-
.replace(/^pnpmOverrides$/, 'pnpm.overrides')
|
|
71
|
-
.replace(/^prod$/, 'dependencies')
|
|
72
|
-
.replace(/^workspace$/, 'version')}`);
|
|
73
|
-
});
|
|
74
|
-
console.log(chalk_1.default.blue('Version mismatches'));
|
|
75
|
-
expectSome(versionCounts.VALID, 'are valid');
|
|
76
|
-
expectNone(versionCounts.HIGHEST_SEMVER_MISMATCH, 'should have matching versions (prefer highest semver)');
|
|
77
|
-
expectNone(versionCounts.LOWEST_SEMVER_MISMATCH, 'should have matching versions (prefer lowest semver)');
|
|
78
|
-
expectNone(versionCounts.WORKSPACE_MISMATCH, 'should match workspace package version');
|
|
79
|
-
expectNone(versionCounts.BANNED, 'are banned from use');
|
|
80
|
-
expectNone(versionCounts.PINNED_MISMATCH, 'should be pinned to a specific version');
|
|
81
|
-
expectNone(versionCounts.SNAPPED_TO_MISMATCH, 'should snap to version used by another package');
|
|
82
|
-
info(versionCounts.FILTERED_OUT, 'are filtered out');
|
|
83
|
-
info(versionCounts.IGNORED, 'are ignored');
|
|
84
|
-
info(versionCounts.UNSUPPORTED_MISMATCH, 'have unsupported version format');
|
|
85
|
-
console.log(chalk_1.default.blue('Semver range mismatches'));
|
|
86
|
-
expectSome(semverCounts.VALID, 'are valid');
|
|
87
|
-
expectNone(semverCounts.SEMVER_RANGE_MISMATCH, 'should use specific semver range');
|
|
88
|
-
expectNone(semverCounts.WORKSPACE_SEMVER_RANGE_MISMATCH, 'should use exact version in version property of package.json');
|
|
89
|
-
info(semverCounts.FILTERED_OUT, 'are filtered out');
|
|
90
|
-
info(semverCounts.IGNORED, 'are ignored');
|
|
91
|
-
info(semverCounts.UNSUPPORTED_VERSION, 'have unsupported version format');
|
|
92
|
-
return ctx;
|
|
93
|
-
function expectNone(count = 0, ...rest) {
|
|
94
|
-
if (count === 0) {
|
|
95
|
-
console.log(chalk_1.default.dim(constants_1.ICON.skip), pad(count), ...rest);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
console.log(chalk_1.default.red(constants_1.ICON.cross, pad(count), ...rest));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function expectSome(count = 0, ...rest) {
|
|
102
|
-
if (count > 0) {
|
|
103
|
-
console.log(chalk_1.default.dim(constants_1.ICON.skip), pad(count), ...rest);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
console.log(chalk_1.default.red(constants_1.ICON.cross, pad(count), ...rest));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function info(count = 0, ...rest) {
|
|
110
|
-
console.log(chalk_1.default.dim(constants_1.ICON.skip), pad(count), ...rest);
|
|
111
|
-
}
|
|
112
|
-
function pad(count) {
|
|
113
|
-
return String(count).padStart(String(totalInstances).length, ' ');
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.lint = lint;
|