syncpack 9.3.2 → 9.7.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 +14 -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 +19 -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 +21 -28
- 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 +49 -38
- 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-all-instances.js +3 -3
- 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.js +29 -59
- 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 +254 -164
- package/dist/get-context/get-config/schema/index.js +40 -63
- 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 +77 -40
- package/dist/get-context/get-config/schema/version-group.js +20 -21
- 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 +2 -1
- package/dist/get-context/get-groups/index.js +31 -37
- 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 +2 -1
- package/dist/get-context/get-groups/version-group/index.js +29 -68
- 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/index.d.ts +2 -1
- package/dist/get-context/get-groups/version-group/instance-group/index.js +55 -47
- 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 +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.js +22 -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.js +7 -7
- 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.js +14 -15
- package/dist/get-context/index.js +19 -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 +33 -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 +2 -0
- package/dist/types.js +1 -1
- package/package.json +20 -16
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,21 @@ 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 chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const constants_1 = require("../constants");
|
|
32
|
+
const log = __importStar(require("../lib/log"));
|
|
37
33
|
function list(ctx) {
|
|
38
|
-
|
|
39
|
-
ctx.versionGroups.forEach(
|
|
40
|
-
|
|
34
|
+
const hasUserGroups = ctx.versionGroups.length > 1;
|
|
35
|
+
ctx.versionGroups.forEach((versionGroup, i) => {
|
|
36
|
+
const instanceGroups = versionGroup.getAllInstanceGroups();
|
|
41
37
|
// Nothing to do if empty
|
|
42
38
|
if (instanceGroups.length === 0)
|
|
43
39
|
return;
|
|
44
40
|
// Annotate each group
|
|
45
41
|
hasUserGroups && log.versionGroupHeader(versionGroup, i);
|
|
46
|
-
instanceGroups.forEach(
|
|
42
|
+
instanceGroups.forEach((instanceGroup) => {
|
|
47
43
|
// Record that this project has mismatches, so that eg. the CLI can exit
|
|
48
44
|
// with the correct status code.
|
|
49
45
|
if (instanceGroup.isInvalid())
|
|
@@ -64,34 +60,31 @@ function list(ctx) {
|
|
|
64
60
|
});
|
|
65
61
|
return ctx;
|
|
66
62
|
function logVersionMatch(instanceGroup) {
|
|
67
|
-
console.log((0, chalk_1
|
|
63
|
+
console.log((0, chalk_1.default) `{dim -} {white ${instanceGroup.name}} {dim ${instanceGroup.getUniqueVersions()}}`);
|
|
68
64
|
}
|
|
69
65
|
function logVersionMismatch(instanceGroup) {
|
|
70
|
-
console.log((0, chalk_1
|
|
66
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} ${instanceGroup
|
|
71
67
|
.getUniqueVersions()
|
|
72
|
-
.map(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})
|
|
77
|
-
.join(chalk_1["default"].dim(', '))));
|
|
68
|
+
.map((version) => version === instanceGroup.getExpectedVersion()
|
|
69
|
+
? chalk_1.default.green(version)
|
|
70
|
+
: chalk_1.default.red(version))
|
|
71
|
+
.join(chalk_1.default.dim(', '))}`);
|
|
78
72
|
}
|
|
79
73
|
function logIgnored(instanceGroup) {
|
|
80
|
-
console.log((0, chalk_1
|
|
74
|
+
console.log((0, chalk_1.default) `{dim ${constants_1.ICON.skip} ${instanceGroup.name}} is ignored in this version group`);
|
|
81
75
|
}
|
|
82
76
|
function logBanned(instanceGroup) {
|
|
83
|
-
console.log((0, chalk_1
|
|
77
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is banned in this version group}`);
|
|
84
78
|
}
|
|
85
79
|
function logUnpinned(instanceGroup) {
|
|
86
|
-
|
|
87
|
-
console.log((0, chalk_1
|
|
80
|
+
const pinVersion = instanceGroup.versionGroup.getPinnedVersion();
|
|
81
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is pinned to ${pinVersion} in this version group}`);
|
|
88
82
|
}
|
|
89
83
|
function logUnsupportedMismatches(instanceGroup) {
|
|
90
|
-
console.log((0, chalk_1
|
|
84
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red has mismatched versions which syncpack cannot fix: ${instanceGroup
|
|
91
85
|
.getUniqueVersions()
|
|
92
|
-
.map(
|
|
93
|
-
.join(chalk_1
|
|
86
|
+
.map((version) => chalk_1.default.yellow(version))
|
|
87
|
+
.join(chalk_1.default.dim(', '))}}`);
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
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,14 @@ 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 chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const log = __importStar(require("../lib/log"));
|
|
36
32
|
function listMismatches(ctx) {
|
|
37
|
-
|
|
38
|
-
ctx.versionGroups.forEach(
|
|
39
|
-
|
|
33
|
+
const hasUserGroups = ctx.versionGroups.length > 1;
|
|
34
|
+
ctx.versionGroups.forEach((versionGroup, i) => {
|
|
35
|
+
const invalidGroups = versionGroup.getInvalidInstanceGroups();
|
|
40
36
|
// Nothing to do if there are no mismatches
|
|
41
37
|
if (invalidGroups.length === 0)
|
|
42
38
|
return;
|
|
@@ -46,11 +42,13 @@ function listMismatches(ctx) {
|
|
|
46
42
|
// Annotate each group
|
|
47
43
|
hasUserGroups && log.versionGroupHeader(versionGroup, i);
|
|
48
44
|
// Log the mismatches
|
|
49
|
-
invalidGroups.forEach(
|
|
45
|
+
invalidGroups.forEach((instanceGroup) => {
|
|
50
46
|
if (versionGroup.isBanned())
|
|
51
47
|
return logBanned(instanceGroup);
|
|
52
48
|
if (versionGroup.isUnpinned())
|
|
53
49
|
return logUnpinned(instanceGroup);
|
|
50
|
+
if (versionGroup.hasSnappedToPackages())
|
|
51
|
+
return logSnappedTo(instanceGroup);
|
|
54
52
|
if (instanceGroup.hasUnsupportedVersion())
|
|
55
53
|
return logUnsupportedMismatches(instanceGroup);
|
|
56
54
|
if (instanceGroup.hasWorkspaceInstance()) {
|
|
@@ -61,68 +59,81 @@ function listMismatches(ctx) {
|
|
|
61
59
|
});
|
|
62
60
|
return ctx;
|
|
63
61
|
function logBanned(instanceGroup) {
|
|
64
|
-
|
|
62
|
+
const name = instanceGroup.name;
|
|
65
63
|
log.invalid(name, 'is banned in this version group');
|
|
66
64
|
// Log each of the dependencies mismatches
|
|
67
|
-
instanceGroup.instances.forEach(
|
|
65
|
+
instanceGroup.instances.forEach((instance) => {
|
|
68
66
|
logVersionMismatch(instance);
|
|
69
67
|
});
|
|
70
68
|
}
|
|
71
69
|
function logUnsupportedMismatches(instanceGroup) {
|
|
72
|
-
|
|
70
|
+
const name = instanceGroup.name;
|
|
73
71
|
log.invalid(name, 'has mismatched versions which syncpack cannot fix');
|
|
74
72
|
// Log each of the dependencies mismatches
|
|
75
|
-
instanceGroup.instances.forEach(
|
|
73
|
+
instanceGroup.instances.forEach((instance) => {
|
|
76
74
|
logUnsupportedVersionMismatch(instance);
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
77
|
function logUnpinned(instanceGroup) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
log.invalid(name, (0, chalk_1
|
|
78
|
+
const name = instanceGroup.name;
|
|
79
|
+
const pinVersion = instanceGroup.versionGroup.getPinnedVersion();
|
|
80
|
+
log.invalid(name, (0, chalk_1.default) `is pinned in this version group at {reset.green ${pinVersion}}`);
|
|
83
81
|
// Log each of the dependencies mismatches
|
|
84
|
-
instanceGroup.instances.forEach(
|
|
82
|
+
instanceGroup.instances.forEach((instance) => {
|
|
85
83
|
if (instance.version !== pinVersion) {
|
|
86
84
|
logVersionMismatch(instance);
|
|
87
85
|
}
|
|
88
86
|
});
|
|
89
87
|
}
|
|
88
|
+
function logSnappedTo(instanceGroup) {
|
|
89
|
+
const name = instanceGroup.name;
|
|
90
|
+
const versionGroup = instanceGroup.versionGroup;
|
|
91
|
+
const snappedVersion = instanceGroup.getSnappedVersion();
|
|
92
|
+
const packages = versionGroup.getSnappedToPackages().join(' || ');
|
|
93
|
+
const version = instanceGroup.getExpectedVersion();
|
|
94
|
+
log.invalid(name, (0, chalk_1.default) `should snap to {reset.green ${version}}, used by ${packages}`);
|
|
95
|
+
// Log each of the dependencies mismatches
|
|
96
|
+
instanceGroup.instances.forEach((instance) => {
|
|
97
|
+
if (instance.version !== snappedVersion) {
|
|
98
|
+
logVersionMismatch(instance);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
90
102
|
function logWorkspaceMismatch(instanceGroup) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
log.invalid(name, (0, chalk_1
|
|
103
|
+
const name = instanceGroup.name;
|
|
104
|
+
const workspaceInstance = instanceGroup.getWorkspaceInstance();
|
|
105
|
+
const shortPath = workspaceInstance?.packageJsonFile.shortPath;
|
|
106
|
+
const expected = instanceGroup.getExpectedVersion();
|
|
107
|
+
log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is developed in this repo at ${shortPath}}`);
|
|
96
108
|
// Log each of the dependencies mismatches
|
|
97
|
-
instanceGroup.instances.forEach(
|
|
109
|
+
instanceGroup.instances.forEach((instance) => {
|
|
98
110
|
if (instance.version !== expected) {
|
|
99
111
|
logVersionMismatch(instance);
|
|
100
112
|
}
|
|
101
113
|
});
|
|
102
114
|
}
|
|
103
115
|
function logHighestVersionMismatch(instanceGroup) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
log.invalid(name, (0, chalk_1
|
|
116
|
+
const name = instanceGroup.name;
|
|
117
|
+
const expected = instanceGroup.getExpectedVersion();
|
|
118
|
+
log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is the highest valid semver version in use}`);
|
|
107
119
|
// Log each of the dependencies mismatches
|
|
108
|
-
instanceGroup.instances.forEach(
|
|
120
|
+
instanceGroup.instances.forEach((instance) => {
|
|
109
121
|
if (instance.version !== expected) {
|
|
110
122
|
logVersionMismatch(instance);
|
|
111
123
|
}
|
|
112
124
|
});
|
|
113
125
|
}
|
|
114
126
|
function logVersionMismatch(instance) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
console.log((0, chalk_1
|
|
127
|
+
const type = instance.pathDef.path;
|
|
128
|
+
const shortPath = instance.packageJsonFile.shortPath;
|
|
129
|
+
const actual = instance.version;
|
|
130
|
+
console.log((0, chalk_1.default) ` {red ${actual}} {dim in ${type} of ${shortPath}}`);
|
|
119
131
|
}
|
|
120
132
|
function logUnsupportedVersionMismatch(instance) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
console.log((0, chalk_1
|
|
133
|
+
const type = instance.pathDef.path;
|
|
134
|
+
const shortPath = instance.packageJsonFile.shortPath;
|
|
135
|
+
const actual = instance.version;
|
|
136
|
+
console.log((0, chalk_1.default) ` {yellow ${actual}} {dim in ${type} of ${shortPath}}`);
|
|
125
137
|
}
|
|
126
138
|
}
|
|
127
139
|
exports.listMismatches = listMismatches;
|
|
128
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -1,63 +1,76 @@
|
|
|
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 set_semver_ranges_cli_1 = require("./set-semver-ranges-cli");
|
|
13
|
+
commander_1.program.description((0, chalk_1.default) `
|
|
14
|
+
Ensure dependency versions within {yellow dependencies}, {yellow devDependencies},
|
|
15
|
+
{yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format.`.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 set-semver-ranges
|
|
21
|
+
{dim # uses packages defined by --source when provided}
|
|
22
|
+
syncpack set-semver-ranges --source {yellow "apps/*/package.json"}
|
|
23
|
+
{dim # multiple globs can be provided like this}
|
|
24
|
+
syncpack set-semver-ranges --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
25
|
+
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
26
|
+
syncpack set-semver-ranges --filter {yellow "typescript|tslint"}
|
|
27
|
+
{dim # use ~ range instead of default ""}
|
|
28
|
+
syncpack set-semver-ranges --semver-range ~
|
|
29
|
+
{dim # set ~ range in "devDependencies"}
|
|
30
|
+
syncpack set-semver-ranges --types dev --semver-range ~
|
|
31
|
+
{dim # set ~ range in "devDependencies" and "peerDependencies"}
|
|
32
|
+
syncpack set-semver-ranges --types dev,peer --semver-range ~
|
|
33
|
+
{dim # indent package.json with 4 spaces instead of 2}
|
|
34
|
+
syncpack set-semver-ranges --indent {yellow " "}
|
|
35
|
+
|
|
36
|
+
Supported Ranges:
|
|
37
|
+
< {dim <1.4.2}
|
|
38
|
+
<= {dim <=1.4.2}
|
|
39
|
+
"" {dim 1.4.2}
|
|
40
|
+
~ {dim ~1.4.2}
|
|
41
|
+
^ {dim ^1.4.2}
|
|
42
|
+
>= {dim >=1.4.2}
|
|
43
|
+
> {dim >1.4.2}
|
|
44
|
+
* {dim *}
|
|
45
|
+
|
|
46
|
+
Resolving Packages:
|
|
47
|
+
1. If {yellow --source} globs are provided, use those.
|
|
48
|
+
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
49
|
+
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
50
|
+
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
51
|
+
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
52
|
+
|
|
53
|
+
Reference:
|
|
54
|
+
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
55
|
+
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
56
|
+
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
57
|
+
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
58
|
+
`);
|
|
46
59
|
});
|
|
47
60
|
(0, show_help_on_error_1.showHelpOnError)(commander_1.program);
|
|
48
|
-
|
|
49
|
-
.option
|
|
50
|
-
.option
|
|
51
|
-
.option
|
|
52
|
-
.option
|
|
53
|
-
.option
|
|
54
|
-
.option
|
|
61
|
+
commander_1.program
|
|
62
|
+
.option(...option_1.option.source)
|
|
63
|
+
.option(...option_1.option.filter)
|
|
64
|
+
.option(...option_1.option.config)
|
|
65
|
+
.option(...option_1.option.semverRange)
|
|
66
|
+
.option(...option_1.option.types)
|
|
67
|
+
.option(...option_1.option.indent)
|
|
68
|
+
.parse(process.argv);
|
|
55
69
|
(0, set_semver_ranges_cli_1.setSemverRangesCli)({
|
|
56
70
|
configPath: commander_1.program.opts().config,
|
|
57
71
|
filter: commander_1.program.opts().filter,
|
|
58
72
|
indent: commander_1.program.opts().indent,
|
|
59
73
|
semverRange: commander_1.program.opts().semverRange,
|
|
60
74
|
source: commander_1.program.opts().source,
|
|
61
|
-
types: commander_1.program.opts().types
|
|
75
|
+
types: commander_1.program.opts().types,
|
|
62
76
|
}, disk_1.disk);
|
|
63
|
-
var templateObject_1, templateObject_2;
|