syncpack 10.5.1 → 10.6.1
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/effects.d.ts +2 -0
- package/dist/bin-fix-mismatches/effects.js +112 -0
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +4 -2
- package/dist/bin-fix-mismatches/fix-mismatches.js +38 -49
- package/dist/bin-fix-mismatches/index.js +28 -4
- package/dist/bin-format/format-cli.d.ts +4 -3
- package/dist/bin-format/format-cli.js +35 -4
- package/dist/bin-format/format.d.ts +3 -2
- package/dist/bin-format/format.js +25 -1
- package/dist/bin-format/index.js +27 -3
- package/dist/bin-lint/index.js +28 -4
- package/dist/bin-lint/lint.d.ts +4 -0
- package/dist/bin-lint/lint.js +44 -0
- package/dist/bin-lint-semver-ranges/effects.d.ts +2 -0
- package/dist/bin-lint-semver-ranges/effects.js +70 -0
- package/dist/bin-lint-semver-ranges/index.js +28 -4
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +4 -2
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +14 -39
- package/dist/bin-list/effects.d.ts +2 -0
- package/dist/bin-list/effects.js +112 -0
- package/dist/bin-list/index.js +28 -4
- package/dist/bin-list/list.d.ts +4 -2
- package/dist/bin-list/list.js +14 -75
- package/dist/bin-list-mismatches/effects.d.ts +2 -0
- package/dist/bin-list-mismatches/effects.js +136 -0
- package/dist/bin-list-mismatches/index.js +28 -4
- package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -2
- package/dist/bin-list-mismatches/list-mismatches.js +14 -87
- package/dist/bin-prompt/effects.d.ts +2 -0
- package/dist/bin-prompt/effects.js +110 -0
- package/dist/bin-prompt/index.js +28 -4
- package/dist/bin-prompt/prompt.d.ts +4 -0
- package/dist/bin-prompt/prompt.js +42 -0
- package/dist/bin-set-semver-ranges/effects.d.ts +2 -0
- package/dist/bin-set-semver-ranges/effects.js +61 -0
- package/dist/bin-set-semver-ranges/index.js +28 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -2
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +39 -22
- package/dist/config/get-custom-types.d.ts +2 -2
- package/dist/config/get-enabled-types.d.ts +12 -2
- package/dist/config/get-enabled-types.js +38 -4
- package/dist/config/get-filter.d.ts +2 -2
- package/dist/config/get-indent.d.ts +2 -2
- package/dist/config/get-semver-range.d.ts +2 -2
- package/dist/config/get-semver-range.js +4 -4
- package/dist/config/get-sort-az.d.ts +2 -2
- package/dist/config/get-sort-first.d.ts +2 -2
- package/dist/config/get-source.d.ts +2 -2
- package/dist/config/get-source.js +1 -2
- package/dist/config/types.d.ts +8 -6
- package/dist/config/types.js +26 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/create-program/effects.d.ts +42 -0
- package/dist/create-program/effects.js +2 -0
- package/dist/create-program/semver-ranges.d.ts +7 -0
- package/dist/create-program/semver-ranges.js +43 -0
- package/dist/create-program/versions.d.ts +7 -0
- package/dist/create-program/versions.js +48 -0
- package/dist/env/create-env.d.ts +21 -0
- package/dist/env/create-env.js +60 -0
- package/dist/env/default-env.d.ts +18 -0
- package/dist/env/default-env.js +95 -0
- package/dist/env/exit-if-invalid.d.ts +4 -0
- package/dist/env/exit-if-invalid.js +34 -0
- package/dist/env/tags.d.ts +58 -0
- package/dist/env/tags.js +50 -0
- package/dist/env/write-if-changed.d.ts +11 -0
- package/dist/env/write-if-changed.js +73 -0
- package/dist/error-handlers/create-error-handlers.d.ts +19 -0
- package/dist/error-handlers/create-error-handlers.js +57 -0
- package/dist/error-handlers/default-error-handlers.d.ts +2 -0
- package/dist/error-handlers/default-error-handlers.js +57 -0
- package/dist/get-context/index.d.ts +11 -8
- package/dist/get-context/index.js +31 -9
- package/dist/get-package-json-files/get-file-paths.d.ts +17 -8
- package/dist/get-package-json-files/get-file-paths.js +40 -20
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +4 -3
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +31 -8
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +4 -3
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +36 -14
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +4 -3
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +37 -9
- package/dist/get-package-json-files/get-patterns/index.d.ts +4 -4
- package/dist/get-package-json-files/get-patterns/index.js +37 -18
- package/dist/get-package-json-files/get-patterns/read-json-safe.d.ts +15 -3
- package/dist/get-package-json-files/get-patterns/read-json-safe.js +36 -10
- package/dist/get-package-json-files/index.d.ts +7 -4
- package/dist/get-package-json-files/index.js +27 -9
- package/dist/get-package-json-files/instance.js +2 -2
- package/dist/get-package-json-files/package-json-file.d.ts +6 -10
- package/dist/get-package-json-files/package-json-file.js +5 -21
- package/dist/get-semver-groups/filtered-out.d.ts +12 -6
- package/dist/get-semver-groups/filtered-out.js +40 -14
- package/dist/get-semver-groups/ignored.d.ts +10 -4
- package/dist/get-semver-groups/ignored.js +34 -8
- package/dist/get-semver-groups/index.d.ts +80 -28
- package/dist/get-semver-groups/index.js +94 -42
- package/dist/get-semver-groups/with-range.d.ts +12 -5
- package/dist/get-semver-groups/with-range.js +49 -25
- package/dist/get-version-groups/banned.d.ts +10 -4
- package/dist/get-version-groups/banned.js +34 -8
- package/dist/get-version-groups/filtered-out.d.ts +12 -6
- package/dist/get-version-groups/filtered-out.js +40 -14
- package/dist/get-version-groups/ignored.d.ts +10 -4
- package/dist/get-version-groups/ignored.js +34 -8
- package/dist/get-version-groups/index.d.ts +131 -47
- package/dist/get-version-groups/index.js +123 -51
- package/dist/get-version-groups/lib/get-highest-version.js +2 -2
- package/dist/get-version-groups/lib/get-lowest-version.js +2 -2
- package/dist/get-version-groups/lib/get-range-score.js +1 -3
- package/dist/get-version-groups/lib/sort.js +3 -3
- package/dist/get-version-groups/pinned.d.ts +10 -4
- package/dist/get-version-groups/pinned.js +39 -16
- package/dist/get-version-groups/same-range.d.ts +10 -4
- package/dist/get-version-groups/same-range.js +38 -15
- package/dist/get-version-groups/snapped-to.d.ts +10 -4
- package/dist/get-version-groups/snapped-to.js +41 -16
- package/dist/get-version-groups/standard.d.ts +12 -5
- package/dist/get-version-groups/standard.js +63 -39
- package/dist/guards/can-add-to-group.d.ts +4 -0
- package/dist/guards/can-add-to-group.js +15 -0
- package/dist/guards/is-loose-semver.d.ts +1 -0
- package/dist/guards/is-loose-semver.js +9 -0
- package/dist/guards/is-semver.d.ts +1 -0
- package/dist/guards/is-semver.js +16 -0
- package/dist/guards/is-supported.d.ts +1 -0
- package/dist/guards/is-supported.js +17 -0
- package/dist/guards/is-valid-semver-range.d.ts +2 -0
- package/dist/guards/is-valid-semver-range.js +17 -0
- package/dist/lib/$R.js +2 -2
- package/dist/lib/log-group-header.d.ts +6 -0
- package/dist/lib/log-group-header.js +34 -0
- package/dist/lib/log-verbose.d.ts +1 -0
- package/dist/lib/log-verbose.js +24 -0
- package/dist/lib/set-semver-range.js +5 -5
- package/dist/option.js +1 -4
- package/dist/strategy/lib/get-non-empty-string-prop.js +2 -2
- package/dist/strategy/name-and-version-props.js +5 -5
- package/dist/strategy/named-version-string.js +4 -4
- package/dist/strategy/unnamed-version-string.js +4 -4
- package/dist/strategy/versions-by-name.js +3 -3
- package/package.json +16 -11
- package/dist/bin-fix-mismatches/fix-mismatches-cli.d.ts +0 -3
- package/dist/bin-fix-mismatches/fix-mismatches-cli.js +0 -12
- package/dist/bin-lint/lint-cli.d.ts +0 -3
- package/dist/bin-lint/lint-cli.js +0 -12
- package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.d.ts +0 -3
- package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.js +0 -11
- package/dist/bin-list/list-cli.d.ts +0 -3
- package/dist/bin-list/list-cli.js +0 -11
- package/dist/bin-list-mismatches/list-mismatches-cli.d.ts +0 -3
- package/dist/bin-list-mismatches/list-mismatches-cli.js +0 -11
- package/dist/bin-prompt/prompt-cli.d.ts +0 -3
- package/dist/bin-prompt/prompt-cli.js +0 -50
- package/dist/bin-set-semver-ranges/set-semver-ranges-cli.d.ts +0 -3
- package/dist/bin-set-semver-ranges/set-semver-ranges-cli.js +0 -11
- package/dist/get-package-json-files/get-patterns/read-yaml-safe.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/read-yaml-safe.js +0 -12
- package/dist/get-semver-groups/catch-all.d.ts +0 -4
- package/dist/get-semver-groups/catch-all.js +0 -11
- package/dist/get-version-groups/catch-all.d.ts +0 -4
- package/dist/get-version-groups/catch-all.js +0 -11
- package/dist/lib/disk.d.ts +0 -21
- package/dist/lib/disk.js +0 -79
- package/dist/lib/exit-if-invalid.d.ts +0 -2
- package/dist/lib/exit-if-invalid.js +0 -10
- package/dist/lib/is-semver.d.ts +0 -6
- package/dist/lib/is-semver.js +0 -49
- package/dist/lib/log.d.ts +0 -5
- package/dist/lib/log.js +0 -51
- package/dist/lib/newlines.d.ts +0 -6
- package/dist/lib/newlines.js +0 -24
- package/dist/lib/print-strings.d.ts +0 -1
- package/dist/lib/print-strings.js +0 -7
- package/dist/lib/write-if-changed.d.ts +0 -2
- package/dist/lib/write-if-changed.js +0 -21
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NameAndVersionPropsStrategy = void 0;
|
|
4
|
+
const Function_1 = require("@effect/data/Function");
|
|
4
5
|
const get_1 = require("tightrope/fn/get");
|
|
5
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
6
6
|
const and_then_1 = require("tightrope/result/and-then");
|
|
7
7
|
const from_try_1 = require("tightrope/result/from-try");
|
|
8
8
|
const map_1 = require("tightrope/result/map");
|
|
@@ -19,11 +19,11 @@ class NameAndVersionPropsStrategy {
|
|
|
19
19
|
read(file) {
|
|
20
20
|
const path = this.path;
|
|
21
21
|
const namePath = this.namePath;
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, Function_1.pipe)(
|
|
23
23
|
// get name prop
|
|
24
24
|
(0, get_non_empty_string_prop_1.getNonEmptyStringProp)(namePath, file),
|
|
25
25
|
// add the version prop
|
|
26
|
-
(0, and_then_1.andThen)((name) => (0,
|
|
26
|
+
(0, and_then_1.andThen)((name) => (0, Function_1.pipe)((0, get_non_empty_string_prop_1.getNonEmptyStringProp)(path, file), (0, map_1.map)((version) => ({ name, version })))),
|
|
27
27
|
// if both are non empty strings, we can return them
|
|
28
28
|
(0, map_1.map)(({ name, version }) => [[name, version]]));
|
|
29
29
|
}
|
|
@@ -36,12 +36,12 @@ class NameAndVersionPropsStrategy {
|
|
|
36
36
|
const fullPath = path.split('.');
|
|
37
37
|
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
38
38
|
const key = fullPath.slice(-1).join('');
|
|
39
|
-
return (0,
|
|
39
|
+
return (0, Function_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
|
|
40
40
|
parent[key] = version;
|
|
41
41
|
}), (0, map_1.map)(() => file));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
return (0,
|
|
44
|
+
return (0, Function_1.pipe)((0, from_try_1.fromTry)(() => {
|
|
45
45
|
contents[path] = nextValue;
|
|
46
46
|
}), (0, map_1.map)(() => file));
|
|
47
47
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NamedVersionStringStrategy = void 0;
|
|
4
|
+
const Function_1 = require("@effect/data/Function");
|
|
4
5
|
const get_1 = require("tightrope/fn/get");
|
|
5
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
6
6
|
const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
|
|
7
7
|
const result_1 = require("tightrope/result");
|
|
8
8
|
const and_then_1 = require("tightrope/result/and-then");
|
|
@@ -19,7 +19,7 @@ class NamedVersionStringStrategy {
|
|
|
19
19
|
}
|
|
20
20
|
read(file) {
|
|
21
21
|
const path = this.path;
|
|
22
|
-
return (0,
|
|
22
|
+
return (0, Function_1.pipe)(
|
|
23
23
|
// get version prop
|
|
24
24
|
(0, get_non_empty_string_prop_1.getNonEmptyStringProp)(path, file),
|
|
25
25
|
// if it is a non empty string, we can read it
|
|
@@ -39,12 +39,12 @@ class NamedVersionStringStrategy {
|
|
|
39
39
|
const fullPath = path.split('.');
|
|
40
40
|
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
41
41
|
const key = fullPath.slice(-1).join('');
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, Function_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
|
|
43
43
|
parent[key] = nextValue;
|
|
44
44
|
}), (0, map_1.map)(() => file));
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
return (0,
|
|
47
|
+
return (0, Function_1.pipe)((0, from_try_1.fromTry)(() => {
|
|
48
48
|
contents[path] = nextValue;
|
|
49
49
|
}), (0, map_1.map)(() => file));
|
|
50
50
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnnamedVersionStringStrategy = void 0;
|
|
4
|
+
const Function_1 = require("@effect/data/Function");
|
|
4
5
|
const get_1 = require("tightrope/fn/get");
|
|
5
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
6
6
|
const from_try_1 = require("tightrope/result/from-try");
|
|
7
7
|
const map_1 = require("tightrope/result/map");
|
|
8
8
|
const tap_1 = require("tightrope/result/tap");
|
|
@@ -16,7 +16,7 @@ class UnnamedVersionStringStrategy {
|
|
|
16
16
|
}
|
|
17
17
|
read(file) {
|
|
18
18
|
const path = this.path;
|
|
19
|
-
return (0,
|
|
19
|
+
return (0, Function_1.pipe)(
|
|
20
20
|
// get version prop
|
|
21
21
|
(0, get_non_empty_string_prop_1.getNonEmptyStringProp)(path, file),
|
|
22
22
|
// if it is a non empty string, we can read it
|
|
@@ -34,12 +34,12 @@ class UnnamedVersionStringStrategy {
|
|
|
34
34
|
const fullPath = path.split('.');
|
|
35
35
|
const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
|
|
36
36
|
const key = fullPath.slice(-1).join('');
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, Function_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
|
|
38
38
|
parent[key] = nextValue;
|
|
39
39
|
}), (0, map_1.map)(() => file));
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, Function_1.pipe)((0, from_try_1.fromTry)(() => {
|
|
43
43
|
contents[path] = nextValue;
|
|
44
44
|
}), (0, map_1.map)(() => file));
|
|
45
45
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VersionsByNameStrategy = void 0;
|
|
4
|
+
const Function_1 = require("@effect/data/Function");
|
|
4
5
|
const get_1 = require("tightrope/fn/get");
|
|
5
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
6
6
|
const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
|
|
7
7
|
const filter_1 = require("tightrope/result/filter");
|
|
8
8
|
const map_1 = require("tightrope/result/map");
|
|
@@ -16,12 +16,12 @@ class VersionsByNameStrategy {
|
|
|
16
16
|
}
|
|
17
17
|
read(file) {
|
|
18
18
|
const path = this.path;
|
|
19
|
-
return (0,
|
|
19
|
+
return (0, Function_1.pipe)((0, get_1.get)(file.contents, ...path.split('.')), (0, filter_1.filter)((is_non_empty_object_1.isNonEmptyObject), ''), (0, map_1.map)((Object.entries)));
|
|
20
20
|
}
|
|
21
21
|
write(file, [name, version]) {
|
|
22
22
|
const path = this.path;
|
|
23
23
|
const nextValue = version === delete_1.DELETE ? undefined : version;
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, Function_1.pipe)((0, get_1.get)(file.contents, ...path.split('.')), (0, tap_1.tap)((parent) => {
|
|
25
25
|
parent[name] = nextValue;
|
|
26
26
|
}), (0, map_1.map)(() => file));
|
|
27
27
|
}
|
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.6.1",
|
|
5
5
|
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"syncpack": "dist/bin.js",
|
|
@@ -30,28 +30,30 @@
|
|
|
30
30
|
"Tom Fletcher (https://github.com/tom-fletcher)"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@effect/data": "0.12.5",
|
|
34
|
+
"@effect/io": "0.26.0",
|
|
35
|
+
"@effect/match": "0.24.4",
|
|
33
36
|
"chalk": "4.1.2",
|
|
34
|
-
"commander": "
|
|
35
|
-
"cosmiconfig": "8.
|
|
37
|
+
"commander": "11.0.0",
|
|
38
|
+
"cosmiconfig": "8.2.0",
|
|
36
39
|
"enquirer": "2.3.6",
|
|
37
40
|
"fs-extra": "11.1.1",
|
|
38
|
-
"
|
|
41
|
+
"globby": "11.1.0",
|
|
39
42
|
"minimatch": "9.0.1",
|
|
40
43
|
"read-yaml-file": "2.1.0",
|
|
41
|
-
"semver": "7.5.
|
|
44
|
+
"semver": "7.5.2",
|
|
42
45
|
"tightrope": "0.1.0",
|
|
43
46
|
"ts-toolbelt": "9.6.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
49
|
"@tsconfig/node14": "1.0.3",
|
|
47
50
|
"@types/fs-extra": "11.0.1",
|
|
48
|
-
"@types/glob": "8.1.0",
|
|
49
51
|
"@types/jest": "29.5.2",
|
|
50
52
|
"@types/node": "14.18.36",
|
|
51
53
|
"@types/semver": "7.5.0",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
|
53
|
-
"@typescript-eslint/parser": "5.59.
|
|
54
|
-
"eslint": "8.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "5.59.11",
|
|
55
|
+
"@typescript-eslint/parser": "5.59.11",
|
|
56
|
+
"eslint": "8.43.0",
|
|
55
57
|
"eslint-plugin-import": "2.27.5",
|
|
56
58
|
"eslint-plugin-jest": "27.2.1",
|
|
57
59
|
"expect-more-jest": "5.5.0",
|
|
@@ -94,16 +96,19 @@
|
|
|
94
96
|
"repository": "JamieMason/syncpack",
|
|
95
97
|
"resolutions": {
|
|
96
98
|
"chalk": "4.1.2",
|
|
99
|
+
"globby": "11.1.0",
|
|
97
100
|
"string-width": "<5.0.0",
|
|
98
101
|
"strip-ansi": "<7.0.0",
|
|
99
102
|
"wrap-ansi": "<8.0.0"
|
|
100
103
|
},
|
|
101
104
|
"scripts": {
|
|
102
|
-
"build": "rm -rf ./dist && tsc --project .",
|
|
105
|
+
"build": "rm -rf ./dist && tsc --project tsconfig.build.json",
|
|
103
106
|
"format": "yarn format:lint && yarn format:source",
|
|
104
107
|
"format:lint": "yarn lint --fix",
|
|
105
108
|
"format:source": "prettier --write .",
|
|
106
|
-
"lint": "
|
|
109
|
+
"lint": "yarn lint:ts && yarn lint:eslint",
|
|
110
|
+
"lint:eslint": "eslint --ext .ts .",
|
|
111
|
+
"lint:ts": "tsc --noEmit --project tsconfig.json",
|
|
107
112
|
"prepack": "yarn build",
|
|
108
113
|
"test": "jest src test"
|
|
109
114
|
},
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fixMismatchesCli = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const get_context_1 = require("../get-context");
|
|
6
|
-
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
7
|
-
const write_if_changed_1 = require("../lib/write-if-changed");
|
|
8
|
-
const fix_mismatches_1 = require("./fix-mismatches");
|
|
9
|
-
function fixMismatchesCli(input, disk) {
|
|
10
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), fix_mismatches_1.fixMismatches, write_if_changed_1.writeIfChanged, exit_if_invalid_1.exitIfInvalid);
|
|
11
|
-
}
|
|
12
|
-
exports.fixMismatchesCli = fixMismatchesCli;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lintCli = void 0;
|
|
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");
|
|
7
|
-
const get_context_1 = require("../get-context");
|
|
8
|
-
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
9
|
-
function lintCli(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);
|
|
11
|
-
}
|
|
12
|
-
exports.lintCli = lintCli;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lintSemverRangesCli = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const get_context_1 = require("../get-context");
|
|
6
|
-
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
7
|
-
const lint_semver_ranges_1 = require("./lint-semver-ranges");
|
|
8
|
-
function lintSemverRangesCli(input, disk) {
|
|
9
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), lint_semver_ranges_1.lintSemverRanges, exit_if_invalid_1.exitIfInvalid);
|
|
10
|
-
}
|
|
11
|
-
exports.lintSemverRangesCli = lintSemverRangesCli;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listCli = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const get_context_1 = require("../get-context");
|
|
6
|
-
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
7
|
-
const list_1 = require("./list");
|
|
8
|
-
function listCli(input, disk) {
|
|
9
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), list_1.list, exit_if_invalid_1.exitIfInvalid);
|
|
10
|
-
}
|
|
11
|
-
exports.listCli = listCli;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listMismatchesCli = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const get_context_1 = require("../get-context");
|
|
6
|
-
const exit_if_invalid_1 = require("../lib/exit-if-invalid");
|
|
7
|
-
const list_mismatches_1 = require("./list-mismatches");
|
|
8
|
-
function listMismatchesCli(input, disk) {
|
|
9
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), list_mismatches_1.listMismatches, exit_if_invalid_1.exitIfInvalid);
|
|
10
|
-
}
|
|
11
|
-
exports.listMismatchesCli = listMismatchesCli;
|
|
@@ -1,50 +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.promptCli = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const get_context_1 = require("../get-context");
|
|
9
|
-
const get_version_groups_1 = require("../get-version-groups");
|
|
10
|
-
const get_unique_versions_1 = require("../get-version-groups/lib/get-unique-versions");
|
|
11
|
-
const sort_by_name_1 = require("../lib/sort-by-name");
|
|
12
|
-
const write_if_changed_1 = require("../lib/write-if-changed");
|
|
13
|
-
async function promptCli(input, disk) {
|
|
14
|
-
const ctx = (0, get_context_1.getContext)(input, disk);
|
|
15
|
-
const versionGroups = (0, get_version_groups_1.getVersionGroups)(ctx);
|
|
16
|
-
for (const versionGroup of versionGroups) {
|
|
17
|
-
const reports = versionGroup.inspect().sort(sort_by_name_1.sortByName);
|
|
18
|
-
for (const report of reports) {
|
|
19
|
-
switch (report.status) {
|
|
20
|
-
case 'SAME_RANGE_MISMATCH':
|
|
21
|
-
case 'UNSUPPORTED_MISMATCH': {
|
|
22
|
-
const OTHER = chalk_1.default.dim('Other');
|
|
23
|
-
const SKIP = chalk_1.default.dim('Skip this dependency');
|
|
24
|
-
const chosenVersion = await disk.askForChoice({
|
|
25
|
-
message: (0, chalk_1.default) `${report.name} {dim Choose a version to replace the others}`,
|
|
26
|
-
choices: [...(0, get_unique_versions_1.getUniqueVersions)(report.instances), OTHER, SKIP],
|
|
27
|
-
});
|
|
28
|
-
if (chosenVersion === SKIP) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
else if (chosenVersion === OTHER) {
|
|
32
|
-
const newVersion = await disk.askForInput({
|
|
33
|
-
message: (0, chalk_1.default) `${report.name} {dim Enter a new version to replace the others}`,
|
|
34
|
-
});
|
|
35
|
-
report.instances.forEach((instance) => {
|
|
36
|
-
instance.setVersion(newVersion);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
report.instances.forEach((instance) => {
|
|
41
|
-
instance.setVersion(chosenVersion);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
(0, write_if_changed_1.writeIfChanged)(ctx);
|
|
49
|
-
}
|
|
50
|
-
exports.promptCli = promptCli;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setSemverRangesCli = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const get_context_1 = require("../get-context");
|
|
6
|
-
const write_if_changed_1 = require("../lib/write-if-changed");
|
|
7
|
-
const set_semver_ranges_1 = require("./set-semver-ranges");
|
|
8
|
-
function setSemverRangesCli(input, disk) {
|
|
9
|
-
(0, pipe_1.pipe)((0, get_context_1.getContext)(input, disk), set_semver_ranges_1.setSemverRanges, write_if_changed_1.writeIfChanged);
|
|
10
|
-
}
|
|
11
|
-
exports.setSemverRangesCli = setSemverRangesCli;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readYamlSafe = void 0;
|
|
4
|
-
const pipe_1 = require("tightrope/fn/pipe");
|
|
5
|
-
const from_try_1 = require("tightrope/result/from-try");
|
|
6
|
-
const map_err_1 = require("tightrope/result/map-err");
|
|
7
|
-
function readYamlSafe(disk) {
|
|
8
|
-
return function readYamlSafe(filePath) {
|
|
9
|
-
return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => disk.readYamlFileSync(filePath)), (0, map_err_1.mapErr)(() => new Error(`Failed to read YAML file at ${filePath}`)));
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.readYamlSafe = readYamlSafe;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CatchAllSemverGroup = void 0;
|
|
4
|
-
const with_range_1 = require("./with-range");
|
|
5
|
-
class CatchAllSemverGroup extends with_range_1.WithRangeSemverGroup {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this._tag = 'CatchAll';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.CatchAllSemverGroup = CatchAllSemverGroup;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CatchAllVersionGroup = void 0;
|
|
4
|
-
const standard_1 = require("./standard");
|
|
5
|
-
class CatchAllVersionGroup extends standard_1.StandardVersionGroup {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this._tag = 'CatchAll';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.CatchAllVersionGroup = CatchAllVersionGroup;
|
package/dist/lib/disk.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { O } from 'ts-toolbelt';
|
|
2
|
-
import type { RcConfig } from '../config/types';
|
|
3
|
-
export type Disk = {
|
|
4
|
-
askForChoice: (opts: {
|
|
5
|
-
message: string;
|
|
6
|
-
choices: string[];
|
|
7
|
-
}) => Promise<string>;
|
|
8
|
-
askForInput: (opts: {
|
|
9
|
-
message: string;
|
|
10
|
-
}) => Promise<string>;
|
|
11
|
-
globSync: (pattern: string) => string[];
|
|
12
|
-
process: {
|
|
13
|
-
exit: (code: number) => void;
|
|
14
|
-
};
|
|
15
|
-
readConfigFileSync: (configPath?: string) => O.Partial<RcConfig, 'deep'>;
|
|
16
|
-
readFileSync: (filePath: string) => string;
|
|
17
|
-
readYamlFileSync: <T = unknown>(filePath: string) => T;
|
|
18
|
-
removeSync: (filePath: string) => void;
|
|
19
|
-
writeFileSync: (filePath: string, contents: string) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare const disk: Disk;
|
package/dist/lib/disk.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.disk = void 0;
|
|
4
|
-
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
-
// @ts-ignore Select *does* exist
|
|
7
|
-
const enquirer_1 = require("enquirer");
|
|
8
|
-
const fs_extra_1 = require("fs-extra");
|
|
9
|
-
const glob_1 = require("glob");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const read_yaml_file_1 = require("read-yaml-file");
|
|
12
|
-
const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
|
|
13
|
-
const constants_1 = require("../constants");
|
|
14
|
-
const log_1 = require("./log");
|
|
15
|
-
const client = (0, cosmiconfig_1.cosmiconfigSync)('syncpack');
|
|
16
|
-
exports.disk = {
|
|
17
|
-
askForChoice({ message, choices }) {
|
|
18
|
-
return new enquirer_1.Select({ name: 'choice', message, choices })
|
|
19
|
-
.run()
|
|
20
|
-
.catch(console.error);
|
|
21
|
-
},
|
|
22
|
-
askForInput({ message }) {
|
|
23
|
-
return new enquirer_1.Input({ message }).run().catch(console.error);
|
|
24
|
-
},
|
|
25
|
-
globSync(pattern) {
|
|
26
|
-
(0, log_1.verbose)('globSync(', pattern, ')');
|
|
27
|
-
return (0, glob_1.sync)(pattern, {
|
|
28
|
-
ignore: '**/node_modules/**',
|
|
29
|
-
absolute: true,
|
|
30
|
-
cwd: constants_1.CWD,
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
process: {
|
|
34
|
-
exit(code) {
|
|
35
|
-
(0, log_1.verbose)('exit(', code, ')');
|
|
36
|
-
process.exit(code);
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
readConfigFileSync(configPath) {
|
|
40
|
-
(0, log_1.verbose)('readConfigFileSync(', configPath, ')');
|
|
41
|
-
try {
|
|
42
|
-
const result = configPath ? client.load(configPath) : client.search();
|
|
43
|
-
if (result === null) {
|
|
44
|
-
const rcPath = (0, path_1.join)(constants_1.CWD, 'package.json');
|
|
45
|
-
const pjson = (0, fs_extra_1.readJsonSync)(rcPath, { throws: false });
|
|
46
|
-
const rcConfig = pjson?.config?.syncpack;
|
|
47
|
-
if ((0, is_non_empty_object_1.isNonEmptyObject)(rcConfig))
|
|
48
|
-
return rcConfig;
|
|
49
|
-
(0, log_1.verbose)('no config file found');
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
const rcPath = result.filepath;
|
|
53
|
-
const rcConfig = result.config;
|
|
54
|
-
(0, log_1.verbose)('.syncpackrc path:', rcPath);
|
|
55
|
-
(0, log_1.verbose)('.syncpackrc contents:', rcConfig);
|
|
56
|
-
return rcConfig;
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
(0, log_1.verbose)('no config file found at:', configPath);
|
|
60
|
-
return {};
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
readFileSync(filePath) {
|
|
64
|
-
(0, log_1.verbose)('readFileSync(', filePath, ')');
|
|
65
|
-
return (0, fs_extra_1.readFileSync)(filePath, { encoding: 'utf8' });
|
|
66
|
-
},
|
|
67
|
-
readYamlFileSync(filePath) {
|
|
68
|
-
(0, log_1.verbose)('readYamlFileSync(', filePath, ')');
|
|
69
|
-
return (0, read_yaml_file_1.sync)(filePath);
|
|
70
|
-
},
|
|
71
|
-
removeSync(filePath) {
|
|
72
|
-
(0, log_1.verbose)('removeSync(', filePath, ')');
|
|
73
|
-
(0, fs_extra_1.removeSync)(filePath);
|
|
74
|
-
},
|
|
75
|
-
writeFileSync(filePath, contents) {
|
|
76
|
-
(0, log_1.verbose)('writeFileSync(', filePath, contents, ')');
|
|
77
|
-
(0, fs_extra_1.writeFileSync)(filePath, contents);
|
|
78
|
-
},
|
|
79
|
-
};
|
package/dist/lib/is-semver.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { SemverRange } from '../config/types';
|
|
2
|
-
export declare function isValidSemverRange(value: unknown): value is SemverRange;
|
|
3
|
-
export declare function isSupported(version: unknown): version is string;
|
|
4
|
-
export declare function isWorkspaceProtocol(version: unknown): boolean;
|
|
5
|
-
export declare function isSemver(version: unknown): boolean;
|
|
6
|
-
export declare function isLooseSemver(version: unknown): boolean;
|
package/dist/lib/is-semver.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLooseSemver = exports.isSemver = exports.isWorkspaceProtocol = exports.isSupported = exports.isValidSemverRange = void 0;
|
|
4
|
-
const is_string_1 = require("tightrope/guard/is-string");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
function isValidSemverRange(value) {
|
|
7
|
-
return (value === constants_1.RANGE.ANY ||
|
|
8
|
-
value === constants_1.RANGE.EXACT ||
|
|
9
|
-
value === constants_1.RANGE.GT ||
|
|
10
|
-
value === constants_1.RANGE.GTE ||
|
|
11
|
-
value === constants_1.RANGE.LOOSE ||
|
|
12
|
-
value === constants_1.RANGE.LT ||
|
|
13
|
-
value === constants_1.RANGE.LTE ||
|
|
14
|
-
value === constants_1.RANGE.MINOR ||
|
|
15
|
-
value === constants_1.RANGE.PATCH ||
|
|
16
|
-
value === constants_1.RANGE.WORKSPACE);
|
|
17
|
-
}
|
|
18
|
-
exports.isValidSemverRange = isValidSemverRange;
|
|
19
|
-
function isSupported(version) {
|
|
20
|
-
return version === '*' || isSemver(version) || isWorkspaceProtocol(version);
|
|
21
|
-
}
|
|
22
|
-
exports.isSupported = isSupported;
|
|
23
|
-
function isWorkspaceProtocol(version) {
|
|
24
|
-
if (!(0, is_string_1.isString)(version))
|
|
25
|
-
return false;
|
|
26
|
-
if (!version.startsWith('workspace:'))
|
|
27
|
-
return false;
|
|
28
|
-
const value = version.replace(/^workspace:/, '');
|
|
29
|
-
return value === '*' || isSemver(value);
|
|
30
|
-
}
|
|
31
|
-
exports.isWorkspaceProtocol = isWorkspaceProtocol;
|
|
32
|
-
function isSemver(version) {
|
|
33
|
-
const range = '(~|\\^|>=|>|<=|<)?';
|
|
34
|
-
const ints = '[0-9]+';
|
|
35
|
-
const intsOrX = '([0-9]+|x)';
|
|
36
|
-
const dot = '\\.';
|
|
37
|
-
const major = new RegExp(`^${range}${ints}$`);
|
|
38
|
-
const minor = new RegExp(`^${range}${ints}${dot}${intsOrX}$`);
|
|
39
|
-
const patch = new RegExp(`^${range}${ints}${dot}${intsOrX}${dot}${intsOrX}$`);
|
|
40
|
-
return ((0, is_string_1.isString)(version) &&
|
|
41
|
-
(version.search(major) !== -1 ||
|
|
42
|
-
version.search(minor) !== -1 ||
|
|
43
|
-
version.search(patch) !== -1));
|
|
44
|
-
}
|
|
45
|
-
exports.isSemver = isSemver;
|
|
46
|
-
function isLooseSemver(version) {
|
|
47
|
-
return ((0, is_string_1.isString)(version) && isSemver(version) && version.search(/\.x(\.|$)/) !== -1);
|
|
48
|
-
}
|
|
49
|
-
exports.isLooseSemver = isLooseSemver;
|
package/dist/lib/log.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { AnySemverGroup } from '../get-semver-groups';
|
|
2
|
-
import type { AnyVersionGroup } from '../get-version-groups';
|
|
3
|
-
export declare function verbose(...values: unknown[]): void;
|
|
4
|
-
export declare function semverGroupHeader(group: AnySemverGroup, i: number): void;
|
|
5
|
-
export declare function versionGroupHeader(group: AnyVersionGroup, i: number): void;
|