syncpack 12.2.0 → 12.3.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/README.md +5 -5
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +9 -9
- package/dist/bin-fix-mismatches/fix-mismatches.js +43 -54
- package/dist/bin-fix-mismatches/index.js +26 -31
- package/dist/bin-format/format.d.ts +6 -4
- package/dist/bin-format/format.js +78 -53
- package/dist/bin-format/index.js +20 -25
- package/dist/bin-lint/index.js +15 -20
- package/dist/bin-lint/lint.d.ts +4 -4
- package/dist/bin-lint/lint.js +51 -19
- package/dist/bin-lint-semver-ranges/index.js +24 -29
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +8 -8
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +34 -44
- package/dist/bin-list/index.js +24 -29
- package/dist/bin-list/list.d.ts +7 -7
- package/dist/bin-list/list.js +55 -64
- package/dist/bin-list-mismatches/index.js +24 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +10 -10
- package/dist/bin-list-mismatches/list-mismatches.js +62 -70
- package/dist/bin-prompt/index.js +26 -31
- package/dist/bin-prompt/prompt.d.ts +4 -4
- package/dist/bin-prompt/prompt.js +41 -48
- package/dist/bin-set-semver-ranges/index.js +26 -31
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +26 -30
- package/dist/bin-update/effects.d.ts +18 -18
- package/dist/bin-update/effects.js +77 -106
- package/dist/bin-update/index.js +23 -28
- package/dist/bin-update/update.d.ts +5 -5
- package/dist/bin-update/update.js +37 -45
- package/dist/bin.js +8 -5
- package/dist/config/get-custom-types.d.ts +9 -9
- package/dist/config/get-custom-types.js +22 -27
- package/dist/config/get-enabled-types.d.ts +8 -8
- package/dist/config/get-enabled-types.js +42 -48
- package/dist/config/get-filter.d.ts +1 -1
- package/dist/config/get-filter.js +6 -9
- package/dist/config/get-indent.d.ts +1 -1
- package/dist/config/get-indent.js +6 -9
- package/dist/config/get-sort-az.d.ts +1 -1
- package/dist/config/get-sort-az.js +6 -17
- package/dist/config/get-sort-exports.d.ts +2 -0
- package/dist/config/get-sort-exports.js +8 -0
- package/dist/config/get-sort-first.d.ts +1 -1
- package/dist/config/get-sort-first.js +6 -8
- package/dist/config/get-source.d.ts +1 -1
- package/dist/config/get-source.js +4 -8
- package/dist/config/tag.d.ts +1 -1
- package/dist/config/tag.js +2 -5
- package/dist/config/types.d.ts +16 -5
- package/dist/config/types.js +1 -2
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +25 -10
- package/dist/error-handlers/default-error-handlers.d.ts +10 -10
- package/dist/error-handlers/default-error-handlers.js +55 -61
- package/dist/get-context/index.d.ts +5 -5
- package/dist/get-context/index.js +13 -17
- package/dist/get-context/lib/key-by.js +1 -5
- package/dist/get-instances/index.d.ts +7 -7
- package/dist/get-instances/index.js +19 -23
- package/dist/get-instances/instance.d.ts +7 -7
- package/dist/get-instances/instance.js +4 -8
- package/dist/get-package-json-files/get-file-paths.d.ts +7 -7
- package/dist/get-package-json-files/get-file-paths.js +10 -15
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +14 -18
- package/dist/get-package-json-files/get-patterns/index.d.ts +3 -3
- package/dist/get-package-json-files/get-patterns/index.js +11 -15
- package/dist/get-package-json-files/index.d.ts +8 -8
- package/dist/get-package-json-files/index.js +6 -10
- package/dist/get-package-json-files/package-json-file.d.ts +6 -6
- package/dist/get-package-json-files/package-json-file.js +8 -12
- package/dist/guards/can-add-to-group.d.ts +4 -4
- package/dist/guards/can-add-to-group.js +10 -14
- package/dist/guards/is-semver.js +3 -7
- package/dist/guards/is-valid-semver-range.d.ts +1 -1
- package/dist/guards/is-valid-semver-range.js +12 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/io/ask-for-choice.d.ts +5 -5
- package/dist/io/ask-for-choice.js +5 -9
- package/dist/io/ask-for-input.d.ts +5 -5
- package/dist/io/ask-for-input.js +5 -9
- package/dist/io/exit-if-invalid.d.ts +3 -3
- package/dist/io/exit-if-invalid.js +5 -9
- package/dist/io/glob-sync.d.ts +5 -5
- package/dist/io/glob-sync.js +4 -9
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +12 -38
- package/dist/io/read-config-file.d.ts +7 -0
- package/dist/io/read-config-file.js +22 -0
- package/dist/io/read-file-sync.d.ts +5 -5
- package/dist/io/read-file-sync.js +4 -9
- package/dist/io/read-json-file-sync.d.ts +8 -8
- package/dist/io/read-json-file-sync.js +10 -16
- package/dist/io/read-yaml-file-sync.d.ts +5 -5
- package/dist/io/read-yaml-file-sync.js +4 -8
- package/dist/io/to-json.d.ts +9 -0
- package/dist/io/to-json.js +29 -0
- package/dist/io/write-file-sync.d.ts +5 -5
- package/dist/io/write-file-sync.js +5 -10
- package/dist/io/write-if-changed.d.ts +4 -10
- package/dist/io/write-if-changed.js +9 -44
- package/dist/lib/format-repository-url.js +1 -5
- package/dist/lib/get-group-header.d.ts +2 -2
- package/dist/lib/get-group-header.js +4 -12
- package/dist/lib/get.d.ts +10 -10
- package/dist/lib/get.js +15 -19
- package/dist/lib/pad-start.js +1 -5
- package/dist/lib/ring-buffer.js +1 -5
- package/dist/lib/set-semver-range.d.ts +1 -1
- package/dist/lib/set-semver-range.js +8 -12
- package/dist/lib/show-help-on-error.js +3 -10
- package/dist/lib/sort-by-name.js +1 -5
- package/dist/lib/with-logger.d.ts +1 -1
- package/dist/lib/with-logger.js +17 -24
- package/dist/option.d.ts +1 -1
- package/dist/option.js +8 -14
- package/dist/report.d.ts +2 -2
- package/dist/report.js +2 -5
- package/dist/schema.json +24 -0
- package/dist/semver-group/create-semver-groups.d.ts +3 -3
- package/dist/semver-group/create-semver-groups.js +28 -32
- package/dist/semver-group/disabled.d.ts +11 -11
- package/dist/semver-group/disabled.js +6 -10
- package/dist/semver-group/filtered-out.d.ts +12 -12
- package/dist/semver-group/filtered-out.js +8 -12
- package/dist/semver-group/ignored.d.ts +11 -11
- package/dist/semver-group/ignored.js +6 -10
- package/dist/semver-group/index.d.ts +6 -7
- package/dist/semver-group/index.js +4 -7
- package/dist/semver-group/with-range.d.ts +11 -11
- package/dist/semver-group/with-range.js +13 -17
- package/dist/specifier/alias.d.ts +5 -5
- package/dist/specifier/alias.js +9 -13
- package/dist/specifier/base.d.ts +7 -7
- package/dist/specifier/base.js +9 -13
- package/dist/specifier/delete.d.ts +5 -5
- package/dist/specifier/delete.js +5 -9
- package/dist/specifier/exact.d.ts +6 -6
- package/dist/specifier/exact.js +7 -11
- package/dist/specifier/file.d.ts +1 -1
- package/dist/specifier/file.js +2 -6
- package/dist/specifier/hosted-git.d.ts +5 -5
- package/dist/specifier/hosted-git.js +9 -13
- package/dist/specifier/index.d.ts +13 -13
- package/dist/specifier/index.js +28 -31
- package/dist/specifier/latest.d.ts +6 -6
- package/dist/specifier/latest.js +7 -11
- package/dist/specifier/lib/non-semver-error.d.ts +5 -5
- package/dist/specifier/lib/non-semver-error.js +3 -7
- package/dist/specifier/lib/parse-specifier.d.ts +1 -1
- package/dist/specifier/lib/parse-specifier.js +4 -11
- package/dist/specifier/lib/specific-registry-result.js +1 -2
- package/dist/specifier/range.d.ts +6 -6
- package/dist/specifier/range.js +7 -11
- package/dist/specifier/tag.d.ts +2 -2
- package/dist/specifier/tag.js +2 -6
- package/dist/specifier/unsupported.d.ts +1 -1
- package/dist/specifier/unsupported.js +2 -6
- package/dist/specifier/url.d.ts +1 -1
- package/dist/specifier/url.js +2 -6
- package/dist/specifier/workspace-protocol.d.ts +7 -7
- package/dist/specifier/workspace-protocol.js +9 -13
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
- package/dist/strategy/lib/get-non-empty-string-prop.js +6 -10
- package/dist/strategy/name-and-version-props.d.ts +4 -4
- package/dist/strategy/name-and-version-props.js +19 -23
- package/dist/strategy/named-version-string.d.ts +4 -4
- package/dist/strategy/named-version-string.js +20 -24
- package/dist/strategy/unnamed-version-string.d.ts +4 -4
- package/dist/strategy/unnamed-version-string.js +17 -21
- package/dist/strategy/versions-by-name.d.ts +4 -4
- package/dist/strategy/versions-by-name.js +11 -15
- package/dist/version-group/banned.d.ts +7 -7
- package/dist/version-group/banned.js +8 -12
- package/dist/version-group/create-version-groups.d.ts +3 -3
- package/dist/version-group/create-version-groups.js +34 -38
- package/dist/version-group/filtered-out.d.ts +8 -8
- package/dist/version-group/filtered-out.js +8 -12
- package/dist/version-group/ignored.d.ts +7 -7
- package/dist/version-group/ignored.js +6 -10
- package/dist/version-group/index.d.ts +9 -10
- package/dist/version-group/index.js +4 -7
- package/dist/version-group/lib/clean.js +4 -11
- package/dist/version-group/lib/delete.js +1 -4
- package/dist/version-group/lib/get-highest-version.d.ts +2 -2
- package/dist/version-group/lib/get-highest-version.js +3 -7
- package/dist/version-group/lib/get-lowest-version.d.ts +2 -2
- package/dist/version-group/lib/get-lowest-version.js +3 -7
- package/dist/version-group/lib/get-preferred-version.d.ts +4 -4
- package/dist/version-group/lib/get-preferred-version.js +17 -24
- package/dist/version-group/lib/get-range-score.js +13 -17
- package/dist/version-group/lib/group-by.js +1 -5
- package/dist/version-group/pinned.d.ts +7 -7
- package/dist/version-group/pinned.js +8 -12
- package/dist/version-group/same-range.d.ts +8 -8
- package/dist/version-group/same-range.js +23 -30
- package/dist/version-group/snapped-to.d.ts +7 -7
- package/dist/version-group/snapped-to.js +20 -24
- package/dist/version-group/standard.d.ts +7 -7
- package/dist/version-group/standard.js +29 -33
- package/package.json +30 -37
- package/dist/io/read-config-file-sync.d.ts +0 -7
- package/dist/io/read-config-file-sync.js +0 -26
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const BannedVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 BannedVersionGroup_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
6
|
readonly _tag: "Banned";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class BannedVersionGroup extends BannedVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.Banned;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class BannedVersionGroup extends BannedVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.Banned);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const delete_1 = require("./lib/delete");
|
|
8
|
-
const group_by_1 = require("./lib/group-by");
|
|
9
|
-
class BannedVersionGroup extends effect_1.Data.TaggedClass('Banned') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
3
|
+
import { Specifier } from '../specifier/index.js';
|
|
4
|
+
import { DELETE } from './lib/delete.js';
|
|
5
|
+
import { groupBy } from './lib/group-by.js';
|
|
6
|
+
export class BannedVersionGroup extends Data.TaggedClass('Banned') {
|
|
10
7
|
groupType = 'versionGroup';
|
|
11
8
|
constructor(config) {
|
|
12
9
|
super({
|
|
@@ -18,13 +15,12 @@ class BannedVersionGroup extends effect_1.Data.TaggedClass('Banned') {
|
|
|
18
15
|
return true;
|
|
19
16
|
}
|
|
20
17
|
inspectAll() {
|
|
21
|
-
return
|
|
18
|
+
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
22
19
|
name,
|
|
23
20
|
reports: instances.map((instance) =>
|
|
24
21
|
// ✘ package should not be used
|
|
25
22
|
// ✓ is a mismatch we can auto-fix
|
|
26
|
-
new
|
|
23
|
+
new Report.Banned(Specifier.create(instance, DELETE))),
|
|
27
24
|
})));
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.BannedVersionGroup = BannedVersionGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
export declare function createVersionGroups(ctx: Ctx): Effect.Effect<
|
|
2
|
+
import type { Ctx } from '../get-context/index.js';
|
|
3
|
+
import { VersionGroup } from './index.js';
|
|
4
|
+
export declare function createVersionGroups(ctx: Ctx): Effect.Effect<VersionGroup.Any[], VersionGroup.ConfigError>;
|
|
@@ -1,50 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const snapped_to_1 = require("./snapped-to");
|
|
16
|
-
const standard_1 = require("./standard");
|
|
17
|
-
function createVersionGroups(ctx) {
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
3
|
+
import { isNonEmptyArray } from 'tightrope/guard/is-non-empty-array.js';
|
|
4
|
+
import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
|
|
5
|
+
import { isObject } from 'tightrope/guard/is-object.js';
|
|
6
|
+
import { BannedVersionGroup } from './banned.js';
|
|
7
|
+
import { FilteredOutVersionGroup } from './filtered-out.js';
|
|
8
|
+
import { IgnoredVersionGroup } from './ignored.js';
|
|
9
|
+
import { VersionGroup } from './index.js';
|
|
10
|
+
import { PinnedVersionGroup } from './pinned.js';
|
|
11
|
+
import { SameRangeVersionGroup } from './same-range.js';
|
|
12
|
+
import { SnappedToVersionGroup } from './snapped-to.js';
|
|
13
|
+
import { StandardVersionGroup } from './standard.js';
|
|
14
|
+
export function createVersionGroups(ctx) {
|
|
18
15
|
const { rcFile } = ctx.config;
|
|
19
16
|
const versionGroups = [
|
|
20
|
-
|
|
17
|
+
Effect.succeed(new FilteredOutVersionGroup(ctx)),
|
|
21
18
|
];
|
|
22
|
-
if (
|
|
19
|
+
if (isNonEmptyArray(rcFile.versionGroups)) {
|
|
23
20
|
rcFile.versionGroups.forEach((config) => {
|
|
24
|
-
if (!
|
|
25
|
-
return versionGroups.push(
|
|
21
|
+
if (!isObject(config)) {
|
|
22
|
+
return versionGroups.push(Effect.fail(new VersionGroup.ConfigError({
|
|
26
23
|
config,
|
|
27
24
|
error: 'config is not an object',
|
|
28
25
|
})));
|
|
29
26
|
}
|
|
30
27
|
const mutuallyExclusiveProps = ['isBanned', 'isIgnored', 'pinVersion', 'snapTo', 'policy'].filter((prop) => Boolean(config[prop]));
|
|
31
28
|
if (mutuallyExclusiveProps.length > 1) {
|
|
32
|
-
return versionGroups.push(
|
|
29
|
+
return versionGroups.push(Effect.fail(new VersionGroup.ConfigError({
|
|
33
30
|
config,
|
|
34
31
|
error: `it's unclear what kind of version group you want, as it contains both ${mutuallyExclusiveProps.join(' and ')}`,
|
|
35
32
|
})));
|
|
36
33
|
}
|
|
37
|
-
const label =
|
|
38
|
-
const dependencyTypes =
|
|
34
|
+
const label = isNonEmptyString(config.label) ? config.label : '';
|
|
35
|
+
const dependencyTypes = isArrayOfStrings(config.dependencyTypes)
|
|
39
36
|
? config.dependencyTypes
|
|
40
37
|
: ['**'];
|
|
41
|
-
const dependencies =
|
|
42
|
-
const packages =
|
|
43
|
-
const specifierTypes =
|
|
38
|
+
const dependencies = isArrayOfStrings(config.dependencies) ? config.dependencies : ['**'];
|
|
39
|
+
const packages = isArrayOfStrings(config.packages) ? config.packages : ['**'];
|
|
40
|
+
const specifierTypes = isArrayOfStrings(config.specifierTypes)
|
|
44
41
|
? config.specifierTypes
|
|
45
42
|
: ['**'];
|
|
46
43
|
if (config.isBanned === true) {
|
|
47
|
-
versionGroups.push(
|
|
44
|
+
versionGroups.push(Effect.succeed(new BannedVersionGroup({
|
|
48
45
|
dependencies,
|
|
49
46
|
dependencyTypes,
|
|
50
47
|
specifierTypes,
|
|
@@ -54,7 +51,7 @@ function createVersionGroups(ctx) {
|
|
|
54
51
|
})));
|
|
55
52
|
}
|
|
56
53
|
else if (config.isIgnored === true) {
|
|
57
|
-
versionGroups.push(
|
|
54
|
+
versionGroups.push(Effect.succeed(new IgnoredVersionGroup({
|
|
58
55
|
dependencies,
|
|
59
56
|
dependencyTypes,
|
|
60
57
|
specifierTypes,
|
|
@@ -63,8 +60,8 @@ function createVersionGroups(ctx) {
|
|
|
63
60
|
packages,
|
|
64
61
|
})));
|
|
65
62
|
}
|
|
66
|
-
else if (
|
|
67
|
-
versionGroups.push(
|
|
63
|
+
else if (isNonEmptyString(config.pinVersion)) {
|
|
64
|
+
versionGroups.push(Effect.succeed(new PinnedVersionGroup({
|
|
68
65
|
dependencies,
|
|
69
66
|
dependencyTypes,
|
|
70
67
|
specifierTypes,
|
|
@@ -73,8 +70,8 @@ function createVersionGroups(ctx) {
|
|
|
73
70
|
pinVersion: config.pinVersion,
|
|
74
71
|
})));
|
|
75
72
|
}
|
|
76
|
-
else if (
|
|
77
|
-
versionGroups.push(
|
|
73
|
+
else if (isArrayOfStrings(config.snapTo)) {
|
|
74
|
+
versionGroups.push(Effect.succeed(new SnappedToVersionGroup({
|
|
78
75
|
dependencies,
|
|
79
76
|
dependencyTypes,
|
|
80
77
|
specifierTypes,
|
|
@@ -84,7 +81,7 @@ function createVersionGroups(ctx) {
|
|
|
84
81
|
})));
|
|
85
82
|
}
|
|
86
83
|
else if (config.policy === 'sameRange') {
|
|
87
|
-
versionGroups.push(
|
|
84
|
+
versionGroups.push(Effect.succeed(new SameRangeVersionGroup(ctx, {
|
|
88
85
|
dependencies,
|
|
89
86
|
dependencyTypes,
|
|
90
87
|
specifierTypes,
|
|
@@ -94,7 +91,7 @@ function createVersionGroups(ctx) {
|
|
|
94
91
|
})));
|
|
95
92
|
}
|
|
96
93
|
else {
|
|
97
|
-
versionGroups.push(
|
|
94
|
+
versionGroups.push(Effect.succeed(new StandardVersionGroup(false, {
|
|
98
95
|
dependencies,
|
|
99
96
|
dependencyTypes,
|
|
100
97
|
specifierTypes,
|
|
@@ -105,7 +102,7 @@ function createVersionGroups(ctx) {
|
|
|
105
102
|
}
|
|
106
103
|
});
|
|
107
104
|
}
|
|
108
|
-
versionGroups.push(
|
|
105
|
+
versionGroups.push(Effect.succeed(new StandardVersionGroup(true, {
|
|
109
106
|
dependencies: ['**'],
|
|
110
107
|
dependencyTypes: ['**'],
|
|
111
108
|
specifierTypes: ['**'],
|
|
@@ -113,6 +110,5 @@ function createVersionGroups(ctx) {
|
|
|
113
110
|
packages: ['**'],
|
|
114
111
|
preferVersion: 'highestSemver',
|
|
115
112
|
})));
|
|
116
|
-
return
|
|
113
|
+
return Effect.all(versionGroups);
|
|
117
114
|
}
|
|
118
|
-
exports.createVersionGroups = createVersionGroups;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { GroupConfig } from '../config/types';
|
|
3
|
-
import type { Ctx } from '../get-context';
|
|
4
|
-
import type { Instance } from '../get-instances/instance';
|
|
5
|
-
import { Report } from '../report';
|
|
6
|
-
declare const FilteredOutVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { GroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
5
|
+
import { Report } from '../report.js';
|
|
6
|
+
declare const FilteredOutVersionGroup_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> & {
|
|
7
7
|
readonly _tag: "FilteredOut";
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export declare class FilteredOutVersionGroup extends FilteredOutVersionGroup_base<{
|
|
10
10
|
config: GroupConfig;
|
|
11
11
|
filter: string;
|
|
@@ -14,6 +14,6 @@ export declare class FilteredOutVersionGroup extends FilteredOutVersionGroup_bas
|
|
|
14
14
|
groupType: string;
|
|
15
15
|
constructor(ctx: Ctx);
|
|
16
16
|
canAdd(instance: Instance): boolean;
|
|
17
|
-
inspectAll(): Effect.Effect<
|
|
17
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const report_1 = require("../report");
|
|
7
|
-
const group_by_1 = require("./lib/group-by");
|
|
8
|
-
class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { getFilter } from '../config/get-filter.js';
|
|
3
|
+
import { Report } from '../report.js';
|
|
4
|
+
import { groupBy } from './lib/group-by.js';
|
|
5
|
+
export class FilteredOutVersionGroup extends Data.TaggedClass('FilteredOut') {
|
|
9
6
|
groupType = 'versionGroup';
|
|
10
7
|
constructor(ctx) {
|
|
11
8
|
super({
|
|
@@ -15,7 +12,7 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
15
12
|
label: 'Filtered out',
|
|
16
13
|
packages: ['**'],
|
|
17
14
|
},
|
|
18
|
-
filter:
|
|
15
|
+
filter: getFilter(ctx.config),
|
|
19
16
|
instances: [],
|
|
20
17
|
});
|
|
21
18
|
}
|
|
@@ -23,12 +20,11 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
23
20
|
return instance.name.search(new RegExp(this.filter)) === -1;
|
|
24
21
|
}
|
|
25
22
|
inspectAll() {
|
|
26
|
-
return
|
|
23
|
+
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
27
24
|
name,
|
|
28
25
|
reports: instances.map((instance) =>
|
|
29
26
|
// ✓ is ignored and dismissed as valid
|
|
30
|
-
new
|
|
27
|
+
new Report.FilteredOut(instance)),
|
|
31
28
|
})));
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
exports.FilteredOutVersionGroup = FilteredOutVersionGroup;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const IgnoredVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 IgnoredVersionGroup_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
6
|
readonly _tag: "Ignored";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class IgnoredVersionGroup extends IgnoredVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.Ignored;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class IgnoredVersionGroup extends IgnoredVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.Ignored);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const report_1 = require("../report");
|
|
6
|
-
const group_by_1 = require("./lib/group-by");
|
|
7
|
-
class IgnoredVersionGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
3
|
+
import { groupBy } from './lib/group-by.js';
|
|
4
|
+
export class IgnoredVersionGroup extends Data.TaggedClass('Ignored') {
|
|
8
5
|
groupType = 'versionGroup';
|
|
9
6
|
constructor(config) {
|
|
10
7
|
super({
|
|
@@ -16,12 +13,11 @@ class IgnoredVersionGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
16
13
|
return true;
|
|
17
14
|
}
|
|
18
15
|
inspectAll() {
|
|
19
|
-
return
|
|
16
|
+
return Effect.succeed(Object.entries(groupBy('name', this.instances)).map(([name, instances]) => ({
|
|
20
17
|
name,
|
|
21
18
|
reports: instances.map((instance) =>
|
|
22
19
|
// ✓ is ignored and dismissed as valid
|
|
23
|
-
new
|
|
20
|
+
new Report.Ignored(instance)),
|
|
24
21
|
})));
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
exports.IgnoredVersionGroup = IgnoredVersionGroup;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { StandardVersionGroup } from './standard';
|
|
1
|
+
import type { BannedVersionGroup } from './banned.js';
|
|
2
|
+
import type { FilteredOutVersionGroup } from './filtered-out.js';
|
|
3
|
+
import type { IgnoredVersionGroup } from './ignored.js';
|
|
4
|
+
import type { PinnedVersionGroup } from './pinned.js';
|
|
5
|
+
import type { SameRangeVersionGroup } from './same-range.js';
|
|
6
|
+
import type { SnappedToVersionGroup } from './snapped-to.js';
|
|
7
|
+
import type { StandardVersionGroup } from './standard.js';
|
|
9
8
|
export declare namespace VersionGroup {
|
|
10
9
|
export type Banned = BannedVersionGroup;
|
|
11
10
|
export type FilteredOut = FilteredOutVersionGroup;
|
|
@@ -15,9 +14,9 @@ export declare namespace VersionGroup {
|
|
|
15
14
|
export type SnappedTo = SnappedToVersionGroup;
|
|
16
15
|
export type Standard = StandardVersionGroup;
|
|
17
16
|
export type Any = Banned | FilteredOut | Ignored | Pinned | SameRange | SnappedTo | Standard;
|
|
18
|
-
const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
17
|
+
const ConfigError_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> & {
|
|
19
18
|
readonly _tag: "VersionGroupConfigError";
|
|
20
|
-
}
|
|
19
|
+
};
|
|
21
20
|
export class ConfigError extends ConfigError_base<{
|
|
22
21
|
readonly config: unknown;
|
|
23
22
|
readonly error: string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.VersionGroup = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
var VersionGroup;
|
|
1
|
+
import { Data } from 'effect';
|
|
2
|
+
export var VersionGroup;
|
|
6
3
|
(function (VersionGroup) {
|
|
7
|
-
class ConfigError extends
|
|
4
|
+
class ConfigError extends Data.TaggedClass('VersionGroupConfigError') {
|
|
8
5
|
}
|
|
9
6
|
VersionGroup.ConfigError = ConfigError;
|
|
10
|
-
})(VersionGroup || (
|
|
7
|
+
})(VersionGroup || (VersionGroup = {}));
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clean = void 0;
|
|
7
|
-
const coerce_1 = __importDefault(require("semver/functions/coerce"));
|
|
8
|
-
const valid_1 = __importDefault(require("semver/functions/valid"));
|
|
1
|
+
import coerce from 'semver/functions/coerce.js';
|
|
2
|
+
import valid from 'semver/functions/valid.js';
|
|
9
3
|
/** Convert eg "1" to "1.0.0" which the semver lib does not understand */
|
|
10
|
-
function clean(v) {
|
|
11
|
-
return (
|
|
4
|
+
export function clean(v) {
|
|
5
|
+
return valid(coerce(v)) || '';
|
|
12
6
|
}
|
|
13
|
-
exports.clean = clean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Specifier } from '../../specifier';
|
|
1
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* From an array of instances where every instance contains a valid semver
|
|
4
4
|
* version, return the highest version number
|
|
5
5
|
*/
|
|
6
|
-
export declare function getHighestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<
|
|
6
|
+
export declare function getHighestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<Specifier.Any, import("../../specifier/lib/non-semver-error.js").NonSemverError, never>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHighestVersion = void 0;
|
|
4
|
-
const get_preferred_version_1 = require("./get-preferred-version");
|
|
1
|
+
import { getPreferredVersion } from './get-preferred-version.js';
|
|
5
2
|
/**
|
|
6
3
|
* From an array of instances where every instance contains a valid semver
|
|
7
4
|
* version, return the highest version number
|
|
8
5
|
*/
|
|
9
|
-
function getHighestVersion(specifiers) {
|
|
10
|
-
return
|
|
6
|
+
export function getHighestVersion(specifiers) {
|
|
7
|
+
return getPreferredVersion('highestSemver', specifiers);
|
|
11
8
|
}
|
|
12
|
-
exports.getHighestVersion = getHighestVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Specifier } from '../../specifier';
|
|
1
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* From an array of instances where every instance contains a valid semver
|
|
4
4
|
* version, return the lowest version number
|
|
5
5
|
*/
|
|
6
|
-
export declare function getLowestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<
|
|
6
|
+
export declare function getLowestVersion(specifiers: Specifier.Any[]): import("effect/Effect").Effect<Specifier.Any, import("../../specifier/lib/non-semver-error.js").NonSemverError, never>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLowestVersion = void 0;
|
|
4
|
-
const get_preferred_version_1 = require("./get-preferred-version");
|
|
1
|
+
import { getPreferredVersion } from './get-preferred-version.js';
|
|
5
2
|
/**
|
|
6
3
|
* From an array of instances where every instance contains a valid semver
|
|
7
4
|
* version, return the lowest version number
|
|
8
5
|
*/
|
|
9
|
-
function getLowestVersion(specifiers) {
|
|
10
|
-
return
|
|
6
|
+
export function getLowestVersion(specifiers) {
|
|
7
|
+
return getPreferredVersion('lowestSemver', specifiers);
|
|
11
8
|
}
|
|
12
|
-
exports.getLowestVersion = getLowestVersion;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { VersionGroupConfig } from '../../config/types';
|
|
3
|
-
import type { Specifier } from '../../specifier';
|
|
4
|
-
import type { NonSemverError } from '../../specifier/lib/non-semver-error';
|
|
5
|
-
export declare function getPreferredVersion(preferVersion: VersionGroupConfig.Standard['preferVersion'], specifiers: Specifier.Any[]): Effect.Effect<
|
|
2
|
+
import type { VersionGroupConfig } from '../../config/types.js';
|
|
3
|
+
import type { Specifier } from '../../specifier/index.js';
|
|
4
|
+
import type { NonSemverError } from '../../specifier/lib/non-semver-error.js';
|
|
5
|
+
export declare function getPreferredVersion(preferVersion: VersionGroupConfig.Standard['preferVersion'], specifiers: Specifier.Any[]): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const gt_1 = __importDefault(require("semver/functions/gt"));
|
|
9
|
-
const lt_1 = __importDefault(require("semver/functions/lt"));
|
|
10
|
-
const clean_1 = require("./clean");
|
|
11
|
-
const get_range_score_1 = require("./get-range-score");
|
|
12
|
-
function getPreferredVersion(preferVersion, specifiers) {
|
|
13
|
-
return (0, effect_1.pipe)(
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import gt from 'semver/functions/gt.js';
|
|
3
|
+
import lt from 'semver/functions/lt.js';
|
|
4
|
+
import { clean } from './clean.js';
|
|
5
|
+
import { getRangeScore } from './get-range-score.js';
|
|
6
|
+
export function getPreferredVersion(preferVersion, specifiers) {
|
|
7
|
+
return pipe(
|
|
14
8
|
// every instance must have a semver version
|
|
15
|
-
|
|
9
|
+
Effect.all(specifiers.map((specifier) => pipe(specifier.getSemver(), Effect.map((semver) => ({ semver, specifier }))))),
|
|
16
10
|
// comparing semver can error on some loose ranges, all must succeed
|
|
17
|
-
|
|
11
|
+
Effect.map((semvers) => semvers.sort((a, b) => compareSemver(a.semver, b.semver))),
|
|
18
12
|
// get the preferred value from the list
|
|
19
|
-
|
|
13
|
+
Effect.map((sorted) => sorted[preferVersion === 'lowestSemver' ? 0 : sorted.length - 1]),
|
|
20
14
|
// return just the specifier
|
|
21
|
-
|
|
15
|
+
Effect.map((preferred) => preferred?.specifier));
|
|
22
16
|
}
|
|
23
|
-
exports.getPreferredVersion = getPreferredVersion;
|
|
24
17
|
const EQ = 0;
|
|
25
18
|
const LT = -1;
|
|
26
19
|
const GT = 1;
|
|
@@ -35,14 +28,14 @@ function compareSemver(a, b) {
|
|
|
35
28
|
return GT;
|
|
36
29
|
if (b === '*')
|
|
37
30
|
return LT;
|
|
38
|
-
const cleanA =
|
|
39
|
-
const cleanB =
|
|
40
|
-
if ((
|
|
31
|
+
const cleanA = clean(a);
|
|
32
|
+
const cleanB = clean(b);
|
|
33
|
+
if (gt(cleanA, cleanB))
|
|
41
34
|
return GT;
|
|
42
|
-
if ((
|
|
35
|
+
if (lt(cleanA, cleanB))
|
|
43
36
|
return LT;
|
|
44
|
-
const scoreA =
|
|
45
|
-
const scoreB =
|
|
37
|
+
const scoreA = getRangeScore(a);
|
|
38
|
+
const scoreB = getRangeScore(b);
|
|
46
39
|
if (scoreA < scoreB)
|
|
47
40
|
return LT;
|
|
48
41
|
if (scoreA > scoreB)
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRangeScore = void 0;
|
|
4
|
-
const constants_1 = require("../../constants");
|
|
1
|
+
import { RANGE } from '../../constants.js';
|
|
5
2
|
const scoresByRange = {
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
3
|
+
[RANGE.ANY]: 9,
|
|
4
|
+
[RANGE.WORKSPACE]: 8,
|
|
5
|
+
[RANGE.GT]: 7,
|
|
6
|
+
[RANGE.GTE]: 6,
|
|
7
|
+
[RANGE.MINOR]: 5,
|
|
8
|
+
[RANGE.LOOSE]: 4,
|
|
9
|
+
[RANGE.PATCH]: 3,
|
|
10
|
+
[RANGE.EXACT]: 2,
|
|
11
|
+
[RANGE.LTE]: 1,
|
|
12
|
+
[RANGE.LT]: 0,
|
|
16
13
|
};
|
|
17
14
|
/** Rank a Semver Range according to its greediness */
|
|
18
|
-
function getRangeScore(version) {
|
|
19
|
-
const range = version.indexOf('.x') !== -1 ?
|
|
15
|
+
export function getRangeScore(version) {
|
|
16
|
+
const range = version.indexOf('.x') !== -1 ? RANGE.LOOSE : version.slice(0, version.search(/[0-9]/));
|
|
20
17
|
return scoresByRange[range] || 0;
|
|
21
18
|
}
|
|
22
|
-
exports.getRangeScore = getRangeScore;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupBy = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Convert an array of objects to an object, where each property of the new
|
|
6
3
|
* object is an array whose members share the same value for the given key.
|
|
7
4
|
*/
|
|
8
|
-
function groupBy(key, array) {
|
|
5
|
+
export function groupBy(key, array) {
|
|
9
6
|
return array.reduce((objectsByKeyValue, obj) => {
|
|
10
7
|
const value = obj[key];
|
|
11
8
|
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
|
|
12
9
|
return objectsByKeyValue;
|
|
13
10
|
}, {});
|
|
14
11
|
}
|
|
15
|
-
exports.groupBy = groupBy;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { VersionGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
declare const PinnedVersionGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
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 PinnedVersionGroup_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
6
|
readonly _tag: "Pinned";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class PinnedVersionGroup extends PinnedVersionGroup_base<{
|
|
9
9
|
config: VersionGroupConfig.Pinned;
|
|
10
10
|
instances: Instance[];
|
|
@@ -12,6 +12,6 @@ export declare class PinnedVersionGroup extends PinnedVersionGroup_base<{
|
|
|
12
12
|
groupType: string;
|
|
13
13
|
constructor(config: VersionGroupConfig.Pinned);
|
|
14
14
|
canAdd(_: Instance): boolean;
|
|
15
|
-
inspectAll(): Effect.Effect<
|
|
15
|
+
inspectAll(): Effect.Effect<Report.Version.Group[]>;
|
|
16
16
|
}
|
|
17
17
|
export {};
|