syncpack 12.0.0 → 12.1.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/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
- package/dist/bin-fix-mismatches/index.js +1 -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 +1 -1
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +5 -5
- package/dist/bin-list/index.js +1 -1
- package/dist/bin-list/list.d.ts +2 -0
- package/dist/bin-list/list.js +76 -48
- package/dist/bin-list-mismatches/index.js +1 -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/prompt.js +7 -3
- package/dist/bin-set-semver-ranges/index.js +1 -1
- package/dist/config/get-custom-types.js +2 -1
- package/dist/config/types.d.ts +4 -5
- package/dist/constants.d.ts +39 -8
- package/dist/constants.js +31 -0
- 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 +1 -1
- package/dist/report.d.ts +64 -99
- package/dist/report.js +81 -16
- package/dist/schema.json +75 -74
- 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.js +4 -12
- package/dist/specifier/index.d.ts +1 -2
- package/dist/specifier/lib/parse-specifier.js +1 -1
- package/dist/specifier/workspace-protocol.js +3 -2
- package/dist/strategy/name-and-version-props.js +4 -4
- package/dist/version-group/banned.js +1 -3
- 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 +2 -2
- package/dist/version-group/same-range.js +5 -10
- package/dist/version-group/snapped-to.js +7 -17
- package/dist/version-group/standard.js +38 -49
- package/package.json +19 -13
package/dist/schema.json
CHANGED
|
@@ -9,55 +9,17 @@
|
|
|
9
9
|
"SemverGroupConfig.Any": {
|
|
10
10
|
"anyOf": [
|
|
11
11
|
{
|
|
12
|
-
"$ref": "#/definitions/
|
|
12
|
+
"$ref": "#/definitions/SemverGroupConfig.Disabled"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"$ref": "#/definitions/
|
|
15
|
+
"$ref": "#/definitions/SemverGroupConfig.Ignored"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
"$ref": "#/definitions/
|
|
18
|
+
"$ref": "#/definitions/SemverGroupConfig.WithRange"
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
|
-
"
|
|
23
|
-
"default": "",
|
|
24
|
-
"description": "Aliases for semver range formats supported by syncpack\n\nDefaults to `\"\"` to ensure that exact dependency versions are used instead of\nloose ranges, but this can be overridden in your config file.\n\n| Supported Range | Example |\n| --------------- | --------: |\n| `\"<\"` | `<1.4.2` |\n| `\"<=\"` | `<=1.4.2` |\n| `\"\"` | `1.4.2` |\n| `\"~\"` | `~1.4.2` |\n| `\"^\"` | `^1.4.2` |\n| `\">=\"` | `>=1.4.2` |\n| `\">\"` | `>1.4.2` |\n| `\"*\"` | `*` |",
|
|
25
|
-
"enum": [
|
|
26
|
-
"",
|
|
27
|
-
"*",
|
|
28
|
-
".x",
|
|
29
|
-
"<",
|
|
30
|
-
"<=",
|
|
31
|
-
">",
|
|
32
|
-
">=",
|
|
33
|
-
"^",
|
|
34
|
-
"~"
|
|
35
|
-
],
|
|
36
|
-
"type": "string"
|
|
37
|
-
},
|
|
38
|
-
"VersionGroupConfig.Any": {
|
|
39
|
-
"anyOf": [
|
|
40
|
-
{
|
|
41
|
-
"$ref": "#/definitions/{isBanned:true;dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;pinVersion?:never;snapTo?:never;policy?:never;preferVersion?:never;}"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"$ref": "#/definitions/{isIgnored:true;dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isBanned?:never;pinVersion?:never;snapTo?:never;policy?:never;preferVersion?:never;}"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"$ref": "#/definitions/{pinVersion:string;dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;isBanned?:never;snapTo?:never;policy?:never;preferVersion?:never;}"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"$ref": "#/definitions/{snapTo:string[];dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;isBanned?:never;pinVersion?:never;policy?:never;preferVersion?:never;}"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"$ref": "#/definitions/{policy:\"sameRange\";dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;isBanned?:never;pinVersion?:never;snapTo?:never;preferVersion?:never;}"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"$ref": "#/definitions/{preferVersion?:\"highestSemver\"|\"lowestSemver\";dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;isBanned?:never;pinVersion?:never;snapTo?:never;policy?:never;}"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
"{isBanned:true;dependencies?:string[];dependencyTypes?:string[];label?:string;packages?:string[];isIgnored?:never;pinVersion?:never;snapTo?:never;policy?:never;preferVersion?:never;}": {
|
|
22
|
+
"SemverGroupConfig.Disabled": {
|
|
61
23
|
"additionalProperties": false,
|
|
62
24
|
"properties": {
|
|
63
25
|
"dependencies": {
|
|
@@ -72,7 +34,7 @@
|
|
|
72
34
|
},
|
|
73
35
|
"type": "array"
|
|
74
36
|
},
|
|
75
|
-
"
|
|
37
|
+
"isDisabled": {
|
|
76
38
|
"const": true,
|
|
77
39
|
"type": "boolean"
|
|
78
40
|
},
|
|
@@ -88,7 +50,7 @@
|
|
|
88
50
|
},
|
|
89
51
|
"type": "object"
|
|
90
52
|
},
|
|
91
|
-
"
|
|
53
|
+
"SemverGroupConfig.Ignored": {
|
|
92
54
|
"additionalProperties": false,
|
|
93
55
|
"properties": {
|
|
94
56
|
"dependencies": {
|
|
@@ -103,7 +65,7 @@
|
|
|
103
65
|
},
|
|
104
66
|
"type": "array"
|
|
105
67
|
},
|
|
106
|
-
"
|
|
68
|
+
"isIgnored": {
|
|
107
69
|
"const": true,
|
|
108
70
|
"type": "boolean"
|
|
109
71
|
},
|
|
@@ -119,7 +81,7 @@
|
|
|
119
81
|
},
|
|
120
82
|
"type": "object"
|
|
121
83
|
},
|
|
122
|
-
"
|
|
84
|
+
"SemverGroupConfig.WithRange": {
|
|
123
85
|
"additionalProperties": false,
|
|
124
86
|
"properties": {
|
|
125
87
|
"dependencies": {
|
|
@@ -134,10 +96,6 @@
|
|
|
134
96
|
},
|
|
135
97
|
"type": "array"
|
|
136
98
|
},
|
|
137
|
-
"isIgnored": {
|
|
138
|
-
"const": true,
|
|
139
|
-
"type": "boolean"
|
|
140
|
-
},
|
|
141
99
|
"label": {
|
|
142
100
|
"type": "string"
|
|
143
101
|
},
|
|
@@ -146,11 +104,53 @@
|
|
|
146
104
|
"type": "string"
|
|
147
105
|
},
|
|
148
106
|
"type": "array"
|
|
107
|
+
},
|
|
108
|
+
"range": {
|
|
109
|
+
"$ref": "#/definitions/SemverRange"
|
|
149
110
|
}
|
|
150
111
|
},
|
|
151
112
|
"type": "object"
|
|
152
113
|
},
|
|
153
|
-
"
|
|
114
|
+
"SemverRange": {
|
|
115
|
+
"default": "",
|
|
116
|
+
"description": "Aliases for semver range formats supported by syncpack\n\nDefaults to `\"\"` to ensure that exact dependency versions are used instead of\nloose ranges, but this can be overridden in your config file.\n\n| Supported Range | Example |\n| --------------- | --------: |\n| `\"<\"` | `<1.4.2` |\n| `\"<=\"` | `<=1.4.2` |\n| `\"\"` | `1.4.2` |\n| `\"~\"` | `~1.4.2` |\n| `\"^\"` | `^1.4.2` |\n| `\">=\"` | `>=1.4.2` |\n| `\">\"` | `>1.4.2` |\n| `\"*\"` | `*` |",
|
|
117
|
+
"enum": [
|
|
118
|
+
"",
|
|
119
|
+
"*",
|
|
120
|
+
".x",
|
|
121
|
+
"<",
|
|
122
|
+
"<=",
|
|
123
|
+
">",
|
|
124
|
+
">=",
|
|
125
|
+
"^",
|
|
126
|
+
"workspace:",
|
|
127
|
+
"~"
|
|
128
|
+
],
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"VersionGroupConfig.Any": {
|
|
132
|
+
"anyOf": [
|
|
133
|
+
{
|
|
134
|
+
"$ref": "#/definitions/VersionGroupConfig.Banned"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"$ref": "#/definitions/VersionGroupConfig.Ignored"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"$ref": "#/definitions/VersionGroupConfig.Pinned"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"$ref": "#/definitions/VersionGroupConfig.SnappedTo"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"$ref": "#/definitions/VersionGroupConfig.SameRange"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"$ref": "#/definitions/VersionGroupConfig.Standard"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"VersionGroupConfig.Banned": {
|
|
154
154
|
"additionalProperties": false,
|
|
155
155
|
"properties": {
|
|
156
156
|
"dependencies": {
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
},
|
|
166
166
|
"type": "array"
|
|
167
167
|
},
|
|
168
|
-
"
|
|
168
|
+
"isBanned": {
|
|
169
169
|
"const": true,
|
|
170
170
|
"type": "boolean"
|
|
171
171
|
},
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
},
|
|
182
182
|
"type": "object"
|
|
183
183
|
},
|
|
184
|
-
"
|
|
184
|
+
"VersionGroupConfig.Ignored": {
|
|
185
185
|
"additionalProperties": false,
|
|
186
186
|
"properties": {
|
|
187
187
|
"dependencies": {
|
|
@@ -196,6 +196,10 @@
|
|
|
196
196
|
},
|
|
197
197
|
"type": "array"
|
|
198
198
|
},
|
|
199
|
+
"isIgnored": {
|
|
200
|
+
"const": true,
|
|
201
|
+
"type": "boolean"
|
|
202
|
+
},
|
|
199
203
|
"label": {
|
|
200
204
|
"type": "string"
|
|
201
205
|
},
|
|
@@ -204,14 +208,11 @@
|
|
|
204
208
|
"type": "string"
|
|
205
209
|
},
|
|
206
210
|
"type": "array"
|
|
207
|
-
},
|
|
208
|
-
"pinVersion": {
|
|
209
|
-
"type": "string"
|
|
210
211
|
}
|
|
211
212
|
},
|
|
212
213
|
"type": "object"
|
|
213
214
|
},
|
|
214
|
-
"
|
|
215
|
+
"VersionGroupConfig.Pinned": {
|
|
215
216
|
"additionalProperties": false,
|
|
216
217
|
"properties": {
|
|
217
218
|
"dependencies": {
|
|
@@ -235,14 +236,13 @@
|
|
|
235
236
|
},
|
|
236
237
|
"type": "array"
|
|
237
238
|
},
|
|
238
|
-
"
|
|
239
|
-
"const": "sameRange",
|
|
239
|
+
"pinVersion": {
|
|
240
240
|
"type": "string"
|
|
241
241
|
}
|
|
242
242
|
},
|
|
243
243
|
"type": "object"
|
|
244
244
|
},
|
|
245
|
-
"
|
|
245
|
+
"VersionGroupConfig.SameRange": {
|
|
246
246
|
"additionalProperties": false,
|
|
247
247
|
"properties": {
|
|
248
248
|
"dependencies": {
|
|
@@ -266,17 +266,14 @@
|
|
|
266
266
|
},
|
|
267
267
|
"type": "array"
|
|
268
268
|
},
|
|
269
|
-
"
|
|
270
|
-
"
|
|
271
|
-
"highestSemver",
|
|
272
|
-
"lowestSemver"
|
|
273
|
-
],
|
|
269
|
+
"policy": {
|
|
270
|
+
"const": "sameRange",
|
|
274
271
|
"type": "string"
|
|
275
272
|
}
|
|
276
273
|
},
|
|
277
274
|
"type": "object"
|
|
278
275
|
},
|
|
279
|
-
"
|
|
276
|
+
"VersionGroupConfig.SnappedTo": {
|
|
280
277
|
"additionalProperties": false,
|
|
281
278
|
"properties": {
|
|
282
279
|
"dependencies": {
|
|
@@ -300,13 +297,16 @@
|
|
|
300
297
|
},
|
|
301
298
|
"type": "array"
|
|
302
299
|
},
|
|
303
|
-
"
|
|
304
|
-
"
|
|
300
|
+
"snapTo": {
|
|
301
|
+
"items": {
|
|
302
|
+
"type": "string"
|
|
303
|
+
},
|
|
304
|
+
"type": "array"
|
|
305
305
|
}
|
|
306
306
|
},
|
|
307
307
|
"type": "object"
|
|
308
308
|
},
|
|
309
|
-
"
|
|
309
|
+
"VersionGroupConfig.Standard": {
|
|
310
310
|
"additionalProperties": false,
|
|
311
311
|
"properties": {
|
|
312
312
|
"dependencies": {
|
|
@@ -330,11 +330,12 @@
|
|
|
330
330
|
},
|
|
331
331
|
"type": "array"
|
|
332
332
|
},
|
|
333
|
-
"
|
|
334
|
-
"
|
|
335
|
-
"
|
|
336
|
-
|
|
337
|
-
|
|
333
|
+
"preferVersion": {
|
|
334
|
+
"enum": [
|
|
335
|
+
"highestSemver",
|
|
336
|
+
"lowestSemver"
|
|
337
|
+
],
|
|
338
|
+
"type": "string"
|
|
338
339
|
}
|
|
339
340
|
},
|
|
340
341
|
"type": "object"
|
|
@@ -26,9 +26,7 @@ class DisabledSemverGroup extends effect_1.Data.TaggedClass('Disabled') {
|
|
|
26
26
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
27
27
|
}
|
|
28
28
|
inspect(instance) {
|
|
29
|
-
return effect_1.Effect.succeed(new report_1.Report.Disabled(
|
|
30
|
-
instance,
|
|
31
|
-
}));
|
|
29
|
+
return effect_1.Effect.succeed(new report_1.Report.Disabled(instance));
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
exports.DisabledSemverGroup = DisabledSemverGroup;
|
|
@@ -32,9 +32,7 @@ class FilteredOutSemverGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
32
32
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
33
33
|
}
|
|
34
34
|
inspect(instance) {
|
|
35
|
-
return effect_1.Effect.succeed(new report_1.Report.FilteredOut(
|
|
36
|
-
instance,
|
|
37
|
-
}));
|
|
35
|
+
return effect_1.Effect.succeed(new report_1.Report.FilteredOut(instance));
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
exports.FilteredOutSemverGroup = FilteredOutSemverGroup;
|
|
@@ -22,9 +22,7 @@ class IgnoredSemverGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
22
22
|
return effect_1.Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
23
23
|
}
|
|
24
24
|
inspect(instance) {
|
|
25
|
-
return effect_1.Effect.succeed(new report_1.Report.Ignored(
|
|
26
|
-
instance,
|
|
27
|
-
}));
|
|
25
|
+
return effect_1.Effect.succeed(new report_1.Report.Ignored(instance));
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
exports.IgnoredSemverGroup = IgnoredSemverGroup;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Data } from 'effect';
|
|
2
|
-
import type { Union } from 'ts-toolbelt';
|
|
3
2
|
import type { DisabledSemverGroup } from './disabled';
|
|
4
3
|
import type { FilteredOutSemverGroup } from './filtered-out';
|
|
5
4
|
import type { IgnoredSemverGroup } from './ignored';
|
|
@@ -9,7 +8,7 @@ export declare namespace SemverGroup {
|
|
|
9
8
|
export type FilteredOut = FilteredOutSemverGroup;
|
|
10
9
|
export type Ignored = IgnoredSemverGroup;
|
|
11
10
|
export type WithRange = WithRangeSemverGroup;
|
|
12
|
-
export type Any =
|
|
11
|
+
export type Any = Disabled | FilteredOut | Ignored | WithRange;
|
|
13
12
|
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> & {
|
|
14
13
|
readonly _tag: "SemverGroupConfigError";
|
|
15
14
|
}>;
|
|
@@ -33,24 +33,16 @@ class WithRangeSemverGroup extends effect_1.Data.TaggedClass('WithRange') {
|
|
|
33
33
|
instance.versionGroup._tag === 'Pinned' &&
|
|
34
34
|
instance.rawSpecifier === instance.versionGroup.config.pinVersion
|
|
35
35
|
? // the pinned version takes precendence and is a match
|
|
36
|
-
new report_1.Report.Valid(
|
|
37
|
-
specifier: current,
|
|
38
|
-
})
|
|
36
|
+
new report_1.Report.Valid(current)
|
|
39
37
|
: // if it is already like this on disk
|
|
40
38
|
instance.rawSpecifier === valid.raw
|
|
41
39
|
? // it is a match
|
|
42
|
-
new report_1.Report.Valid(
|
|
43
|
-
specifier: current,
|
|
44
|
-
})
|
|
40
|
+
new report_1.Report.Valid(current)
|
|
45
41
|
: // it is a mismatch and should be this one
|
|
46
|
-
new report_1.Report.SemverRangeMismatch(
|
|
47
|
-
fixable: valid,
|
|
48
|
-
}),
|
|
42
|
+
new report_1.Report.SemverRangeMismatch(valid),
|
|
49
43
|
// if range is NOT fixable, it is a mismatch we can't auto-fix
|
|
50
44
|
// as it seems to not be semver
|
|
51
|
-
onFailure: () => new report_1.Report.UnsupportedMismatch(
|
|
52
|
-
unfixable: instance,
|
|
53
|
-
}),
|
|
45
|
+
onFailure: () => new report_1.Report.UnsupportedMismatch(instance),
|
|
54
46
|
}));
|
|
55
47
|
}
|
|
56
48
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Union } from 'ts-toolbelt';
|
|
2
1
|
import type { Instance } from '../get-instances/instance';
|
|
3
2
|
import { type Delete } from '../version-group/lib/delete';
|
|
4
3
|
import { AliasSpecifier } from './alias';
|
|
@@ -22,6 +21,6 @@ export declare namespace Specifier {
|
|
|
22
21
|
const Url: typeof UrlSpecifier;
|
|
23
22
|
const Version: typeof VersionSpecifier;
|
|
24
23
|
const WorkspaceProtocol: typeof WorkspaceProtocolSpecifier;
|
|
25
|
-
type Any =
|
|
24
|
+
type Any = AliasSpecifier | DeleteSpecifier | FileSpecifier | HostedGitSpecifier | RangeSpecifier | TagSpecifier | UnsupportedSpecifier | UrlSpecifier | VersionSpecifier | WorkspaceProtocolSpecifier;
|
|
26
25
|
function create(instance: Instance, raw: string | Delete): Specifier.Any;
|
|
27
26
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.parseSpecifier = void 0;
|
|
7
7
|
const npm_package_arg_1 = __importDefault(require("npm-package-arg"));
|
|
8
8
|
function parseSpecifier(name, specifier, packageJsonFile) {
|
|
9
|
-
if (specifier === 'workspace:*' || specifier === 'workspace:~') {
|
|
9
|
+
if (specifier === 'workspace:*' || specifier === 'workspace:~' || specifier === 'workspace:^') {
|
|
10
10
|
const parsed = npm_package_arg_1.default.resolve(name, packageJsonFile.jsonFile.dirPath, specifier.replace('workspace:', 'file:'));
|
|
11
11
|
return {
|
|
12
12
|
escapedName: parsed.escapedName,
|
|
@@ -16,11 +16,12 @@ class WorkspaceProtocolSpecifier extends base_1.BaseSpecifier {
|
|
|
16
16
|
if (this.raw === 'workspace:*') {
|
|
17
17
|
return effect_1.Effect.succeed('*');
|
|
18
18
|
}
|
|
19
|
-
if (this.raw === 'workspace:~') {
|
|
19
|
+
if (this.raw === 'workspace:~' || this.raw === 'workspace:^') {
|
|
20
|
+
const range = this.raw.replace('workspace:', '');
|
|
20
21
|
const local = ctx.packageJsonFilesByName[this.instance.name];
|
|
21
22
|
const version = local?.jsonFile?.contents?.version;
|
|
22
23
|
if (version)
|
|
23
|
-
return effect_1.Effect.succeed(
|
|
24
|
+
return effect_1.Effect.succeed(`${range}${version}`);
|
|
24
25
|
}
|
|
25
26
|
return effect_1.Effect.succeed('0.0.0');
|
|
26
27
|
}
|
|
@@ -24,10 +24,10 @@ class NameAndVersionPropsStrategy {
|
|
|
24
24
|
// add the version prop
|
|
25
25
|
effect_1.Effect.bind('version', () => (0, effect_1.pipe)((0, get_non_empty_string_prop_1.getNonEmptyStringProp)(this.path, file),
|
|
26
26
|
/**
|
|
27
|
-
* In order to report
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* In order to report a `MissingLocalVersion`, we need to ensure that
|
|
28
|
+
* a value is returned for `local` package .version properties so we
|
|
29
|
+
* can know that `this.name` is a package developed in this repo but
|
|
30
|
+
* that its version is missing.
|
|
31
31
|
*
|
|
32
32
|
* Not doing this results in the invalid local package being ignored
|
|
33
33
|
* and each installation of it being checked for mismatches amongst
|
|
@@ -23,9 +23,7 @@ class BannedVersionGroup extends effect_1.Data.TaggedClass('Banned') {
|
|
|
23
23
|
reports: instances.map((instance) =>
|
|
24
24
|
// ✘ package should not be used
|
|
25
25
|
// ✓ is a mismatch we can auto-fix
|
|
26
|
-
new report_1.Report.Banned(
|
|
27
|
-
fixable: specifier_1.Specifier.create(instance, delete_1.DELETE),
|
|
28
|
-
})),
|
|
26
|
+
new report_1.Report.Banned(specifier_1.Specifier.create(instance, delete_1.DELETE))),
|
|
29
27
|
})));
|
|
30
28
|
}
|
|
31
29
|
}
|
|
@@ -27,7 +27,7 @@ class FilteredOutVersionGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
27
27
|
name,
|
|
28
28
|
reports: instances.map((instance) =>
|
|
29
29
|
// ✓ is ignored and dismissed as valid
|
|
30
|
-
new report_1.Report.FilteredOut(
|
|
30
|
+
new report_1.Report.FilteredOut(instance)),
|
|
31
31
|
})));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -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
|
}>;
|
|
@@ -20,11 +20,11 @@ class PinnedVersionGroup extends effect_1.Data.TaggedClass('Pinned') {
|
|
|
20
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
|
|
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;
|
|
@@ -27,27 +27,25 @@ class SameRangeVersionGroup extends effect_1.Data.TaggedClass('SameRange') {
|
|
|
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
|
-
unfixable: specifier.instance,
|
|
38
|
-
})),
|
|
36
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance)),
|
|
39
37
|
onSuccess: (valid) => specifier.instance.rawSpecifier === 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) => report.specifier.instance.rawSpecifier)));
|
|
81
76
|
})
|
|
82
77
|
: // ✘ not every instance is valid on its own
|
|
83
78
|
// ! report on their validity individually ! when all are valid
|
|
@@ -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(
|
|
24
|
+
new report_1.Report.MissingSnappedToMismatch(instance))),
|
|
25
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({
|
|
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
|
-
unfixable: specifier.instance,
|
|
33
|
-
}),
|
|
31
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance),
|
|
34
32
|
onSuccess: (valid) => specifier.instance.rawSpecifier === 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
|
-
unfixable: specifier.instance,
|
|
56
|
-
}),
|
|
49
|
+
new report_1.Report.UnsupportedMismatch(specifier.instance),
|
|
57
50
|
onSuccess: (valid) => specifier.instance.rawSpecifier === 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 })))));
|