syncpack 12.0.1 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
- package/dist/bin-fix-mismatches/index.js +3 -1
- package/dist/bin-format/index.js +1 -1
- package/dist/bin-lint/index.js +1 -1
- package/dist/bin-lint-semver-ranges/index.js +3 -1
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +7 -7
- package/dist/bin-list/index.js +3 -1
- package/dist/bin-list/list.d.ts +2 -0
- package/dist/bin-list/list.js +78 -50
- package/dist/bin-list-mismatches/index.js +3 -1
- package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -5
- package/dist/bin-list-mismatches/list-mismatches.js +185 -220
- package/dist/bin-prompt/index.js +2 -0
- package/dist/bin-prompt/prompt.js +7 -3
- package/dist/bin-set-semver-ranges/index.js +3 -1
- package/dist/bin-update/effects.js +6 -6
- package/dist/bin-update/index.js +2 -0
- package/dist/bin-update/update.js +3 -3
- package/dist/config/get-custom-types.js +2 -1
- package/dist/config/types.d.ts +15 -7
- package/dist/constants.d.ts +71 -8
- package/dist/constants.js +34 -1
- package/dist/get-instances/instance.d.ts +2 -1
- package/dist/get-instances/instance.js +4 -3
- package/dist/guards/can-add-to-group.js +14 -7
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +1 -1
- package/dist/io/read-config-file-sync.js +1 -1
- package/dist/option.d.ts +2 -1
- package/dist/option.js +4 -0
- package/dist/report.d.ts +64 -99
- package/dist/report.js +81 -16
- package/dist/schema.json +202 -77
- package/dist/semver-group/create-semver-groups.js +6 -0
- package/dist/semver-group/disabled.js +1 -3
- package/dist/semver-group/filtered-out.js +1 -3
- package/dist/semver-group/ignored.js +1 -3
- package/dist/semver-group/index.d.ts +1 -2
- package/dist/semver-group/with-range.d.ts +1 -1
- package/dist/semver-group/with-range.js +7 -15
- package/dist/specifier/alias.d.ts +2 -0
- package/dist/specifier/alias.js +3 -1
- package/dist/specifier/base.d.ts +4 -2
- package/dist/specifier/base.js +3 -1
- package/dist/specifier/delete.d.ts +4 -2
- package/dist/specifier/delete.js +3 -1
- package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
- package/dist/specifier/{version.js → exact.js} +6 -4
- package/dist/specifier/file.d.ts +2 -0
- package/dist/specifier/file.js +3 -1
- package/dist/specifier/hosted-git.d.ts +2 -0
- package/dist/specifier/hosted-git.js +3 -1
- package/dist/specifier/index.d.ts +5 -4
- package/dist/specifier/index.js +7 -3
- package/dist/specifier/latest.d.ts +19 -0
- package/dist/specifier/latest.js +24 -0
- package/dist/specifier/lib/parse-specifier.js +1 -1
- package/dist/specifier/range.d.ts +2 -1
- package/dist/specifier/range.js +3 -2
- package/dist/specifier/tag.d.ts +2 -0
- package/dist/specifier/tag.js +3 -1
- package/dist/specifier/unsupported.d.ts +2 -0
- package/dist/specifier/unsupported.js +3 -1
- package/dist/specifier/url.d.ts +2 -0
- package/dist/specifier/url.js +3 -1
- package/dist/specifier/workspace-protocol.d.ts +2 -0
- package/dist/specifier/workspace-protocol.js +6 -3
- package/dist/strategy/name-and-version-props.js +4 -4
- package/dist/version-group/banned.js +1 -3
- package/dist/version-group/create-version-groups.js +11 -0
- package/dist/version-group/filtered-out.js +1 -1
- package/dist/version-group/ignored.js +1 -1
- package/dist/version-group/index.d.ts +1 -2
- package/dist/version-group/pinned.js +3 -3
- package/dist/version-group/same-range.js +9 -14
- package/dist/version-group/snapped-to.js +12 -22
- package/dist/version-group/standard.js +44 -55
- package/package.json +7 -7
|
@@ -20,7 +20,7 @@ class IgnoredVersionGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
20
20
|
name,
|
|
21
21
|
reports: instances.map((instance) =>
|
|
22
22
|
// ✓ is ignored and dismissed as valid
|
|
23
|
-
new report_1.Report.Ignored(
|
|
23
|
+
new report_1.Report.Ignored(instance)),
|
|
24
24
|
})));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Data } from 'effect';
|
|
2
|
-
import type { Union } from 'ts-toolbelt';
|
|
3
2
|
import type { BannedVersionGroup } from './banned';
|
|
4
3
|
import type { FilteredOutVersionGroup } from './filtered-out';
|
|
5
4
|
import type { IgnoredVersionGroup } from './ignored';
|
|
@@ -15,7 +14,7 @@ export declare namespace VersionGroup {
|
|
|
15
14
|
export type SameRange = SameRangeVersionGroup;
|
|
16
15
|
export type SnappedTo = SnappedToVersionGroup;
|
|
17
16
|
export type Standard = StandardVersionGroup;
|
|
18
|
-
export type Any =
|
|
17
|
+
export type Any = Banned | FilteredOut | Ignored | Pinned | SameRange | SnappedTo | Standard;
|
|
19
18
|
const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
20
19
|
readonly _tag: "VersionGroupConfigError";
|
|
21
20
|
}>;
|
|
@@ -17,14 +17,14 @@ class PinnedVersionGroup extends effect_1.Data.TaggedClass('Pinned') {
|
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
inspectAll() {
|
|
20
|
-
return effect_1.Effect.all(Object.entries((0, group_by_1.groupBy)('name', this.instances)).map(([name, instances]) => (0, effect_1.pipe)(instances, effect_1.Effect.forEach((instance) => (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, this.config.pinVersion)), effect_1.Effect.map((expected) => instance.rawSpecifier === expected.raw
|
|
20
|
+
return effect_1.Effect.all(Object.entries((0, group_by_1.groupBy)('name', this.instances)).map(([name, instances]) => (0, effect_1.pipe)(instances, effect_1.Effect.forEach((instance) => (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, this.config.pinVersion)), effect_1.Effect.map((expected) => instance.rawSpecifier.raw === expected.raw
|
|
21
21
|
? // ✓ pinned takes precedence over any semver group
|
|
22
22
|
// ✓ current version matches expected
|
|
23
|
-
new report_1.Report.Valid(
|
|
23
|
+
new report_1.Report.Valid(expected)
|
|
24
24
|
: // ✓ pinned takes precedence over any semver group
|
|
25
25
|
// ✘ current version mismatches expected
|
|
26
26
|
// ✓ is a mismatch we can auto-fix
|
|
27
|
-
new report_1.Report.PinnedMismatch(
|
|
27
|
+
new report_1.Report.PinnedMismatch(expected)))), effect_1.Effect.map((reports) => ({ name, reports })))));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.PinnedVersionGroup = PinnedVersionGroup;
|
|
@@ -23,31 +23,29 @@ class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
inspectAll() {
|
|
26
|
-
return effect_1.Effect.all(Object.entries((0, group_by_1.groupBy)('name', this.instances)).flatMap(([name, instances]) => (0, effect_1.pipe)(instances, effect_1.Effect.partition((instance) => (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier)), effect_1.Effect.flatMap((specifier) => (0, effect_1.pipe)(specifier.getSemver(), effect_1.Effect.matchEffect({
|
|
26
|
+
return effect_1.Effect.all(Object.entries((0, group_by_1.groupBy)('name', this.instances)).flatMap(([name, instances]) => (0, effect_1.pipe)(instances, effect_1.Effect.partition((instance) => (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier.raw)), effect_1.Effect.flatMap((specifier) => (0, effect_1.pipe)(specifier.getSemver(), effect_1.Effect.matchEffect({
|
|
27
27
|
onFailure: () => effect_1.Effect.fail(
|
|
28
28
|
// ✘ expected version is not semver
|
|
29
29
|
// ✘ is a mismatch we can't auto-fix
|
|
30
|
-
new report_1.Report.UnsupportedMismatch(
|
|
30
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance)),
|
|
31
31
|
onSuccess: () => (0, effect_1.pipe)(specifier.instance.semverGroup.getFixed(specifier), effect_1.Effect.matchEffect({
|
|
32
32
|
onFailure: () => effect_1.Effect.fail(
|
|
33
33
|
// ✓ expected version is semver
|
|
34
34
|
// ✘ expected version is not fixable by its semver group
|
|
35
35
|
// ✘ is a mismatch we can't auto-fix
|
|
36
|
-
new report_1.Report.UnsupportedMismatch(
|
|
37
|
-
|
|
38
|
-
})),
|
|
39
|
-
onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
|
|
36
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance)),
|
|
37
|
+
onSuccess: (valid) => specifier.instance.rawSpecifier.raw === valid.raw
|
|
40
38
|
? effect_1.Effect.succeed(
|
|
41
39
|
// ✓ expected version is semver
|
|
42
40
|
// ✓ expected version matches its semver group
|
|
43
41
|
// ✓ current version matches expected
|
|
44
|
-
new report_1.Report.Valid(
|
|
42
|
+
new report_1.Report.Valid(specifier))
|
|
45
43
|
: effect_1.Effect.fail(
|
|
46
44
|
// ✓ expected version is semver
|
|
47
45
|
// ✓ expected version matches its semver group
|
|
48
46
|
// ✘ current version mismatches expected
|
|
49
47
|
// ✓ is a mismatch we can auto-fix
|
|
50
|
-
new report_1.Report.SemverRangeMismatch(
|
|
48
|
+
new report_1.Report.SemverRangeMismatch(valid)),
|
|
51
49
|
})),
|
|
52
50
|
}))))), effect_1.Effect.map(([allMismatches, allMatches]) => allMismatches.length === 0
|
|
53
51
|
? allMatches.map((thisMatch) => {
|
|
@@ -74,10 +72,7 @@ class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
|
74
72
|
// ✓ current version matches expected
|
|
75
73
|
// ! is not the original local package
|
|
76
74
|
// ✘ current specifier does not match every other specifier
|
|
77
|
-
return new report_1.Report.SameRangeMismatch(
|
|
78
|
-
unfixable: thisMatch.specifier.instance,
|
|
79
|
-
mismatches: (0, uniq_1.uniq)(mismatches.map((report) => report.specifier.instance.rawSpecifier)),
|
|
80
|
-
});
|
|
75
|
+
return new report_1.Report.SameRangeMismatch(thisMatch.specifier.instance, (0, uniq_1.uniq)(mismatches.map((report) => String(report.specifier.instance.rawSpecifier.raw))));
|
|
81
76
|
})
|
|
82
77
|
: // ✘ not every instance is valid on its own
|
|
83
78
|
// ! report on their validity individually ! when all are valid
|
|
@@ -98,10 +93,10 @@ function matchesRange(ctx, a, b) {
|
|
|
98
93
|
}
|
|
99
94
|
/** Get the semver version synchronously from a specifier known to contain semver */
|
|
100
95
|
function unwrapSemver(ctx, specifier) {
|
|
101
|
-
if (specifier._tag === '
|
|
96
|
+
if (specifier._tag === 'Range' || specifier._tag === 'Exact') {
|
|
102
97
|
return specifier.raw;
|
|
103
98
|
}
|
|
104
|
-
if (specifier._tag === '
|
|
99
|
+
if (specifier._tag === 'WorkspaceProtocol') {
|
|
105
100
|
return effect_1.Effect.runSync(specifier.getSemverEquivalent(ctx));
|
|
106
101
|
}
|
|
107
102
|
return effect_1.Effect.runSync(specifier.getSemver());
|
|
@@ -21,29 +21,24 @@ class SnappedToVersionGroup extends effect_1.Data.TaggedClass('SnappedTo') {
|
|
|
21
21
|
onFailure: () => effect_1.Effect.succeed(instances.map((instance) =>
|
|
22
22
|
// ✘ none of the snapTo packages contain this dependency
|
|
23
23
|
// ✘ is a user configuration error we can't auto-fix
|
|
24
|
-
new report_1.Report.MissingSnappedToMismatch(
|
|
25
|
-
onSuccess: (expected) => (0, effect_1.pipe)(instances, effect_1.Effect.forEach((instance) => (0, effect_1.pipe)(effect_1.Effect.Do, effect_1.Effect.bind('specifier', () => effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier))), effect_1.Effect.bind('expected', () => effect_1.Effect.succeed(specifier_1.Specifier.create(instance, expected.rawSpecifier))), effect_1.Effect.flatMap(({ expected, specifier }) => (0, effect_1.pipe)(expected.getSemver(), effect_1.Effect.matchEffect({
|
|
24
|
+
new report_1.Report.MissingSnappedToMismatch(instance))),
|
|
25
|
+
onSuccess: (expected) => (0, effect_1.pipe)(instances, effect_1.Effect.forEach((instance) => (0, effect_1.pipe)(effect_1.Effect.Do, effect_1.Effect.bind('specifier', () => effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier.raw))), effect_1.Effect.bind('expected', () => effect_1.Effect.succeed(specifier_1.Specifier.create(instance, expected.rawSpecifier.raw))), effect_1.Effect.flatMap(({ expected, specifier }) => (0, effect_1.pipe)(expected.getSemver(), effect_1.Effect.matchEffect({
|
|
26
26
|
onFailure: () => (0, effect_1.pipe)(specifier.replaceWith(expected), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
|
|
27
27
|
onFailure: () =>
|
|
28
28
|
// ✘ expected version is not semver
|
|
29
29
|
// ✘ semver group expects semver
|
|
30
30
|
// ✘ is a mismatch we can't auto-fix
|
|
31
|
-
new report_1.Report.UnsupportedMismatch(
|
|
32
|
-
|
|
33
|
-
}),
|
|
34
|
-
onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
|
|
31
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance),
|
|
32
|
+
onSuccess: (valid) => specifier.instance.rawSpecifier.raw === valid.raw
|
|
35
33
|
? // ! expected version is not semver
|
|
36
34
|
// ✓ semver group is disabled/ignored
|
|
37
35
|
// ✓ current version matches expected
|
|
38
|
-
new report_1.Report.Valid(
|
|
36
|
+
new report_1.Report.Valid(specifier)
|
|
39
37
|
: // ! expected version is not semver
|
|
40
38
|
// ✓ semver group is disabled/ignored
|
|
41
39
|
// ✘ current version mismatches expected
|
|
42
40
|
// ✓ is a mismatch we can auto-fix by replacing with the non-semver version
|
|
43
|
-
new report_1.Report.SnappedToMismatch(
|
|
44
|
-
fixable: valid,
|
|
45
|
-
localInstance: expected.instance,
|
|
46
|
-
}),
|
|
41
|
+
new report_1.Report.SnappedToMismatch(valid, expected.instance),
|
|
47
42
|
})),
|
|
48
43
|
onSuccess: () => (0, effect_1.pipe)(specifier.replaceWith(expected), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
|
|
49
44
|
onFailure: /* istanbul ignore next */ () =>
|
|
@@ -51,22 +46,17 @@ class SnappedToVersionGroup extends effect_1.Data.TaggedClass('SnappedTo') {
|
|
|
51
46
|
// ✘ expected version is not fixable by its semver group
|
|
52
47
|
// ✘ is a mismatch we can't auto-fix
|
|
53
48
|
// ✘ this should be impossible - we already proved the local version is exact semver
|
|
54
|
-
new report_1.Report.UnsupportedMismatch(
|
|
55
|
-
|
|
56
|
-
}),
|
|
57
|
-
onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
|
|
49
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance),
|
|
50
|
+
onSuccess: (valid) => specifier.instance.rawSpecifier.raw === valid.raw
|
|
58
51
|
? // ✓ expected version is semver
|
|
59
52
|
// ✓ expected version matches its semver group
|
|
60
53
|
// ✓ current version matches expected
|
|
61
|
-
new report_1.Report.Valid(
|
|
54
|
+
new report_1.Report.Valid(specifier)
|
|
62
55
|
: // ✓ expected version is semver
|
|
63
56
|
// ✓ expected version matches its semver group
|
|
64
57
|
// ✘ current version mismatches expected
|
|
65
58
|
// ✓ is a mismatch we can auto-fix
|
|
66
|
-
new report_1.Report.SnappedToMismatch(
|
|
67
|
-
fixable: valid,
|
|
68
|
-
localInstance: expected.instance,
|
|
69
|
-
}),
|
|
59
|
+
new report_1.Report.SnappedToMismatch(valid, expected.instance),
|
|
70
60
|
})),
|
|
71
61
|
})))))),
|
|
72
62
|
}), effect_1.Effect.map((reports) => ({ name, reports })))));
|
|
@@ -75,8 +65,8 @@ class SnappedToVersionGroup extends effect_1.Data.TaggedClass('SnappedTo') {
|
|
|
75
65
|
exports.SnappedToVersionGroup = SnappedToVersionGroup;
|
|
76
66
|
function findSnappedToInstance(name, snapTo, instances) {
|
|
77
67
|
for (const instance of instances) {
|
|
78
|
-
if (snapTo.includes(instance.pkgName) && instance.rawSpecifier) {
|
|
79
|
-
return (0, effect_1.pipe)(effect_1.Effect.succeed(instance), effect_1.Effect.tap(() => effect_1.Effect.logDebug(`found snapped to version ${instance.rawSpecifier} for ${name} in <${instance.packageJsonFile.jsonFile.shortPath}>`)));
|
|
68
|
+
if (snapTo.includes(instance.pkgName) && instance.rawSpecifier.raw) {
|
|
69
|
+
return (0, effect_1.pipe)(effect_1.Effect.succeed(instance), effect_1.Effect.tap(() => effect_1.Effect.logDebug(`found snapped to version ${String(instance.rawSpecifier.raw)} for ${name} in <${instance.packageJsonFile.jsonFile.shortPath}>`)));
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
return (0, effect_1.pipe)(effect_1.Effect.fail('getSnappedTo found nothing'), effect_1.Effect.tapError(() => effect_1.Effect.logError(`failed to get snapped to version for ${name} using ${JSON.stringify(snapTo)}`)));
|
|
@@ -23,95 +23,84 @@ class StandardVersionGroup extends effect_1.Data.TaggedClass('Standard') {
|
|
|
23
23
|
return effect_1.Effect.all(Object.entries((0, group_by_1.groupBy)('name', this.instances)).flatMap(([name, instances]) => {
|
|
24
24
|
const localInstance = getLocalInstance(instances);
|
|
25
25
|
if (localInstance) {
|
|
26
|
-
const localVersion = localInstance?.rawSpecifier;
|
|
27
|
-
return localVersion
|
|
28
|
-
?
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: (0, effect_1.pipe)(specifier.replaceWith(local), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
|
|
54
|
-
onFailure: /* istanbul ignore next */ () =>
|
|
55
|
-
// ! is not the local package instance
|
|
56
|
-
// ✘ local version is not fixable by this semver group
|
|
57
|
-
// ✘ is a mismatch we can't auto-fix
|
|
58
|
-
// ✘ this should be impossible - we already proved the local version is exact semver
|
|
59
|
-
new report_1.Report.UnsupportedMismatch({
|
|
60
|
-
unfixable: specifier.instance,
|
|
61
|
-
}),
|
|
62
|
-
onSuccess: (valid) => specifier.instance.rawSpecifier === valid.raw
|
|
26
|
+
const localVersion = localInstance?.rawSpecifier.raw;
|
|
27
|
+
return (0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(localInstance, localVersion)), effect_1.Effect.flatMap((local) => effect_1.Effect.all(local._tag !== 'Exact' && instances.length > 1
|
|
28
|
+
? instances.map((instance) =>
|
|
29
|
+
// ! dependency is a package developed in this repo
|
|
30
|
+
// ✘ local package has an invalid .version property
|
|
31
|
+
// ✘ is a mismatch we can't auto-fix
|
|
32
|
+
effect_1.Effect.succeed(new report_1.Report.MissingLocalVersion(instance, localInstance)))
|
|
33
|
+
: instances.flatMap((instance) =>
|
|
34
|
+
// instances.flatMap((instance) =>
|
|
35
|
+
(0, effect_1.pipe)(effect_1.Effect.succeed(specifier_1.Specifier.create(instance, instance.rawSpecifier.raw)), effect_1.Effect.flatMap((specifier) => specifier.instance === localInstance
|
|
36
|
+
? // ✓ this is the local package which the others should match
|
|
37
|
+
// ! its version must always remain as exact semver
|
|
38
|
+
// ! other instances need to be adjusted for their semver groups
|
|
39
|
+
effect_1.Effect.succeed(new report_1.Report.Valid(specifier))
|
|
40
|
+
: (0, effect_1.pipe)(specifier.replaceWith(local), specifier.instance.semverGroup.getFixed, effect_1.Effect.match({
|
|
41
|
+
onFailure: /* istanbul ignore next */ () =>
|
|
42
|
+
// ! is not the local package instance
|
|
43
|
+
// ✘ local version is not fixable by this semver group
|
|
44
|
+
// ✘ is a mismatch we can't auto-fix
|
|
45
|
+
// ✘ this should be impossible - we already proved the local version is exact semver
|
|
46
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance),
|
|
47
|
+
onSuccess: (valid) => specifier.instance.rawSpecifier.raw === valid.raw
|
|
48
|
+
? // ! is not the local package instance
|
|
49
|
+
// ✓ local version matches this semver group
|
|
50
|
+
// ✓ current version matches local
|
|
51
|
+
new report_1.Report.Valid(specifier)
|
|
52
|
+
: localVersion === 'PACKAGE_JSON_HAS_NO_VERSION'
|
|
63
53
|
? // ! is not the local package instance
|
|
54
|
+
// ✘ local package has a version defined
|
|
64
55
|
// ✓ local version matches this semver group
|
|
65
|
-
//
|
|
66
|
-
new report_1.Report.
|
|
56
|
+
// ✘ current version mismatches local
|
|
57
|
+
new report_1.Report.MissingLocalVersion(specifier.instance, localInstance)
|
|
67
58
|
: // ! is not the local package instance
|
|
59
|
+
// ✓ local package has a version defined
|
|
68
60
|
// ✓ local version matches this semver group
|
|
69
61
|
// ✘ current version mismatches local
|
|
70
|
-
new report_1.Report.LocalPackageMismatch(
|
|
71
|
-
|
|
72
|
-
localInstance,
|
|
73
|
-
}),
|
|
74
|
-
}))))))), effect_1.Effect.map((reports) => ({ name, reports })));
|
|
62
|
+
new report_1.Report.LocalPackageMismatch(valid, localInstance),
|
|
63
|
+
}))))))), effect_1.Effect.map((reports) => ({ name, reports })));
|
|
75
64
|
}
|
|
76
65
|
const PreferredMismatch = this.config.preferVersion === 'lowestSemver'
|
|
77
66
|
? report_1.Report.LowestSemverMismatch
|
|
78
67
|
: report_1.Report.HighestSemverMismatch;
|
|
79
|
-
return (0, effect_1.pipe)(effect_1.Effect.succeed(instances.map((instance) => specifier_1.Specifier.create(instance, instance.rawSpecifier))), effect_1.Effect.flatMap((specifiers) => (0, effect_1.pipe)((0, get_preferred_version_1.getPreferredVersion)(this.config.preferVersion, specifiers), effect_1.Effect.matchEffect({
|
|
80
|
-
onFailure: () => effect_1.Effect.succeed((0, uniq_1.uniq)(specifiers.map((specifier) => specifier.instance.rawSpecifier))
|
|
81
|
-
1
|
|
68
|
+
return (0, effect_1.pipe)(effect_1.Effect.succeed(instances.map((instance) => specifier_1.Specifier.create(instance, instance.rawSpecifier.raw))), effect_1.Effect.flatMap((specifiers) => (0, effect_1.pipe)((0, get_preferred_version_1.getPreferredVersion)(this.config.preferVersion, specifiers), effect_1.Effect.matchEffect({
|
|
69
|
+
onFailure: () => effect_1.Effect.succeed((0, uniq_1.uniq)(specifiers.map((specifier) => specifier.instance.rawSpecifier.raw))
|
|
70
|
+
.length === 1
|
|
82
71
|
? specifiers.map((specifier) =>
|
|
83
72
|
// ✘ not every version is semver
|
|
84
73
|
// ✓ every version is identical
|
|
85
74
|
// ✓ is a match
|
|
86
|
-
new report_1.Report.Valid(
|
|
75
|
+
new report_1.Report.Valid(specifier))
|
|
87
76
|
: instances.map((instance) =>
|
|
88
77
|
// ✘ not every version is semver
|
|
89
78
|
// ✘ some versions are not identical
|
|
90
79
|
// ✘ is a mismatch we can't auto-fix
|
|
91
|
-
new report_1.Report.UnsupportedMismatch(
|
|
80
|
+
new report_1.Report.UnsupportedMismatch(instance))),
|
|
92
81
|
onSuccess: (expectedVersion) => (0, effect_1.pipe)(specifiers, effect_1.Effect.forEach((current) => (0, effect_1.pipe)(current.replaceWith(expectedVersion), current.instance.semverGroup.getFixed, effect_1.Effect.match({
|
|
93
82
|
onFailure: /* istanbul ignore next */ () =>
|
|
94
83
|
// ✓ every version is semver
|
|
95
84
|
// ✘ expected version is not fixable by its semver group
|
|
96
85
|
// ✘ is a mismatch we can't auto-fix
|
|
97
86
|
// ✘ this should be impossible - any valid semver is fixable by a semver group
|
|
98
|
-
new report_1.Report.UnsupportedMismatch(
|
|
99
|
-
onSuccess: (expectedRange) => current.instance.rawSpecifier === expectedRange.raw
|
|
87
|
+
new report_1.Report.UnsupportedMismatch(current.instance),
|
|
88
|
+
onSuccess: (expectedRange) => current.instance.rawSpecifier.raw === expectedRange.raw
|
|
100
89
|
? // ✓ every version is semver
|
|
101
90
|
// ✓ current version matches expected semver
|
|
102
91
|
// ✓ current version matches expected version
|
|
103
|
-
new report_1.Report.Valid(
|
|
104
|
-
: current.instance.rawSpecifier === expectedVersion.raw
|
|
92
|
+
new report_1.Report.Valid(current)
|
|
93
|
+
: current.instance.rawSpecifier.raw === expectedVersion.raw
|
|
105
94
|
? // ✓ every version is semver
|
|
106
95
|
// ✓ current version matches expected version
|
|
107
96
|
// ✘ current version does not match expected semver
|
|
108
97
|
// ✓ is a mismatch we can auto-fix
|
|
109
|
-
new report_1.Report.SemverRangeMismatch(
|
|
98
|
+
new report_1.Report.SemverRangeMismatch(expectedRange)
|
|
110
99
|
: // ✓ every version is semver
|
|
111
100
|
// ✘ current version does not match expected version
|
|
112
101
|
// ✘ expected version does not match expected semver
|
|
113
102
|
// ✓ is a mismatch we can auto-fix
|
|
114
|
-
new PreferredMismatch(
|
|
103
|
+
new PreferredMismatch(expectedRange),
|
|
115
104
|
})))),
|
|
116
105
|
}))), effect_1.Effect.map((reports) => ({ name, reports })));
|
|
117
106
|
}));
|
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": "12.0
|
|
4
|
+
"version": "12.2.0",
|
|
5
5
|
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"syncpack": "dist/bin.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"Tom Fletcher (https://github.com/tom-fletcher)"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@effect/schema": "0.56.
|
|
36
|
+
"@effect/schema": "0.56.1",
|
|
37
37
|
"chalk": "4.1.2",
|
|
38
38
|
"commander": "11.1.0",
|
|
39
39
|
"cosmiconfig": "9.0.0",
|
|
@@ -53,19 +53,19 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@release-it/conventional-changelog": "8.0.1",
|
|
55
55
|
"@tsconfig/node18": "18.2.2",
|
|
56
|
-
"@types/node": "20.10.
|
|
56
|
+
"@types/node": "20.10.6",
|
|
57
57
|
"@types/npm-package-arg": "6.1.4",
|
|
58
58
|
"@types/prompts": "2.4.9",
|
|
59
59
|
"@types/semver": "7.5.6",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
61
|
-
"@typescript-eslint/parser": "6.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "6.16.0",
|
|
61
|
+
"@typescript-eslint/parser": "6.16.0",
|
|
62
62
|
"@vitest/coverage-v8": "1.1.0",
|
|
63
63
|
"auto-changelog": "2.4.0",
|
|
64
64
|
"eslint": "8.56.0",
|
|
65
65
|
"eslint-plugin-import": "2.29.1",
|
|
66
66
|
"memfs": "4.6.0",
|
|
67
67
|
"prettier": "3.1.1",
|
|
68
|
-
"prettier-plugin-astro": "0.12.
|
|
68
|
+
"prettier-plugin-astro": "0.12.3",
|
|
69
69
|
"quill-delta": "5.1.0",
|
|
70
70
|
"release-it": "17.0.1",
|
|
71
71
|
"rxjs": "7.8.1",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"repository": "JamieMason/syncpack",
|
|
117
117
|
"scripts": {
|
|
118
118
|
"build": "pnpm run clean && pnpm run build:source && pnpm run build:json-schema",
|
|
119
|
-
"build:json-schema": "typescript-json-schema --noExtraProps src/index.ts RcFile --out dist/schema.json",
|
|
119
|
+
"build:json-schema": "typescript-json-schema --esModuleInterop --noExtraProps src/index.ts RcFile --out dist/schema.json",
|
|
120
120
|
"build:source": "tsc --project tsconfig.build.json",
|
|
121
121
|
"clean": "rm -rf ./dist",
|
|
122
122
|
"format": "pnpm run format:lint && pnpm run format:source",
|