syncpack 13.0.1 → 14.0.0-alpha.2
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 +0 -3
- package/index.js +48 -0
- package/package.json +16 -73
- package/schema.json +917 -0
- package/syncpack.d.ts +122 -0
- package/LICENSE +0 -20
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +0 -16
- package/dist/bin-fix-mismatches/fix-mismatches.js +0 -115
- package/dist/bin-fix-mismatches/index.d.ts +0 -2
- package/dist/bin-fix-mismatches/index.js +0 -33
- package/dist/bin-format/format.d.ts +0 -13
- package/dist/bin-format/format.js +0 -92
- package/dist/bin-format/index.d.ts +0 -2
- package/dist/bin-format/index.js +0 -28
- package/dist/bin-lint/index.d.ts +0 -2
- package/dist/bin-lint/index.js +0 -17
- package/dist/bin-lint/lint.d.ts +0 -11
- package/dist/bin-lint/lint.js +0 -52
- package/dist/bin-lint-semver-ranges/index.d.ts +0 -2
- package/dist/bin-lint-semver-ranges/index.js +0 -30
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +0 -16
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +0 -92
- package/dist/bin-list/index.d.ts +0 -2
- package/dist/bin-list/index.js +0 -27
- package/dist/bin-list/list.d.ts +0 -14
- package/dist/bin-list/list.js +0 -151
- package/dist/bin-list-mismatches/index.d.ts +0 -2
- package/dist/bin-list-mismatches/index.js +0 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +0 -18
- package/dist/bin-list-mismatches/list-mismatches.js +0 -224
- package/dist/bin-prompt/index.d.ts +0 -2
- package/dist/bin-prompt/index.js +0 -29
- package/dist/bin-prompt/prompt.d.ts +0 -11
- package/dist/bin-prompt/prompt.js +0 -95
- package/dist/bin-set-semver-ranges/index.d.ts +0 -2
- package/dist/bin-set-semver-ranges/index.js +0 -32
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +0 -11
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +0 -61
- package/dist/bin-update/effects.d.ts +0 -52
- package/dist/bin-update/effects.js +0 -282
- package/dist/bin-update/index.d.ts +0 -2
- package/dist/bin-update/index.js +0 -24
- package/dist/bin-update/update.d.ts +0 -6
- package/dist/bin-update/update.js +0 -59
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -37
- package/dist/config/get-custom-types.d.ts +0 -19
- package/dist/config/get-custom-types.js +0 -57
- package/dist/config/get-enabled-types.d.ts +0 -17
- package/dist/config/get-enabled-types.js +0 -109
- package/dist/config/get-filter.d.ts +0 -2
- package/dist/config/get-filter.js +0 -10
- package/dist/config/get-indent.d.ts +0 -2
- package/dist/config/get-indent.js +0 -9
- package/dist/config/get-sort-az.d.ts +0 -2
- package/dist/config/get-sort-az.js +0 -8
- package/dist/config/get-sort-exports.d.ts +0 -2
- package/dist/config/get-sort-exports.js +0 -9
- package/dist/config/get-sort-first.d.ts +0 -2
- package/dist/config/get-sort-first.js +0 -8
- package/dist/config/get-source.d.ts +0 -2
- package/dist/config/get-source.js +0 -8
- package/dist/config/tag.d.ts +0 -3
- package/dist/config/tag.js +0 -2
- package/dist/config/types.d.ts +0 -134
- package/dist/config/types.js +0 -1
- package/dist/constants.d.ts +0 -106
- package/dist/constants.js +0 -103
- package/dist/error-handlers/default-error-handlers.d.ts +0 -25
- package/dist/error-handlers/default-error-handlers.js +0 -80
- package/dist/get-context/index.d.ts +0 -23
- package/dist/get-context/index.js +0 -18
- package/dist/get-context/lib/key-by.d.ts +0 -6
- package/dist/get-context/lib/key-by.js +0 -12
- package/dist/get-instances/index.d.ts +0 -14
- package/dist/get-instances/index.js +0 -42
- package/dist/get-instances/instance.d.ts +0 -26
- package/dist/get-instances/instance.js +0 -35
- package/dist/get-package-json-files/get-file-paths.d.ts +0 -21
- package/dist/get-package-json-files/get-file-paths.js +0 -22
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +0 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +0 -14
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +0 -16
- package/dist/get-package-json-files/get-patterns/index.d.ts +0 -8
- package/dist/get-package-json-files/get-patterns/index.js +0 -23
- package/dist/get-package-json-files/index.d.ts +0 -10
- package/dist/get-package-json-files/index.js +0 -8
- package/dist/get-package-json-files/package-json-file.d.ts +0 -54
- package/dist/get-package-json-files/package-json-file.js +0 -44
- package/dist/guards/can-add-to-group.d.ts +0 -5
- package/dist/guards/can-add-to-group.js +0 -58
- package/dist/guards/is-semver.d.ts +0 -2
- package/dist/guards/is-semver.js +0 -15
- package/dist/guards/is-valid-semver-range.d.ts +0 -3
- package/dist/guards/is-valid-semver-range.js +0 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/io/ask-for-choice.d.ts +0 -14
- package/dist/io/ask-for-choice.js +0 -17
- package/dist/io/ask-for-input.d.ts +0 -13
- package/dist/io/ask-for-input.js +0 -14
- package/dist/io/exit-if-invalid.d.ts +0 -4
- package/dist/io/exit-if-invalid.js +0 -9
- package/dist/io/glob-sync.d.ts +0 -11
- package/dist/io/glob-sync.js +0 -14
- package/dist/io/index.d.ts +0 -27
- package/dist/io/index.js +0 -26
- package/dist/io/read-config-file.d.ts +0 -7
- package/dist/io/read-config-file.js +0 -24
- package/dist/io/read-file-sync.d.ts +0 -12
- package/dist/io/read-file-sync.js +0 -9
- package/dist/io/read-json-file-sync.d.ts +0 -31
- package/dist/io/read-json-file-sync.js +0 -23
- package/dist/io/read-yaml-file-sync.d.ts +0 -12
- package/dist/io/read-yaml-file-sync.js +0 -9
- package/dist/io/to-formatted-json.d.ts +0 -9
- package/dist/io/to-formatted-json.js +0 -32
- package/dist/io/write-file-sync.d.ts +0 -12
- package/dist/io/write-file-sync.js +0 -10
- package/dist/io/write-if-changed.d.ts +0 -5
- package/dist/io/write-if-changed.js +0 -9
- package/dist/lib/format-repository-url.d.ts +0 -1
- package/dist/lib/format-repository-url.js +0 -40
- package/dist/lib/get-group-header.d.ts +0 -10
- package/dist/lib/get-group-header.js +0 -25
- package/dist/lib/get.d.ts +0 -11
- package/dist/lib/get.js +0 -44
- package/dist/lib/pad-start.d.ts +0 -1
- package/dist/lib/pad-start.js +0 -3
- package/dist/lib/ring-buffer.d.ts +0 -10
- package/dist/lib/ring-buffer.js +0 -20
- package/dist/lib/set-semver-range.d.ts +0 -3
- package/dist/lib/set-semver-range.js +0 -24
- package/dist/lib/show-help-on-error.d.ts +0 -2
- package/dist/lib/show-help-on-error.js +0 -32
- package/dist/lib/sort-by-name.d.ts +0 -5
- package/dist/lib/sort-by-name.js +0 -9
- package/dist/lib/with-logger.d.ts +0 -2
- package/dist/lib/with-logger.js +0 -28
- package/dist/option.d.ts +0 -10
- package/dist/option.js +0 -30
- package/dist/report.d.ts +0 -131
- package/dist/report.js +0 -129
- package/dist/schema.json +0 -614
- package/dist/semver-group/create-semver-groups.d.ts +0 -4
- package/dist/semver-group/create-semver-groups.js +0 -83
- package/dist/semver-group/disabled.d.ts +0 -26
- package/dist/semver-group/disabled.js +0 -28
- package/dist/semver-group/filtered-out.d.ts +0 -27
- package/dist/semver-group/filtered-out.js +0 -34
- package/dist/semver-group/ignored.d.ts +0 -22
- package/dist/semver-group/ignored.js +0 -24
- package/dist/semver-group/index.d.ts +0 -20
- package/dist/semver-group/index.js +0 -7
- package/dist/semver-group/with-range.d.ts +0 -22
- package/dist/semver-group/with-range.js +0 -45
- package/dist/specifier/alias.d.ts +0 -17
- package/dist/specifier/alias.js +0 -21
- package/dist/specifier/base.d.ts +0 -41
- package/dist/specifier/base.js +0 -54
- package/dist/specifier/delete.d.ts +0 -17
- package/dist/specifier/delete.js +0 -16
- package/dist/specifier/exact.d.ts +0 -20
- package/dist/specifier/exact.js +0 -21
- package/dist/specifier/file.d.ts +0 -8
- package/dist/specifier/file.js +0 -7
- package/dist/specifier/hosted-git.d.ts +0 -15
- package/dist/specifier/hosted-git.js +0 -24
- package/dist/specifier/index.d.ts +0 -28
- package/dist/specifier/index.js +0 -75
- package/dist/specifier/latest.d.ts +0 -19
- package/dist/specifier/latest.js +0 -20
- package/dist/specifier/lib/non-semver-error.d.ts +0 -11
- package/dist/specifier/lib/non-semver-error.js +0 -6
- package/dist/specifier/lib/parse-specifier.d.ts +0 -14
- package/dist/specifier/lib/parse-specifier.js +0 -18
- package/dist/specifier/lib/specific-registry-result.d.ts +0 -9
- package/dist/specifier/lib/specific-registry-result.js +0 -1
- package/dist/specifier/range.d.ts +0 -19
- package/dist/specifier/range.js +0 -20
- package/dist/specifier/tag.d.ts +0 -11
- package/dist/specifier/tag.js +0 -10
- package/dist/specifier/unsupported.d.ts +0 -7
- package/dist/specifier/unsupported.js +0 -7
- package/dist/specifier/url.d.ts +0 -8
- package/dist/specifier/url.js +0 -7
- package/dist/specifier/workspace-protocol.d.ts +0 -19
- package/dist/specifier/workspace-protocol.js +0 -35
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +0 -3
- package/dist/strategy/lib/get-non-empty-string-prop.js +0 -7
- package/dist/strategy/name-and-version-props.d.ts +0 -12
- package/dist/strategy/name-and-version-props.js +0 -60
- package/dist/strategy/named-version-string.d.ts +0 -11
- package/dist/strategy/named-version-string.js +0 -52
- package/dist/strategy/unnamed-version-string.d.ts +0 -11
- package/dist/strategy/unnamed-version-string.js +0 -45
- package/dist/strategy/versions-by-name.d.ts +0 -11
- package/dist/strategy/versions-by-name.js +0 -27
- package/dist/version-group/banned.d.ts +0 -17
- package/dist/version-group/banned.js +0 -26
- package/dist/version-group/create-version-groups.d.ts +0 -4
- package/dist/version-group/create-version-groups.js +0 -118
- package/dist/version-group/filtered-out.d.ts +0 -19
- package/dist/version-group/filtered-out.js +0 -30
- package/dist/version-group/ignored.d.ts +0 -17
- package/dist/version-group/ignored.js +0 -23
- package/dist/version-group/index.d.ts +0 -26
- package/dist/version-group/index.js +0 -7
- package/dist/version-group/lib/clean.d.ts +0 -2
- package/dist/version-group/lib/clean.js +0 -6
- package/dist/version-group/lib/delete.d.ts +0 -2
- package/dist/version-group/lib/delete.js +0 -1
- package/dist/version-group/lib/get-highest-version.d.ts +0 -6
- package/dist/version-group/lib/get-highest-version.js +0 -8
- package/dist/version-group/lib/get-lowest-version.d.ts +0 -6
- package/dist/version-group/lib/get-lowest-version.js +0 -8
- package/dist/version-group/lib/get-preferred-version.d.ts +0 -5
- package/dist/version-group/lib/get-preferred-version.js +0 -53
- package/dist/version-group/lib/get-range-score.d.ts +0 -2
- package/dist/version-group/lib/get-range-score.js +0 -20
- package/dist/version-group/lib/group-by.d.ts +0 -5
- package/dist/version-group/lib/group-by.js +0 -11
- package/dist/version-group/pinned.d.ts +0 -17
- package/dist/version-group/pinned.js +0 -26
- package/dist/version-group/same-range.d.ts +0 -19
- package/dist/version-group/same-range.js +0 -96
- package/dist/version-group/snapped-to.d.ts +0 -17
- package/dist/version-group/snapped-to.js +0 -71
- package/dist/version-group/standard.d.ts +0 -18
- package/dist/version-group/standard.js +0 -119
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Data, Effect, pipe } from 'effect';
|
|
2
|
-
import { Report } from '../report.js';
|
|
3
|
-
import { Specifier } from '../specifier/index.js';
|
|
4
|
-
import { groupBy } from './lib/group-by.js';
|
|
5
|
-
export class SnappedToVersionGroup extends Data.TaggedClass('SnappedTo') {
|
|
6
|
-
groupType = 'versionGroup';
|
|
7
|
-
constructor(config) {
|
|
8
|
-
super({
|
|
9
|
-
config,
|
|
10
|
-
instances: [],
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
canAdd(_) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
inspectAll() {
|
|
17
|
-
return Effect.all(Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) => pipe(findSnappedToInstance(name, this.config.snapTo, instances), Effect.matchEffect({
|
|
18
|
-
onFailure: () => Effect.succeed(instances.map(instance =>
|
|
19
|
-
// ✘ none of the snapTo packages contain this dependency
|
|
20
|
-
// ✘ is a user configuration error we can't auto-fix
|
|
21
|
-
new Report.MissingSnappedToMismatch(instance))),
|
|
22
|
-
onSuccess: expected => pipe(instances, Effect.forEach(instance => pipe(Effect.Do, Effect.bind('specifier', () => Effect.succeed(Specifier.create(instance, instance.rawSpecifier.raw))), Effect.bind('expected', () => Effect.succeed(Specifier.create(instance, expected.rawSpecifier.raw))), Effect.flatMap(({ expected, specifier }) => pipe(expected.getSemver(), Effect.matchEffect({
|
|
23
|
-
onFailure: () => pipe(specifier.replaceWith(expected), specifier.instance.semverGroup.getFixed, Effect.match({
|
|
24
|
-
onFailure: () =>
|
|
25
|
-
// ✘ expected version is not semver
|
|
26
|
-
// ✘ semver group expects semver
|
|
27
|
-
// ✘ is a mismatch we can't auto-fix
|
|
28
|
-
new Report.UnsupportedMismatch(specifier.instance),
|
|
29
|
-
onSuccess: valid => specifier.instance.rawSpecifier.raw ===
|
|
30
|
-
valid.raw
|
|
31
|
-
? // ! expected version is not semver
|
|
32
|
-
// ✓ semver group is disabled/ignored
|
|
33
|
-
// ✓ current version matches expected
|
|
34
|
-
new Report.Valid(specifier)
|
|
35
|
-
: // ! expected version is not semver
|
|
36
|
-
// ✓ semver group is disabled/ignored
|
|
37
|
-
// ✘ current version mismatches expected
|
|
38
|
-
// ✓ is a mismatch we can auto-fix by replacing with the non-semver version
|
|
39
|
-
new Report.SnappedToMismatch(valid, expected.instance),
|
|
40
|
-
})),
|
|
41
|
-
onSuccess: () => pipe(specifier.replaceWith(expected), specifier.instance.semverGroup.getFixed, Effect.match({
|
|
42
|
-
onFailure: /* istanbul ignore next */ () =>
|
|
43
|
-
// ✓ expected version is semver
|
|
44
|
-
// ✘ expected version is not fixable by its semver group
|
|
45
|
-
// ✘ is a mismatch we can't auto-fix
|
|
46
|
-
// ✘ this should be impossible - we already proved the local version is exact semver
|
|
47
|
-
new Report.UnsupportedMismatch(specifier.instance),
|
|
48
|
-
onSuccess: valid => specifier.instance.rawSpecifier.raw ===
|
|
49
|
-
valid.raw
|
|
50
|
-
? // ✓ expected version is semver
|
|
51
|
-
// ✓ expected version matches its semver group
|
|
52
|
-
// ✓ current version matches expected
|
|
53
|
-
new Report.Valid(specifier)
|
|
54
|
-
: // ✓ expected version is semver
|
|
55
|
-
// ✓ expected version matches its semver group
|
|
56
|
-
// ✘ current version mismatches expected
|
|
57
|
-
// ✓ is a mismatch we can auto-fix
|
|
58
|
-
new Report.SnappedToMismatch(valid, expected.instance),
|
|
59
|
-
})),
|
|
60
|
-
})))))),
|
|
61
|
-
}), Effect.map(reports => ({ name, reports })))));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function findSnappedToInstance(name, snapTo, instances) {
|
|
65
|
-
for (const instance of instances) {
|
|
66
|
-
if (snapTo.includes(instance.pkgName) && instance.rawSpecifier.raw) {
|
|
67
|
-
return pipe(Effect.succeed(instance), Effect.tap(() => Effect.logDebug(`found snapped to version ${String(instance.rawSpecifier.raw)} for ${name} in <${instance.packageJsonFile.jsonFile.shortPath}>`)));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return pipe(Effect.fail('getSnappedTo found nothing'), Effect.tapError(() => Effect.logError(`failed to get snapped to version for ${name} using ${JSON.stringify(snapTo)}`)));
|
|
71
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types.js';
|
|
3
|
-
import type { Instance } from '../get-instances/instance.js';
|
|
4
|
-
import { Report } from '../report.js';
|
|
5
|
-
declare const StandardVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
|
|
6
|
-
readonly _tag: "Standard";
|
|
7
|
-
};
|
|
8
|
-
export declare class StandardVersionGroup extends StandardVersionGroup_base<{
|
|
9
|
-
config: VersionGroupConfig.Standard;
|
|
10
|
-
instances: Instance[];
|
|
11
|
-
isCatchAll: boolean;
|
|
12
|
-
}> {
|
|
13
|
-
groupType: string;
|
|
14
|
-
constructor(isCatchAll: boolean, config: VersionGroupConfig.Standard);
|
|
15
|
-
canAdd(_: Instance): boolean;
|
|
16
|
-
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Data, Effect, pipe } from 'effect';
|
|
2
|
-
import { uniq } from 'tightrope/array/uniq.js';
|
|
3
|
-
import { Report } from '../report.js';
|
|
4
|
-
import { Specifier } from '../specifier/index.js';
|
|
5
|
-
import { getPreferredVersion } from './lib/get-preferred-version.js';
|
|
6
|
-
import { groupBy } from './lib/group-by.js';
|
|
7
|
-
export class StandardVersionGroup extends Data.TaggedClass('Standard') {
|
|
8
|
-
groupType = 'versionGroup';
|
|
9
|
-
constructor(isCatchAll, config) {
|
|
10
|
-
super({
|
|
11
|
-
config,
|
|
12
|
-
instances: [],
|
|
13
|
-
isCatchAll,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
canAdd(_) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
inspectAll() {
|
|
20
|
-
return Effect.all(Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) => {
|
|
21
|
-
const localInstance = getLocalInstance(instances);
|
|
22
|
-
if (localInstance) {
|
|
23
|
-
const localVersion = localInstance?.rawSpecifier.raw;
|
|
24
|
-
return pipe(Effect.succeed(Specifier.create(localInstance, localVersion)), Effect.flatMap(local => Effect.all(local._tag !== 'Exact' && instances.length > 1
|
|
25
|
-
? instances.map(instance =>
|
|
26
|
-
// ! dependency is a package developed in this repo
|
|
27
|
-
// ✘ local package has an invalid .version property
|
|
28
|
-
// ✘ is a mismatch we can't auto-fix
|
|
29
|
-
Effect.succeed(new Report.MissingLocalVersion(instance, localInstance)))
|
|
30
|
-
: instances.flatMap(instance =>
|
|
31
|
-
// instances.flatMap((instance) =>
|
|
32
|
-
pipe(Effect.succeed(Specifier.create(instance, instance.rawSpecifier.raw)), Effect.flatMap(specifier => specifier.instance === localInstance
|
|
33
|
-
? // ✓ this is the local package which the others should match
|
|
34
|
-
// ! its version must always remain as exact semver
|
|
35
|
-
// ! other instances need to be adjusted for their semver groups
|
|
36
|
-
Effect.succeed(new Report.Valid(specifier))
|
|
37
|
-
: pipe(specifier.replaceWith(local), specifier.instance.semverGroup.getFixed, Effect.match({
|
|
38
|
-
onFailure: /* istanbul ignore next */ () =>
|
|
39
|
-
// ! is not the local package instance
|
|
40
|
-
// ✘ local version is not fixable by this semver group
|
|
41
|
-
// ✘ is a mismatch we can't auto-fix
|
|
42
|
-
// ✘ this should be impossible - we already proved the local version is exact semver
|
|
43
|
-
new Report.UnsupportedMismatch(specifier.instance),
|
|
44
|
-
onSuccess: valid => specifier.instance.rawSpecifier.raw ===
|
|
45
|
-
valid.raw
|
|
46
|
-
? // ! is not the local package instance
|
|
47
|
-
// ✓ local version matches this semver group
|
|
48
|
-
// ✓ current version matches local
|
|
49
|
-
new Report.Valid(specifier)
|
|
50
|
-
: localVersion ===
|
|
51
|
-
'PACKAGE_JSON_HAS_NO_VERSION'
|
|
52
|
-
? // ! is not the local package instance
|
|
53
|
-
// ✘ local package has a version defined
|
|
54
|
-
// ✓ local version matches this semver group
|
|
55
|
-
// ✘ current version mismatches local
|
|
56
|
-
new Report.MissingLocalVersion(specifier.instance, localInstance)
|
|
57
|
-
: // ! is not the local package instance
|
|
58
|
-
// ✓ local package has a version defined
|
|
59
|
-
// ✓ local version matches this semver group
|
|
60
|
-
// ✘ current version mismatches local
|
|
61
|
-
new Report.LocalPackageMismatch(valid, localInstance),
|
|
62
|
-
}))))))), Effect.map(reports => ({ name, reports })));
|
|
63
|
-
}
|
|
64
|
-
const PreferredMismatch = this.config.preferVersion === 'lowestSemver'
|
|
65
|
-
? Report.LowestSemverMismatch
|
|
66
|
-
: Report.HighestSemverMismatch;
|
|
67
|
-
return pipe(Effect.succeed(instances.map(instance => Specifier.create(instance, instance.rawSpecifier.raw))), Effect.flatMap(specifiers => pipe(getPreferredVersion(this.config.preferVersion, specifiers), Effect.matchEffect({
|
|
68
|
-
onFailure: () => Effect.succeed(uniq(specifiers.map(specifier => specifier.instance.rawSpecifier.raw)).length === 1
|
|
69
|
-
? specifiers.map(specifier =>
|
|
70
|
-
// ✘ not every version is semver
|
|
71
|
-
// ✓ every version is identical
|
|
72
|
-
// ✓ is a match
|
|
73
|
-
new Report.Valid(specifier))
|
|
74
|
-
: instances.map(instance =>
|
|
75
|
-
// ✘ not every version is semver
|
|
76
|
-
// ✘ some versions are not identical
|
|
77
|
-
// ✘ is a mismatch we can't auto-fix
|
|
78
|
-
new Report.UnsupportedMismatch(instance))),
|
|
79
|
-
onSuccess: expectedVersion => pipe(specifiers, Effect.forEach(current => pipe(current.replaceWith(expectedVersion), current.instance.semverGroup.getFixed, Effect.match({
|
|
80
|
-
onFailure: /* istanbul ignore next */ () =>
|
|
81
|
-
// ✓ every version is semver
|
|
82
|
-
// ✘ expected version is not fixable by its semver group
|
|
83
|
-
// ✘ is a mismatch we can't auto-fix
|
|
84
|
-
// ✘ this should be impossible - any valid semver is fixable by a semver group
|
|
85
|
-
new Report.UnsupportedMismatch(current.instance),
|
|
86
|
-
onSuccess: expectedRange => current.instance.rawSpecifier.raw ===
|
|
87
|
-
expectedRange.raw
|
|
88
|
-
? // ✓ every version is semver
|
|
89
|
-
// ✓ current version matches expected semver
|
|
90
|
-
// ✓ current version matches expected version
|
|
91
|
-
new Report.Valid(current)
|
|
92
|
-
: current.instance.rawSpecifier.raw ===
|
|
93
|
-
expectedVersion.raw
|
|
94
|
-
? // ✓ every version is semver
|
|
95
|
-
// ✓ current version matches expected version
|
|
96
|
-
// ✘ current version does not match expected semver
|
|
97
|
-
// ✓ is a mismatch we can auto-fix
|
|
98
|
-
new Report.SemverRangeMismatch(expectedRange)
|
|
99
|
-
: // ✓ every version is semver
|
|
100
|
-
// ✘ current version does not match expected version
|
|
101
|
-
// ✘ expected version does not match expected semver
|
|
102
|
-
// ✓ is a mismatch we can auto-fix
|
|
103
|
-
new PreferredMismatch(expectedRange),
|
|
104
|
-
})))),
|
|
105
|
-
}))), Effect.map(reports => ({ name, reports })));
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* If this dependency is developed in this monorepo, get the instance which
|
|
111
|
-
* represents the canonical .version property of its package.json file.
|
|
112
|
-
*/
|
|
113
|
-
function getLocalInstance(instances) {
|
|
114
|
-
return instances.find(isLocalInstance);
|
|
115
|
-
}
|
|
116
|
-
/** Is this dependency developed in this monorepo */
|
|
117
|
-
function isLocalInstance(instance) {
|
|
118
|
-
return instance.strategy.name === 'local';
|
|
119
|
-
}
|