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.
Files changed (79) hide show
  1. package/README.md +5 -5
  2. package/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
  3. package/dist/bin-fix-mismatches/index.js +3 -1
  4. package/dist/bin-format/index.js +1 -1
  5. package/dist/bin-lint/index.js +1 -1
  6. package/dist/bin-lint-semver-ranges/index.js +3 -1
  7. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +7 -7
  8. package/dist/bin-list/index.js +3 -1
  9. package/dist/bin-list/list.d.ts +2 -0
  10. package/dist/bin-list/list.js +78 -50
  11. package/dist/bin-list-mismatches/index.js +3 -1
  12. package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -5
  13. package/dist/bin-list-mismatches/list-mismatches.js +185 -220
  14. package/dist/bin-prompt/index.js +2 -0
  15. package/dist/bin-prompt/prompt.js +7 -3
  16. package/dist/bin-set-semver-ranges/index.js +3 -1
  17. package/dist/bin-update/effects.js +6 -6
  18. package/dist/bin-update/index.js +2 -0
  19. package/dist/bin-update/update.js +3 -3
  20. package/dist/config/get-custom-types.js +2 -1
  21. package/dist/config/types.d.ts +15 -7
  22. package/dist/constants.d.ts +71 -8
  23. package/dist/constants.js +34 -1
  24. package/dist/get-instances/instance.d.ts +2 -1
  25. package/dist/get-instances/instance.js +4 -3
  26. package/dist/guards/can-add-to-group.js +14 -7
  27. package/dist/io/index.d.ts +2 -2
  28. package/dist/io/index.js +1 -1
  29. package/dist/io/read-config-file-sync.js +1 -1
  30. package/dist/option.d.ts +2 -1
  31. package/dist/option.js +4 -0
  32. package/dist/report.d.ts +64 -99
  33. package/dist/report.js +81 -16
  34. package/dist/schema.json +202 -77
  35. package/dist/semver-group/create-semver-groups.js +6 -0
  36. package/dist/semver-group/disabled.js +1 -3
  37. package/dist/semver-group/filtered-out.js +1 -3
  38. package/dist/semver-group/ignored.js +1 -3
  39. package/dist/semver-group/index.d.ts +1 -2
  40. package/dist/semver-group/with-range.d.ts +1 -1
  41. package/dist/semver-group/with-range.js +7 -15
  42. package/dist/specifier/alias.d.ts +2 -0
  43. package/dist/specifier/alias.js +3 -1
  44. package/dist/specifier/base.d.ts +4 -2
  45. package/dist/specifier/base.js +3 -1
  46. package/dist/specifier/delete.d.ts +4 -2
  47. package/dist/specifier/delete.js +3 -1
  48. package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
  49. package/dist/specifier/{version.js → exact.js} +6 -4
  50. package/dist/specifier/file.d.ts +2 -0
  51. package/dist/specifier/file.js +3 -1
  52. package/dist/specifier/hosted-git.d.ts +2 -0
  53. package/dist/specifier/hosted-git.js +3 -1
  54. package/dist/specifier/index.d.ts +5 -4
  55. package/dist/specifier/index.js +7 -3
  56. package/dist/specifier/latest.d.ts +19 -0
  57. package/dist/specifier/latest.js +24 -0
  58. package/dist/specifier/lib/parse-specifier.js +1 -1
  59. package/dist/specifier/range.d.ts +2 -1
  60. package/dist/specifier/range.js +3 -2
  61. package/dist/specifier/tag.d.ts +2 -0
  62. package/dist/specifier/tag.js +3 -1
  63. package/dist/specifier/unsupported.d.ts +2 -0
  64. package/dist/specifier/unsupported.js +3 -1
  65. package/dist/specifier/url.d.ts +2 -0
  66. package/dist/specifier/url.js +3 -1
  67. package/dist/specifier/workspace-protocol.d.ts +2 -0
  68. package/dist/specifier/workspace-protocol.js +6 -3
  69. package/dist/strategy/name-and-version-props.js +4 -4
  70. package/dist/version-group/banned.js +1 -3
  71. package/dist/version-group/create-version-groups.js +11 -0
  72. package/dist/version-group/filtered-out.js +1 -1
  73. package/dist/version-group/ignored.js +1 -1
  74. package/dist/version-group/index.d.ts +1 -2
  75. package/dist/version-group/pinned.js +3 -3
  76. package/dist/version-group/same-range.js +9 -14
  77. package/dist/version-group/snapped-to.js +12 -22
  78. package/dist/version-group/standard.js +44 -55
  79. package/package.json +7 -7
