syncpack 9.3.2 → 9.8.4
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-fix-mismatches/fix-mismatches-cli.js +4 -4
- package/dist/bin-fix-mismatches/fix-mismatches.js +17 -15
- package/dist/bin-fix-mismatches/index.js +50 -48
- package/dist/bin-format/format-cli.js +4 -4
- package/dist/bin-format/format.js +20 -18
- package/dist/bin-format/index.js +43 -46
- package/dist/bin-lint-semver-ranges/index.js +59 -48
- package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.js +4 -4
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +13 -35
- package/dist/bin-list/index.js +43 -46
- package/dist/bin-list/list-cli.js +4 -4
- package/dist/bin-list/list.js +26 -29
- package/dist/bin-list-mismatches/index.js +46 -47
- package/dist/bin-list-mismatches/list-mismatches-cli.js +4 -4
- package/dist/bin-list-mismatches/list-mismatches.js +55 -40
- package/dist/bin-set-semver-ranges/index.js +62 -49
- package/dist/bin-set-semver-ranges/set-semver-ranges-cli.js +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +4 -4
- package/dist/bin.js +8 -8
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +6 -5
- package/dist/get-context/$R.js +14 -36
- package/dist/get-context/get-config/get-core-types.js +11 -41
- package/dist/get-context/get-config/get-custom-types.js +7 -19
- package/dist/get-context/get-config/get-enabled-types.js +9 -11
- package/dist/get-context/get-config/index.d.ts +3 -1
- package/dist/get-context/get-config/index.js +37 -61
- package/dist/get-context/get-config/path-strategy/index.js +8 -8
- package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.js +6 -6
- package/dist/get-context/get-config/path-strategy/name-and-version-props.js +23 -49
- package/dist/get-context/get-config/path-strategy/name-and-version-string.js +26 -42
- package/dist/get-context/get-config/path-strategy/types.js +1 -1
- package/dist/get-context/get-config/path-strategy/version-string.js +25 -41
- package/dist/get-context/get-config/path-strategy/versions-by-name.js +14 -30
- package/dist/get-context/get-config/schema/base-group.d.ts +2 -2
- package/dist/get-context/get-config/schema/base-group.js +5 -5
- package/dist/get-context/get-config/schema/index.d.ts +292 -164
- package/dist/get-context/get-config/schema/index.js +40 -63
- package/dist/get-context/get-config/schema/lib/non-empty-string.d.ts +2 -0
- package/dist/get-context/get-config/schema/lib/non-empty-string.js +5 -0
- package/dist/get-context/get-config/schema/paths.js +12 -12
- package/dist/get-context/get-config/schema/semver-group.d.ts +24 -24
- package/dist/get-context/get-config/schema/semver-group.js +11 -18
- package/dist/get-context/get-config/schema/semver-range.js +4 -4
- package/dist/get-context/get-config/schema/version-group.d.ts +90 -41
- package/dist/get-context/get-config/schema/version-group.js +28 -23
- package/dist/get-context/get-groups/base-group.d.ts +4 -1
- package/dist/get-context/get-groups/base-group.js +18 -19
- package/dist/get-context/get-groups/index.d.ts +7 -3
- package/dist/get-context/get-groups/index.js +42 -38
- package/dist/get-context/get-groups/semver-group.d.ts +0 -1
- package/dist/get-context/get-groups/semver-group.js +23 -66
- package/dist/get-context/get-groups/version-group/index.d.ts +7 -4
- package/dist/get-context/get-groups/version-group/index.js +31 -70
- package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.d.ts +3 -1
- package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.js +36 -45
- package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.d.ts +3 -0
- package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.js +44 -0
- package/dist/get-context/get-groups/version-group/instance-group/index.d.ts +16 -5
- package/dist/get-context/get-groups/version-group/instance-group/index.js +66 -54
- package/dist/get-context/get-groups/version-group/instance-group/lib/clean.d.ts +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/clean.js +13 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.d.ts +4 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.js +38 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/get-range-score.d.ts +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/get-range-score.js +23 -0
- package/dist/get-context/get-package-json-files/get-file-paths.js +18 -19
- package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.js +9 -12
- package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.js +9 -11
- package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.js +10 -13
- package/dist/get-context/get-package-json-files/get-patterns/index.js +15 -42
- package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.js +4 -6
- package/dist/get-context/get-package-json-files/get-patterns/props.js +9 -33
- package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.js +6 -9
- package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.js +4 -4
- package/dist/get-context/get-package-json-files/index.d.ts +3 -1
- package/dist/get-context/get-package-json-files/index.js +8 -8
- package/dist/get-context/get-package-json-files/package-json-file/index.js +32 -55
- package/dist/get-context/get-package-json-files/package-json-file/instance.d.ts +2 -1
- package/dist/get-context/get-package-json-files/package-json-file/instance.js +15 -15
- package/dist/get-context/index.d.ts +3 -2
- package/dist/get-context/index.js +28 -24
- package/dist/lib/disk.js +28 -29
- package/dist/lib/error.js +13 -31
- package/dist/lib/exit-if-invalid.js +1 -1
- package/dist/lib/is-semver.d.ts +1 -1
- package/dist/lib/is-semver.js +15 -7
- package/dist/lib/log.js +38 -58
- package/dist/lib/newlines.js +11 -11
- package/dist/lib/print-strings.js +2 -2
- package/dist/lib/set-semver-range.js +8 -8
- package/dist/lib/show-help-on-error.js +31 -8
- package/dist/lib/sort-by-name.js +1 -1
- package/dist/lib/write-if-changed.js +3 -3
- package/dist/option.js +8 -13
- package/dist/types.d.ts +3 -1
- package/dist/types.js +1 -1
- package/package.json +20 -16
- package/dist/get-context/get-all-instances.d.ts +0 -3
- package/dist/get-context/get-all-instances.js +0 -8
package/dist/bin-list/index.js
CHANGED
|
@@ -1,59 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
4
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
5
|
-
return cooked;
|
|
6
|
-
};
|
|
7
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
8
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
9
|
-
if (!m) return o;
|
|
10
|
-
var i = m.call(o), r, ar = [], e;
|
|
11
|
-
try {
|
|
12
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
13
|
-
}
|
|
14
|
-
catch (error) { e = { error: error }; }
|
|
15
|
-
finally {
|
|
16
|
-
try {
|
|
17
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
18
|
-
}
|
|
19
|
-
finally { if (e) throw e.error; }
|
|
20
|
-
}
|
|
21
|
-
return ar;
|
|
22
|
-
};
|
|
23
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
-
if (ar || !(i in from)) {
|
|
26
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
-
ar[i] = from[i];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
-
};
|
|
32
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
5
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var list_cli_1 = require("./list-cli");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const disk_1 = require("../lib/disk");
|
|
10
|
+
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
11
|
+
const option_1 = require("../option");
|
|
12
|
+
const list_cli_1 = require("./list-cli");
|
|
43
13
|
commander_1.program.description(' List all dependencies required by your packages.');
|
|
44
|
-
commander_1.program.on('--help',
|
|
45
|
-
console.log((0, chalk_1
|
|
14
|
+
commander_1.program.on('--help', () => {
|
|
15
|
+
console.log((0, chalk_1.default) `
|
|
16
|
+
Examples:
|
|
17
|
+
{dim # uses defaults for resolving packages}
|
|
18
|
+
syncpack list
|
|
19
|
+
{dim # uses packages defined by --source when provided}
|
|
20
|
+
syncpack list --source {yellow "apps/*/package.json"}
|
|
21
|
+
{dim # multiple globs can be provided like this}
|
|
22
|
+
syncpack list --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
23
|
+
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
24
|
+
syncpack list --filter {yellow "typescript|tslint"}
|
|
25
|
+
{dim # only inspect "devDependencies"}
|
|
26
|
+
syncpack list --types dev
|
|
27
|
+
{dim # only inspect "devDependencies" and "peerDependencies"}
|
|
28
|
+
syncpack list --types dev,peer
|
|
29
|
+
|
|
30
|
+
Resolving Packages:
|
|
31
|
+
1. If {yellow --source} globs are provided, use those.
|
|
32
|
+
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
33
|
+
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
34
|
+
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
35
|
+
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
36
|
+
|
|
37
|
+
Reference:
|
|
38
|
+
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
39
|
+
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
40
|
+
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
41
|
+
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
42
|
+
`);
|
|
46
43
|
});
|
|
47
44
|
(0, show_help_on_error_1.showHelpOnError)(commander_1.program);
|
|
48
|
-
|
|
49
|
-
.option
|
|
50
|
-
.option
|
|
51
|
-
.option
|
|
52
|
-
.option
|
|
45
|
+
commander_1.program
|
|
46
|
+
.option(...option_1.option.source)
|
|
47
|
+
.option(...option_1.option.filter)
|
|
48
|
+
.option(...option_1.option.config)
|
|
49
|
+
.option(...option_1.option.types)
|
|
50
|
+
.parse(process.argv);
|
|
53
51
|
(0, list_cli_1.listCli)({
|
|
54
52
|
configPath: commander_1.program.opts().config,
|
|
55
53
|
filter: commander_1.program.opts().filter,
|
|
56
54
|
source: commander_1.program.opts().source,
|
|
57
|
-
types: commander_1.program.opts().types
|
|
55
|
+
types: commander_1.program.opts().types,
|
|
58
56
|
}, disk_1.disk);
|
|
59
|
-
var templateObject_1;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listCli = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const get_context_1 = require("../get-context");
|
|
5
|
+
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
6
|
+
const list_1 = require("./list");
|
|
7
7
|
function listCli(input, disk) {
|
|
8
8
|
(0, exit_if_invalid_1.exitIfInvalid)((0, list_1.list)((0, get_context_1.getContext)(input, disk)));
|
|
9
9
|
}
|
package/dist/bin-list/list.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
3
|
if (k2 === undefined) k2 = k;
|
|
8
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -29,21 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
27
|
};
|
|
32
|
-
exports
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
29
|
exports.list = void 0;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
const ts_belt_1 = require("@mobily/ts-belt");
|
|
31
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
|
+
const constants_1 = require("../constants");
|
|
33
|
+
const _R_1 = require("../get-context/$R");
|
|
34
|
+
const log = __importStar(require("../lib/log"));
|
|
37
35
|
function list(ctx) {
|
|
38
|
-
|
|
39
|
-
ctx.versionGroups.forEach(
|
|
40
|
-
|
|
36
|
+
const hasUserGroups = ctx.versionGroups.length > 1;
|
|
37
|
+
ctx.versionGroups.forEach((versionGroup, i) => {
|
|
38
|
+
const instanceGroups = versionGroup.getAllInstanceGroups();
|
|
41
39
|
// Nothing to do if empty
|
|
42
40
|
if (instanceGroups.length === 0)
|
|
43
41
|
return;
|
|
44
42
|
// Annotate each group
|
|
45
43
|
hasUserGroups && log.versionGroupHeader(versionGroup, i);
|
|
46
|
-
instanceGroups.forEach(
|
|
44
|
+
instanceGroups.forEach((instanceGroup) => {
|
|
47
45
|
// Record that this project has mismatches, so that eg. the CLI can exit
|
|
48
46
|
// with the correct status code.
|
|
49
47
|
if (instanceGroup.isInvalid())
|
|
@@ -64,34 +62,33 @@ function list(ctx) {
|
|
|
64
62
|
});
|
|
65
63
|
return ctx;
|
|
66
64
|
function logVersionMatch(instanceGroup) {
|
|
67
|
-
console.log((0, chalk_1
|
|
65
|
+
console.log((0, chalk_1.default) `{dim -} {white ${instanceGroup.name}} {dim ${instanceGroup.getUniqueVersions()}}`);
|
|
68
66
|
}
|
|
69
67
|
function logVersionMismatch(instanceGroup) {
|
|
70
|
-
|
|
71
|
-
.getUniqueVersions()
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
? chalk_1
|
|
75
|
-
: chalk_1
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
(0, ts_belt_1.pipe)(instanceGroup.getExpectedVersion(), ts_belt_1.R.tap((expectedVersion) => {
|
|
69
|
+
const uniqueVersions = instanceGroup.getUniqueVersions();
|
|
70
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} ${uniqueVersions
|
|
71
|
+
.map((version) => version === expectedVersion
|
|
72
|
+
? chalk_1.default.green(version)
|
|
73
|
+
: chalk_1.default.red(version))
|
|
74
|
+
.join(chalk_1.default.dim(', '))}`);
|
|
75
|
+
}), _R_1.$R.tapErrVerbose);
|
|
78
76
|
}
|
|
79
77
|
function logIgnored(instanceGroup) {
|
|
80
|
-
console.log((0, chalk_1
|
|
78
|
+
console.log((0, chalk_1.default) `{dim ${constants_1.ICON.skip} ${instanceGroup.name}} is ignored in this version group`);
|
|
81
79
|
}
|
|
82
80
|
function logBanned(instanceGroup) {
|
|
83
|
-
console.log((0, chalk_1
|
|
81
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is banned in this version group}`);
|
|
84
82
|
}
|
|
85
83
|
function logUnpinned(instanceGroup) {
|
|
86
|
-
|
|
87
|
-
console.log((0, chalk_1
|
|
84
|
+
const pinVersion = ts_belt_1.O.getExn(instanceGroup.versionGroup.getPinnedVersion());
|
|
85
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is pinned to ${pinVersion} in this version group}`);
|
|
88
86
|
}
|
|
89
87
|
function logUnsupportedMismatches(instanceGroup) {
|
|
90
|
-
console.log((0, chalk_1
|
|
88
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red has mismatched versions which syncpack cannot fix: ${instanceGroup
|
|
91
89
|
.getUniqueVersions()
|
|
92
|
-
.map(
|
|
93
|
-
.join(chalk_1
|
|
90
|
+
.map((version) => chalk_1.default.yellow(version))
|
|
91
|
+
.join(chalk_1.default.dim(', '))}}`);
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
exports.list = list;
|
|
97
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,59 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
4
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
5
|
-
return cooked;
|
|
6
|
-
};
|
|
7
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
8
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
9
|
-
if (!m) return o;
|
|
10
|
-
var i = m.call(o), r, ar = [], e;
|
|
11
|
-
try {
|
|
12
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
13
|
-
}
|
|
14
|
-
catch (error) { e = { error: error }; }
|
|
15
|
-
finally {
|
|
16
|
-
try {
|
|
17
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
18
|
-
}
|
|
19
|
-
finally { if (e) throw e.error; }
|
|
20
|
-
}
|
|
21
|
-
return ar;
|
|
22
|
-
};
|
|
23
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
-
if (ar || !(i in from)) {
|
|
26
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
-
ar[i] = from[i];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
-
};
|
|
32
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
5
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const disk_1 = require("../lib/disk");
|
|
10
|
+
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
11
|
+
const option_1 = require("../option");
|
|
12
|
+
const list_mismatches_cli_1 = require("./list-mismatches-cli");
|
|
13
|
+
commander_1.program.description(`
|
|
14
|
+
List dependencies which are required by multiple packages, where the version
|
|
15
|
+
is not the same across every package.`.replace(/^\n/, ''));
|
|
16
|
+
commander_1.program.on('--help', () => {
|
|
17
|
+
console.log((0, chalk_1.default) `
|
|
18
|
+
Examples:
|
|
19
|
+
{dim # uses defaults for resolving packages}
|
|
20
|
+
syncpack list-mismatches
|
|
21
|
+
{dim # uses packages defined by --source when provided}
|
|
22
|
+
syncpack list-mismatches --source {yellow "apps/*/package.json"}
|
|
23
|
+
{dim # multiple globs can be provided like this}
|
|
24
|
+
syncpack list-mismatches --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
25
|
+
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
26
|
+
syncpack list-mismatches --filter {yellow "typescript|tslint"}
|
|
27
|
+
{dim # only inspect "devDependencies"}
|
|
28
|
+
syncpack list-mismatches --types dev
|
|
29
|
+
{dim # only inspect "devDependencies" and "peerDependencies"}
|
|
30
|
+
syncpack list-mismatches --types dev,peer
|
|
31
|
+
|
|
32
|
+
Resolving Packages:
|
|
33
|
+
1. If {yellow --source} globs are provided, use those.
|
|
34
|
+
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
35
|
+
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
36
|
+
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
37
|
+
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
38
|
+
|
|
39
|
+
Reference:
|
|
40
|
+
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
41
|
+
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
42
|
+
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
43
|
+
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
44
|
+
`);
|
|
46
45
|
});
|
|
47
46
|
(0, show_help_on_error_1.showHelpOnError)(commander_1.program);
|
|
48
|
-
|
|
49
|
-
.option
|
|
50
|
-
.option
|
|
51
|
-
.option
|
|
52
|
-
.option
|
|
47
|
+
commander_1.program
|
|
48
|
+
.option(...option_1.option.source)
|
|
49
|
+
.option(...option_1.option.filter)
|
|
50
|
+
.option(...option_1.option.config)
|
|
51
|
+
.option(...option_1.option.types)
|
|
52
|
+
.parse(process.argv);
|
|
53
53
|
(0, list_mismatches_cli_1.listMismatchesCli)({
|
|
54
54
|
configPath: commander_1.program.opts().config,
|
|
55
55
|
filter: commander_1.program.opts().filter,
|
|
56
56
|
source: commander_1.program.opts().source,
|
|
57
|
-
types: commander_1.program.opts().types
|
|
57
|
+
types: commander_1.program.opts().types,
|
|
58
58
|
}, disk_1.disk);
|
|
59
|
-
var templateObject_1;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listMismatchesCli = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const get_context_1 = require("../get-context");
|
|
5
|
+
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
6
|
+
const list_mismatches_1 = require("./list-mismatches");
|
|
7
7
|
function listMismatchesCli(input, disk) {
|
|
8
8
|
(0, exit_if_invalid_1.exitIfInvalid)((0, list_mismatches_1.listMismatches)((0, get_context_1.getContext)(input, disk)));
|
|
9
9
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
3
|
if (k2 === undefined) k2 = k;
|
|
8
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -29,14 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
27
|
};
|
|
32
|
-
exports
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
29
|
exports.listMismatches = void 0;
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const ts_belt_1 = require("@mobily/ts-belt");
|
|
31
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
|
+
const log = __importStar(require("../lib/log"));
|
|
36
33
|
function listMismatches(ctx) {
|
|
37
|
-
|
|
38
|
-
ctx.versionGroups.forEach(
|
|
39
|
-
|
|
34
|
+
const hasUserGroups = ctx.versionGroups.length > 1;
|
|
35
|
+
ctx.versionGroups.forEach((versionGroup, i) => {
|
|
36
|
+
const invalidGroups = versionGroup.getInvalidInstanceGroups();
|
|
40
37
|
// Nothing to do if there are no mismatches
|
|
41
38
|
if (invalidGroups.length === 0)
|
|
42
39
|
return;
|
|
@@ -46,83 +43,101 @@ function listMismatches(ctx) {
|
|
|
46
43
|
// Annotate each group
|
|
47
44
|
hasUserGroups && log.versionGroupHeader(versionGroup, i);
|
|
48
45
|
// Log the mismatches
|
|
49
|
-
invalidGroups.forEach(
|
|
46
|
+
invalidGroups.forEach((instanceGroup) => {
|
|
50
47
|
if (versionGroup.isBanned())
|
|
51
48
|
return logBanned(instanceGroup);
|
|
52
49
|
if (versionGroup.isUnpinned())
|
|
53
50
|
return logUnpinned(instanceGroup);
|
|
51
|
+
if (versionGroup.hasSnappedToPackages())
|
|
52
|
+
return logSnappedTo(instanceGroup);
|
|
54
53
|
if (instanceGroup.hasUnsupportedVersion())
|
|
55
54
|
return logUnsupportedMismatches(instanceGroup);
|
|
56
55
|
if (instanceGroup.hasWorkspaceInstance()) {
|
|
57
56
|
return logWorkspaceMismatch(instanceGroup);
|
|
58
57
|
}
|
|
59
|
-
|
|
58
|
+
logHighLowVersionMismatch(instanceGroup);
|
|
60
59
|
});
|
|
61
60
|
});
|
|
62
61
|
return ctx;
|
|
63
62
|
function logBanned(instanceGroup) {
|
|
64
|
-
|
|
63
|
+
const name = instanceGroup.name;
|
|
65
64
|
log.invalid(name, 'is banned in this version group');
|
|
66
65
|
// Log each of the dependencies mismatches
|
|
67
|
-
instanceGroup.instances.forEach(
|
|
66
|
+
instanceGroup.instances.forEach((instance) => {
|
|
68
67
|
logVersionMismatch(instance);
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
function logUnsupportedMismatches(instanceGroup) {
|
|
72
|
-
|
|
71
|
+
const name = instanceGroup.name;
|
|
73
72
|
log.invalid(name, 'has mismatched versions which syncpack cannot fix');
|
|
74
73
|
// Log each of the dependencies mismatches
|
|
75
|
-
instanceGroup.instances.forEach(
|
|
74
|
+
instanceGroup.instances.forEach((instance) => {
|
|
76
75
|
logUnsupportedVersionMismatch(instance);
|
|
77
76
|
});
|
|
78
77
|
}
|
|
79
78
|
function logUnpinned(instanceGroup) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
log.invalid(name, (0, chalk_1
|
|
79
|
+
const name = instanceGroup.name;
|
|
80
|
+
const pinVersion = ts_belt_1.O.getExn(instanceGroup.versionGroup.getPinnedVersion());
|
|
81
|
+
log.invalid(name, (0, chalk_1.default) `is pinned in this version group at {reset.green ${pinVersion}}`);
|
|
83
82
|
// Log each of the dependencies mismatches
|
|
84
|
-
instanceGroup.instances.forEach(
|
|
83
|
+
instanceGroup.instances.forEach((instance) => {
|
|
85
84
|
if (instance.version !== pinVersion) {
|
|
86
85
|
logVersionMismatch(instance);
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
88
|
}
|
|
89
|
+
function logSnappedTo(instanceGroup) {
|
|
90
|
+
const name = instanceGroup.name;
|
|
91
|
+
const versionGroup = instanceGroup.versionGroup;
|
|
92
|
+
const snappedVersion = ts_belt_1.R.getExn(instanceGroup.getSnappedVersion());
|
|
93
|
+
const snappedToPackages = ts_belt_1.O.getExn(versionGroup.getSnappedToPackages()).join(' || ');
|
|
94
|
+
const version = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
|
|
95
|
+
log.invalid(name, (0, chalk_1.default) `should snap to {reset.green ${version}}, used by ${snappedToPackages}`);
|
|
96
|
+
// Log each of the dependencies mismatches
|
|
97
|
+
instanceGroup.instances.forEach((instance) => {
|
|
98
|
+
if (instance.version !== snappedVersion) {
|
|
99
|
+
logVersionMismatch(instance);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
90
103
|
function logWorkspaceMismatch(instanceGroup) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
log.invalid(name, (0, chalk_1
|
|
104
|
+
const name = instanceGroup.name;
|
|
105
|
+
const workspaceInstance = ts_belt_1.O.getExn(instanceGroup.getWorkspaceInstance());
|
|
106
|
+
const shortPath = workspaceInstance?.packageJsonFile.shortPath;
|
|
107
|
+
const expected = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
|
|
108
|
+
log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is developed in this repo at ${shortPath}}`);
|
|
96
109
|
// Log each of the dependencies mismatches
|
|
97
|
-
instanceGroup.instances.forEach(
|
|
110
|
+
instanceGroup.instances.forEach((instance) => {
|
|
98
111
|
if (instance.version !== expected) {
|
|
99
112
|
logVersionMismatch(instance);
|
|
100
113
|
}
|
|
101
114
|
});
|
|
102
115
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
function logHighLowVersionMismatch(instanceGroup) {
|
|
117
|
+
const name = instanceGroup.name;
|
|
118
|
+
const preference = instanceGroup.versionGroup
|
|
119
|
+
.groupConfig.preferVersion;
|
|
120
|
+
const direction = preference === 'highestSemver' ? 'highest' : 'lowest';
|
|
121
|
+
const expected = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
|
|
122
|
+
log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is the ${direction} valid semver version in use}`);
|
|
107
123
|
// Log each of the dependencies mismatches
|
|
108
|
-
instanceGroup.instances.forEach(
|
|
124
|
+
instanceGroup.instances.forEach((instance) => {
|
|
109
125
|
if (instance.version !== expected) {
|
|
110
126
|
logVersionMismatch(instance);
|
|
111
127
|
}
|
|
112
128
|
});
|
|
113
129
|
}
|
|
114
130
|
function logVersionMismatch(instance) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
console.log((0, chalk_1
|
|
131
|
+
const type = instance.pathDef.path;
|
|
132
|
+
const shortPath = instance.packageJsonFile.shortPath;
|
|
133
|
+
const actual = instance.version;
|
|
134
|
+
console.log((0, chalk_1.default) ` {red ${actual}} {dim in ${type} of ${shortPath}}`);
|
|
119
135
|
}
|
|
120
136
|
function logUnsupportedVersionMismatch(instance) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
console.log((0, chalk_1
|
|
137
|
+
const type = instance.pathDef.path;
|
|
138
|
+
const shortPath = instance.packageJsonFile.shortPath;
|
|
139
|
+
const actual = instance.version;
|
|
140
|
+
console.log((0, chalk_1.default) ` {yellow ${actual}} {dim in ${type} of ${shortPath}}`);
|
|
125
141
|
}
|
|
126
142
|
}
|
|
127
143
|
exports.listMismatches = listMismatches;
|
|
128
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|