@@ -27,235 +27,200 @@ function pipeline(ctx, io, errorHandlers) {
27
27
  const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
28
28
  let index = 0;
29
29
  for (const group of versionGroups) {
30
- const groupSize = group.instances.length;
31
- let fixableCount = 0;
32
- let unfixableCount = 0;
33
- let validCount = 0;
34
- if (group._tag === 'FilteredOut') {
35
- index++;
36
- continue;
37
- }
30
+ const countByReportGroup = {
31
+ Excluded: 0,
32
+ Fixable: 0,
33
+ Unfixable: 0,
34
+ Valid: 0,
35
+ };
38
36
  yield* $(effect_1.Effect.logInfo((0, get_group_header_1.getVersionGroupHeader)({ group, index })));
39
- if (group._tag === 'Ignored') {
40
- const msg = (0, chalk_1.default) `{gray ${(0, pad_start_1.padStart)(groupSize)} ${constants_1.ICON.rightArrow} ignored}`;
41
- yield* $(effect_1.Effect.logInfo(msg));
42
- index++;
43
- continue;
44
- }
45
37
  for (const groupReport of yield* $(group.inspectAll())) {
46
38
  for (const report of groupReport.reports) {
47
- const _tag = report._tag;
48
- if (_tag === 'Valid') {
49
- validCount++;
50
- }
51
- else if (_tag === 'Banned') {
52
- ctx.isInvalid = true;
53
- yield* $(logBanned(report));
54
- fixableCount++;
55
- }
56
- else if (_tag === 'HighestSemverMismatch') {
57
- ctx.isInvalid = true;
58
- yield* $(logHighestSemverMismatch(report));
59
- fixableCount++;
60
- }
61
- else if (_tag === 'LocalPackageMismatch') {
62
- ctx.isInvalid = true;
63
- yield* $(logLocalPackageMismatch(report));
64
- fixableCount++;
65
- }
66
- else if (_tag === 'LowestSemverMismatch') {
67
- ctx.isInvalid = true;
68
- yield* $(logLowestSemverMismatch(report));
69
- fixableCount++;
70
- }
71
- else if (_tag === 'PinnedMismatch') {
72
- ctx.isInvalid = true;
73
- yield* $(logPinnedMismatch(report));
74
- fixableCount++;
75
- }
76
- else if (_tag === 'SemverRangeMismatch') {
39
+ countByReportGroup[report._tagGroup]++;
40
+ if (report.isInvalid)
77
41
  ctx.isInvalid = true;
78
- yield* $(logSemverRangeMismatch(report));
79
- fixableCount++;
80
- }
81
- else if (_tag === 'SnappedToMismatch') {
82
- ctx.isInvalid = true;
83
- yield* $(logSnappedToMismatch(report));
84
- fixableCount++;
85
- }
86
- else if (_tag === 'MissingLocalVersion') {
87
- ctx.isInvalid = true;
88
- yield* $(logMissingLocalVersion(report));
89
- unfixableCount++;
90
- }
91
- else if (_tag === 'MissingSnappedToMismatch') {
92
- ctx.isInvalid = true;
93
- yield* $(logMissingSnappedToMismatch(report));
94
- unfixableCount++;
95
- }
96
- else if (_tag === 'UnsupportedMismatch') {
97
- ctx.isInvalid = true;
98
- yield* $(logUnsupportedMismatch(report));
99
- unfixableCount++;
100
- }
101
- else if (_tag === 'SameRangeMismatch') {
102
- ctx.isInvalid = true;
103
- yield* $(logSameRangeMismatch(report));
104
- unfixableCount++;
105
- }
42
+ const logReport = onReportTag[report._tag];
43
+ if (logReport)
44
+ yield* $(logReport(report));
106
45
  }
107
46
  }
108
- if (validCount)
109
- yield* $(logValidSize(validCount));
110
- if (fixableCount)
111
- yield* $(logFixableSize(fixableCount));
112
- if (unfixableCount)
113
- yield* $(logUnfixableSize(unfixableCount));
47
+ yield* $(onReportGroup.Valid(countByReportGroup.Valid));
48
+ yield* $(onReportGroup.Fixable(countByReportGroup.Fixable));
49
+ yield* $(onReportGroup.Unfixable(countByReportGroup.Unfixable));
50
+ yield* $(onReportGroup.Excluded(countByReportGroup.Excluded));
114
51
  index++;
115
52
  }
116
53
  return ctx;
117
54
  });
118
55
  }
119
56
  exports.pipeline = pipeline;
120
- function logValidSize(amount) {
121
- const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} already valid`;
122
- return effect_1.Effect.logInfo(msg);
123
- }
124
- function logFixableSize(amount) {
125
- const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} can be auto-fixed`;
126
- return effect_1.Effect.logInfo(msg);
127
- }
128
- function logUnfixableSize(amount) {
129
- const msg = (0, chalk_1.default) `{red ${(0, pad_start_1.padStart)(amount)} ${constants_1.ICON.panic} can be fixed manually using} {blue syncpack prompt}`;
130
- return effect_1.Effect.logInfo(msg);
131
- }
132
- function logBanned(report) {
133
- const _tag = report._tag;
134
- const instance = report.fixable.instance;
135
- const name = instance.name;
136
- const jsonFile = instance.packageJsonFile.jsonFile;
137
- const path = instance.strategy.path;
138
- const shortPath = jsonFile.shortPath;
139
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red banned} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
140
- }
141
- function logHighestSemverMismatch(report) {
142
- const _tag = report._tag;
143
- const fixable = report.fixable;
144
- const instance = fixable.instance;
145
- const jsonFile = instance.packageJsonFile.jsonFile;
146
- const actual = instance.rawSpecifier;
147
- const expected = fixable.raw;
148
- const name = instance.name;
149
- const path = instance.strategy.path;
150
- const shortPath = jsonFile.shortPath;
151
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
152
- }
153
- function logLocalPackageMismatch(report) {
154
- const _tag = report._tag;
155
- const fixable = report.fixable;
156
- const instance = fixable.instance;
157
- const actual = instance.rawSpecifier;
158
- const expected = fixable.raw;
159
- const name = instance.name;
160
- const path = instance.strategy.path;
161
- const shortPath = instance.packageJsonFile.jsonFile.shortPath;
162
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
163
- }
164
- function logLowestSemverMismatch(report) {
165
- const _tag = report._tag;
166
- const fixable = report.fixable;
167
- const instance = fixable.instance;
168
- const actual = instance.rawSpecifier;
169
- const expected = fixable.raw;
170
- const name = instance.name;
171
- const path = instance.strategy.path;
172
- const shortPath = instance.packageJsonFile.jsonFile.shortPath;
173
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
174
- }
175
- function logPinnedMismatch(report) {
176
- const _tag = report._tag;
177
- const fixable = report.fixable;
178
- const instance = fixable.instance;
179
- const actual = instance.rawSpecifier;
180
- const expected = fixable.raw;
181
- const name = instance.name;
182
- const path = instance.strategy.path;
183
- const shortPath = instance.packageJsonFile.jsonFile.shortPath;
184
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
185
- }
186
- function logSemverRangeMismatch(report) {
187
- const _tag = report._tag;
188
- const fixable = report.fixable;
189
- const instance = fixable.instance;
190
- const actual = instance.rawSpecifier;
191
- const expected = fixable.raw;
192
- const name = instance.name;
193
- const path = instance.strategy.path;
194
- const shortPath = instance.packageJsonFile.jsonFile.shortPath;
195
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
196
- }
197
- function logSnappedToMismatch(report) {
198
- const _tag = report._tag;
199
- const fixable = report.fixable;
200
- const instance = fixable.instance;
201
- const actual = instance.rawSpecifier;
202
- const expected = fixable.raw;
203
- const name = instance.name;
204
- const path = instance.strategy.path;
205
- const shortPath = instance.packageJsonFile.jsonFile.shortPath;
206
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
207
- }
208
- function logMissingLocalVersion(report) {
209
- const instance = report.unfixable;
210
- const localPath = report.localInstance.packageJsonFile.jsonFile.shortPath;
211
- const jsonFile = instance.packageJsonFile.jsonFile;
212
- const actual = instance.rawSpecifier;
213
- const name = instance.name;
214
- const path = instance.strategy.path;
215
- const shortPath = jsonFile.shortPath;
216
- return effect_1.Effect.logInfo([
217
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingLocalVersion]}`,
218
- (0, chalk_1.default) ` {red ${localPath} does not have a .version property which is exact semver}`,
219
- ].join(os_1.EOL));
220
- }
221
- exports.logMissingLocalVersion = logMissingLocalVersion;
222
- function logMissingSnappedToMismatch(report) {
223
- const instance = report.unfixable;
224
- const jsonFile = instance.packageJsonFile.jsonFile;
225
- const actual = instance.rawSpecifier;
226
- const name = instance.name;
227
- const path = instance.strategy.path;
228
- const shortPath = jsonFile.shortPath;
229
- return effect_1.Effect.logInfo([
230
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingSnappedToMismatch]}`,
231
- (0, chalk_1.default) ` {red no package in this groups .snapTo array depend on ${name}}`,
232
- ].join(os_1.EOL));
233
- }
234
- exports.logMissingSnappedToMismatch = logMissingSnappedToMismatch;
235
- function logUnsupportedMismatch(report) {
236
- const instance = report.unfixable;
237
- const jsonFile = instance.packageJsonFile.jsonFile;
238
- const actual = instance.rawSpecifier;
239
- const name = instance.name;
240
- const path = instance.strategy.path;
241
- const shortPath = jsonFile.shortPath;
242
- return effect_1.Effect.logInfo([
243
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [UnsupportedMismatch]}`,
244
- (0, chalk_1.default) ` {red use {blue syncpack prompt} to fix this manually}`,
245
- ].join(os_1.EOL));
246
- }
247
- exports.logUnsupportedMismatch = logUnsupportedMismatch;
248
- function logSameRangeMismatch(report) {
249
- const instance = report.unfixable;
250
- const jsonFile = instance.packageJsonFile.jsonFile;
251
- const actual = instance.rawSpecifier;
252
- const name = instance.name;
253
- const path = instance.strategy.path;
254
- const shortPath = jsonFile.shortPath;
255
- const mismatches = report.mismatches;
256
- return effect_1.Effect.logInfo([
257
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red range ${actual} does not include ${mismatches.join(', ')}} {gray ${shortPath} > ${path}} {blue [SameRangeMismatch]}`,
258
- (0, chalk_1.default) ` {gray use {blue syncpack prompt} to fix this manually}`,
259
- ].join(os_1.EOL));
260
- }
261
- exports.logSameRangeMismatch = logSameRangeMismatch;
57
+ const onReportGroup = {
58
+ Excluded(amount) {
59
+ if (amount === 0)
60
+ return effect_1.Effect.unit;
61
+ const msg = (0, chalk_1.default) `{gray ${(0, pad_start_1.padStart)(amount)} ${constants_1.ICON.rightArrow} ignored}`;
62
+ return effect_1.Effect.logInfo(msg);
63
+ },
64
+ Fixable(amount) {
65
+ if (amount === 0)
66
+ return effect_1.Effect.unit;
67
+ const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} can be auto-fixed`;
68
+ return effect_1.Effect.logInfo(msg);
69
+ },
70
+ Unfixable(amount) {
71
+ if (amount === 0)
72
+ return effect_1.Effect.unit;
73
+ const msg = (0, chalk_1.default) `{red ${(0, pad_start_1.padStart)(amount)} ${constants_1.ICON.panic} can be fixed manually using} {blue syncpack prompt}`;
74
+ return effect_1.Effect.logInfo(msg);
75
+ },
76
+ Valid(amount) {
77
+ if (amount === 0)
78
+ return effect_1.Effect.unit;
79
+ const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} already valid`;
80
+ return effect_1.Effect.logInfo(msg);
81
+ },
82
+ };
83
+ const onReportTag = {
84
+ Banned(report) {
85
+ const _tag = report._tag;
86
+ const instance = report.fixable.instance;
87
+ const name = instance.name;
88
+ const jsonFile = instance.packageJsonFile.jsonFile;
89
+ const path = instance.strategy.path;
90
+ const shortPath = jsonFile.shortPath;
91
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red banned} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
92
+ },
93
+ Disabled(_report) {
94
+ return effect_1.Effect.unit;
95
+ },
96
+ FilteredOut(_report) {
97
+ return effect_1.Effect.unit;
98
+ },
99
+ HighestSemverMismatch(report) {
100
+ const _tag = report._tag;
101
+ const fixable = report.fixable;
102
+ const instance = fixable.instance;
103
+ const jsonFile = instance.packageJsonFile.jsonFile;
104
+ const actual = instance.rawSpecifier.raw;
105
+ const expected = fixable.raw;
106
+ const name = instance.name;
107
+ const path = instance.strategy.path;
108
+ const shortPath = jsonFile.shortPath;
109
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
110
+ },
111
+ Ignored(_report) {
112
+ return effect_1.Effect.unit;
113
+ },
114
+ LocalPackageMismatch(report) {
115
+ const _tag = report._tag;
116
+ const fixable = report.fixable;
117
+ const instance = fixable.instance;
118
+ const actual = instance.rawSpecifier.raw;
119
+ const expected = fixable.raw;
120
+ const name = instance.name;
121
+ const path = instance.strategy.path;
122
+ const shortPath = instance.packageJsonFile.jsonFile.shortPath;
123
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
124
+ },
125
+ LowestSemverMismatch(report) {
126
+ const _tag = report._tag;
127
+ const fixable = report.fixable;
128
+ const instance = fixable.instance;
129
+ const actual = instance.rawSpecifier.raw;
130
+ const expected = fixable.raw;
131
+ const name = instance.name;
132
+ const path = instance.strategy.path;
133
+ const shortPath = instance.packageJsonFile.jsonFile.shortPath;
134
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
135
+ },
136
+ MissingLocalVersion(report) {
137
+ const instance = report.unfixable;
138
+ const localPath = report.localInstance.packageJsonFile.jsonFile.shortPath;
139
+ const jsonFile = instance.packageJsonFile.jsonFile;
140
+ const actual = instance.rawSpecifier.raw;
141
+ const name = instance.name;
142
+ const path = instance.strategy.path;
143
+ const shortPath = jsonFile.shortPath;
144
+ return effect_1.Effect.logInfo([
145
+ (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingLocalVersion]}`,
146
+ (0, chalk_1.default) ` {red ${localPath} does not have a .version property which is exact semver}`,
147
+ ].join(os_1.EOL));
148
+ },
149
+ MissingSnappedToMismatch(report) {
150
+ const instance = report.unfixable;
151
+ const jsonFile = instance.packageJsonFile.jsonFile;
152
+ const actual = instance.rawSpecifier.raw;
153
+ const name = instance.name;
154
+ const path = instance.strategy.path;
155
+ const shortPath = jsonFile.shortPath;
156
+ return effect_1.Effect.logInfo([
157
+ (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingSnappedToMismatch]}`,
158
+ (0, chalk_1.default) ` {red no package in this groups .snapTo array depend on ${name}}`,
159
+ ].join(os_1.EOL));
160
+ },
161
+ PinnedMismatch(report) {
162
+ const _tag = report._tag;
163
+ const fixable = report.fixable;
164
+ const instance = fixable.instance;
165
+ const actual = instance.rawSpecifier.raw;
166
+ const expected = fixable.raw;
167
+ const name = instance.name;
168
+ const path = instance.strategy.path;
169
+ const shortPath = instance.packageJsonFile.jsonFile.shortPath;
170
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
171
+ },
172
+ SameRangeMismatch(report) {
173
+ const instance = report.unfixable;
174
+ const jsonFile = instance.packageJsonFile.jsonFile;
175
+ const actual = instance.rawSpecifier.raw;
176
+ const name = instance.name;
177
+ const path = instance.strategy.path;
178
+ const shortPath = jsonFile.shortPath;
179
+ const mismatches = report.mismatches;
180
+ return effect_1.Effect.logInfo([
181
+ (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red range ${actual} does not include ${mismatches.join(', ')}} {gray ${shortPath} > ${path}} {blue [SameRangeMismatch]}`,
182
+ (0, chalk_1.default) ` {gray use {blue syncpack prompt} to fix this manually}`,
183
+ ].join(os_1.EOL));
184
+ },
185
+ SemverRangeMismatch(report) {
186
+ const _tag = report._tag;
187
+ const fixable = report.fixable;
188
+ const instance = fixable.instance;
189
+ const actual = instance.rawSpecifier.raw;
190
+ const expected = fixable.raw;
191
+ const name = instance.name;
192
+ const path = instance.strategy.path;
193
+ const shortPath = instance.packageJsonFile.jsonFile.shortPath;
194
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
195
+ },
196
+ SnappedToMismatch(report) {
197
+ const _tag = report._tag;
198
+ const fixable = report.fixable;
199
+ const instance = fixable.instance;
200
+ const actual = instance.rawSpecifier.raw;
201
+ const expected = fixable.raw;
202
+ const name = instance.name;
203
+ const path = instance.strategy.path;
204
+ const shortPath = instance.packageJsonFile.jsonFile.shortPath;
205
+ return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
206
+ },
207
+ UnsupportedMismatch(report) {
208
+ const instance = report.unfixable;
209
+ const jsonFile = instance.packageJsonFile.jsonFile;
210
+ const actual = instance.rawSpecifier.raw;
211
+ const name = instance.name;
212
+ const path = instance.strategy.path;
213
+ const shortPath = jsonFile.shortPath;
214
+ return effect_1.Effect.logInfo([
215
+ (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [UnsupportedMismatch]}`,
216
+ (0, chalk_1.default) ` {red use {blue syncpack prompt} to fix this manually}`,
217
+ ].join(os_1.EOL));
218
+ },
219
+ Valid(_report) {
220
+ return effect_1.Effect.unit;
221
+ },
222
+ };
223
+ exports.logMissingLocalVersion = onReportTag.MissingLocalVersion;
224
+ exports.logMissingSnappedToMismatch = onReportTag.MissingSnappedToMismatch;
225
+ exports.logUnsupportedMismatch = onReportTag.UnsupportedMismatch;
226
+ exports.logSameRangeMismatch = onReportTag.SameRangeMismatch;
@@ -49,6 +49,7 @@ commander_1.program
49
49
  .option(...option_1.option.source)
50
50
  .option(...option_1.option.filter)
51
51
  .option(...option_1.option.config)
52
+ .option(...option_1.option.specs)
52
53
  .option(...option_1.option.types)
53
54
  .option(...option_1.option.indent)
54
55
  .parse(process.argv);
@@ -58,6 +59,7 @@ effect_1.Effect.runPromise((0, prompt_1.prompt)({
58
59
  configPath: commander_1.program.opts().config,
59
60
  filter: commander_1.program.opts().filter,
60
61
  source: commander_1.program.opts().source,
62
+ specs: commander_1.program.opts().specs,
61
63
  types: commander_1.program.opts().types,
62
64
  indent: commander_1.program.opts().indent,
63
65
  },
@@ -67,9 +67,13 @@ function isUnfixable(report) {
67
67
  }
68
68
  function askForNextVersion(groupReport, unfixable) {
69
69
  return (0, effect_1.pipe)(effect_1.Effect.gen(function* ($) {
70
- const choices = (0, uniq_1.uniq)(groupReport.reports.map((instanceReport) => instanceReport.specifier?.raw ||
71
- instanceReport.fixable?.raw ||
72
- instanceReport.unfixable?.rawSpecifier)).filter(is_string_1.isString);
70
+ const choices = (0, uniq_1.uniq)(groupReport.reports.map((report) => report._tagGroup === 'Fixable'
71
+ ? report.fixable.raw
72
+ : report._tagGroup === 'Unfixable'
73
+ ? report.unfixable.rawSpecifier
74
+ : report._tagGroup === 'Valid'
75
+ ? report.specifier.raw
76
+ : null)).filter(is_string_1.isString);
73
77
  const OTHER = chalk_1.default.dim('Other');
74
78
  const SKIP = chalk_1.default.dim('Skip');
75
79
  const QUIT = chalk_1.default.dim('Quit');
@@ -57,16 +57,18 @@ commander_1.program
57
57
  .option(...option_1.option.source)
58
58
  .option(...option_1.option.filter)
59
59
  .option(...option_1.option.config)
60
+ .option(...option_1.option.specs)
60
61
  .option(...option_1.option.types)
61
62
  .option(...option_1.option.indent)
62
63
  .parse(process.argv);
63
- effect_1.Effect.runSync((0, set_semver_ranges_1.setSemverRanges)({
64
+ effect_1.Effect.runPromise((0, set_semver_ranges_1.setSemverRanges)({
64
65
  io: io_1.io,
65
66
  cli: {
66
67
  configPath: commander_1.program.opts().config,
67
68
  filter: commander_1.program.opts().filter,
68
69
  indent: commander_1.program.opts().indent,
69
70
  source: commander_1.program.opts().source,
71
+ specs: commander_1.program.opts().specs,
70
72
  types: commander_1.program.opts().types,
71
73
  },
72
74
  }));
@@ -98,9 +98,9 @@ exports.updateEffects = {
98
98
  inFlight.delete(format(instance));
99
99
  const latest = versions?.latest;
100
100
  if (latest) {
101
- if ((0, gtr_1.default)(latest, instance.rawSpecifier, true)) {
101
+ if ((0, gtr_1.default)(latest, String(instance.rawSpecifier.raw), true)) {
102
102
  outdatedCount++;
103
- mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
103
+ mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
104
104
  }
105
105
  else {
106
106
  mostRecent.push((0, chalk_1.default) `{green ${instance.name}}`);
@@ -116,7 +116,7 @@ exports.updateEffects = {
116
116
  /** After checking the registry, store this instance known to have newer versions available */
117
117
  onOutdated(instance, latest) {
118
118
  outdatedCount++;
119
- mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
119
+ mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
120
120
  return effect_1.Effect.unit;
121
121
  },
122
122
  /** As the last request completes, remove the progress information */
@@ -208,14 +208,14 @@ function promptForReleaseType(releaseType, doState) {
208
208
  choices: releases.map((updateable) => {
209
209
  const spacingValue = 50 -
210
210
  updateable.instance.name.length -
211
- updateable.instance.rawSpecifier.length -
211
+ String(updateable.instance.rawSpecifier).length -
212
212
  updateable.versions.latest.length;
213
213
  const spacing = Array.from({ length: spacingValue }).fill(' ').join('');
214
214
  const repoUrl = updateable.repoUrl
215
215
  ? (0, chalk_1.default) `${spacing} {white - ${updateable.repoUrl}}`
216
216
  : '';
217
217
  return {
218
- title: (0, chalk_1.default) `${updateable.instance.name} {gray ${updateable.instance.rawSpecifier} ${constants_1.ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
218
+ title: (0, chalk_1.default) `${updateable.instance.name} {gray ${updateable.instance.rawSpecifier.raw} ${constants_1.ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
219
219
  selected: true,
220
220
  value: updateable,
221
221
  };
@@ -235,7 +235,7 @@ function promptForReleaseType(releaseType, doState) {
235
235
  }
236
236
  function groupByReleaseType(releases) {
237
237
  return effect_1.Effect.succeed(releases.reduce((releasesByType, release) => {
238
- const previous = (0, set_semver_range_1.setSemverRange)('', release.instance.rawSpecifier);
238
+ const previous = (0, set_semver_range_1.setSemverRange)('', String(release.instance.rawSpecifier.raw));
239
239
  const latest = release.versions.latest;
240
240
  try {
241
241
  const type = (0, semver_1.diff)(previous, latest);
@@ -47,11 +47,13 @@ commander_1.program
47
47
  .option(...option_1.option.source)
48
48
  .option(...option_1.option.filter)
49
49
  .option(...option_1.option.config)
50
+ .option(...option_1.option.specs)
50
51
  .option(...option_1.option.types)
51
52
  .parse(process.argv);
52
53
  effect_1.Effect.runPromise((0, update_1.update)(io_1.io, {
53
54
  configPath: commander_1.program.opts().config,
54
55
  filter: commander_1.program.opts().filter,
55
56
  source: commander_1.program.opts().source,
57
+ specs: commander_1.program.opts().specs,
56
58
  types: commander_1.program.opts().types,
57
59
  }));
@@ -26,8 +26,8 @@ function update(io, cli, effects = effects_1.updateEffects, errorHandlers = defa
26
26
  if (!isVisitedByName[instance.name] &&
27
27
  (instance.versionGroup._tag === 'SameRange' ||
28
28
  instance.versionGroup._tag === 'Standard')) {
29
- const specifier = specifier_1.Specifier.create(instance, instance.rawSpecifier);
30
- if (specifier._tag === 'RangeSpecifier' || specifier._tag === 'VersionSpecifier') {
29
+ const specifier = specifier_1.Specifier.create(instance, instance.rawSpecifier.raw);
30
+ if (specifier._tag === 'Range' || specifier._tag === 'Exact') {
31
31
  isVisitedByName[instance.name] = true;
32
32
  updateable.push(instance);
33
33
  }
@@ -39,7 +39,7 @@ function update(io, cli, effects = effects_1.updateEffects, errorHandlers = defa
39
39
  onSuccess: ({ versions }) => effects_1.updateEffects.onFetchEnd(instance, versions),
40
40
  }),
41
41
  // move up to date dependencies to error channel
42
- effect_1.Effect.flatMap((updateable) => (0, semver_1.gtr)(updateable.versions.latest, instance.rawSpecifier)
42
+ effect_1.Effect.flatMap((updateable) => (0, semver_1.gtr)(updateable.versions.latest, String(instance.rawSpecifier.raw))
43
43
  ? (0, effect_1.pipe)(effects_1.updateEffects.onOutdated(instance, updateable.versions.latest), effect_1.Effect.map(() => updateable))
44
44
  : (0, effect_1.pipe)(effects_1.updateEffects.onUpToDate(instance), effect_1.Effect.flatMap(() => effect_1.Effect.fail(updateable)))),
45
45
  // log error but don't catch it
@@ -5,6 +5,7 @@ const effect_1 = require("effect");
5
5
  const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
6
6
  const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
7
  const is_object_1 = require("tightrope/guard/is-object");
8
+ const constants_1 = require("../constants");
8
9
  const name_and_version_props_1 = require("../strategy/name-and-version-props");
9
10
  const named_version_string_1 = require("../strategy/named-version-string");
10
11
  const unnamed_version_string_1 = require("../strategy/unnamed-version-string");
@@ -15,7 +16,7 @@ exports.InvalidCustomTypeError = InvalidCustomTypeError;
15
16
  function getCustomTypes({ rcFile, }) {
16
17
  if (!(0, is_non_empty_object_1.isNonEmptyObject)(rcFile.customTypes))
17
18
  return effect_1.Effect.succeed([]);
18
- return effect_1.Effect.all(Object.entries(rcFile.customTypes).map(([name, config]) => {
19
+ return effect_1.Effect.all([...Object.entries(rcFile.customTypes), ...Object.entries(constants_1.DEFAULT_CONFIG.customTypes)].map(([name, config]) => {
19
20
  const ERR_OBJ = 'Invalid customType';
20
21
  const ERR_PATH = 'Invalid customType.path';
21
22
  const ERR_NAME_PATH = 'Invalid customType.namePath';