syncpack 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/bin-fix-mismatches/index.js +2 -0
- package/dist/bin-lint-semver-ranges/index.js +2 -0
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +2 -2
- package/dist/bin-list/index.js +2 -0
- package/dist/bin-list/list.js +2 -2
- package/dist/bin-list-mismatches/index.js +2 -0
- package/dist/bin-list-mismatches/list-mismatches.js +10 -10
- package/dist/bin-prompt/index.js +2 -0
- package/dist/bin-set-semver-ranges/index.js +2 -0
- package/dist/bin-update/effects.js +6 -6
- package/dist/bin-update/index.js +2 -0
- package/dist/bin-update/update.js +3 -3
- package/dist/config/types.d.ts +11 -2
- package/dist/constants.d.ts +55 -23
- package/dist/constants.js +34 -32
- package/dist/get-instances/instance.d.ts +2 -1
- package/dist/get-instances/instance.js +4 -3
- package/dist/guards/can-add-to-group.js +14 -7
- package/dist/option.d.ts +1 -0
- package/dist/option.js +4 -0
- package/dist/schema.json +136 -12
- package/dist/semver-group/create-semver-groups.js +6 -0
- package/dist/semver-group/with-range.d.ts +1 -1
- package/dist/semver-group/with-range.js +3 -3
- package/dist/specifier/alias.d.ts +2 -0
- package/dist/specifier/alias.js +3 -1
- package/dist/specifier/base.d.ts +4 -2
- package/dist/specifier/base.js +3 -1
- package/dist/specifier/delete.d.ts +4 -2
- package/dist/specifier/delete.js +3 -1
- package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
- package/dist/specifier/{version.js → exact.js} +6 -4
- package/dist/specifier/file.d.ts +2 -0
- package/dist/specifier/file.js +3 -1
- package/dist/specifier/hosted-git.d.ts +2 -0
- package/dist/specifier/hosted-git.js +3 -1
- package/dist/specifier/index.d.ts +5 -3
- package/dist/specifier/index.js +7 -3
- package/dist/specifier/latest.d.ts +19 -0
- package/dist/specifier/latest.js +24 -0
- package/dist/specifier/range.d.ts +2 -1
- package/dist/specifier/range.js +3 -2
- package/dist/specifier/tag.d.ts +2 -0
- package/dist/specifier/tag.js +3 -1
- package/dist/specifier/unsupported.d.ts +2 -0
- package/dist/specifier/unsupported.js +3 -1
- package/dist/specifier/url.d.ts +2 -0
- package/dist/specifier/url.js +3 -1
- package/dist/specifier/workspace-protocol.d.ts +2 -0
- package/dist/specifier/workspace-protocol.js +3 -1
- package/dist/version-group/create-version-groups.js +11 -0
- package/dist/version-group/pinned.js +1 -1
- package/dist/version-group/same-range.js +5 -5
- package/dist/version-group/snapped-to.js +5 -5
- package/dist/version-group/standard.js +9 -9
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# syncpack
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
<center>
|
|
4
|
+
<img src="https://jamiemason.github.io/syncpack/logo.svg" width="200" height="179" alt="" />
|
|
5
|
+
<div>Consistent dependency versions in large JavaScript Monorepos.</div>
|
|
6
|
+
<div><a href="https://jamiemason.github.io/syncpack">https://jamiemason.github.io/syncpack</a></div>
|
|
7
|
+
</center>
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
@@ -8,10 +12,6 @@
|
|
|
8
12
|
npm install --save-dev syncpack
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
## Documentation
|
|
12
|
-
|
|
13
|
-
Full information can be found in the documentation at https://jamiemason.github.io/syncpack/.
|
|
14
|
-
|
|
15
15
|
## Commands
|
|
16
16
|
|
|
17
17
|
### [fix-mismatches](https://jamiemason.github.io/syncpack/command/fix-mismatches)
|
|
@@ -51,6 +51,7 @@ Reference:
|
|
|
51
51
|
commander_1.program
|
|
52
52
|
.option(...option_1.option.source)
|
|
53
53
|
.option(...option_1.option.filter)
|
|
54
|
+
.option(...option_1.option.specs)
|
|
54
55
|
.option(...option_1.option.types)
|
|
55
56
|
.option(...option_1.option.config)
|
|
56
57
|
.option(...option_1.option.indent)
|
|
@@ -62,6 +63,7 @@ effect_1.Effect.runPromise((0, fix_mismatches_1.fixMismatches)({
|
|
|
62
63
|
filter: commander_1.program.opts().filter,
|
|
63
64
|
indent: commander_1.program.opts().indent,
|
|
64
65
|
source: commander_1.program.opts().source,
|
|
66
|
+
specs: commander_1.program.opts().specs,
|
|
65
67
|
types: commander_1.program.opts().types,
|
|
66
68
|
},
|
|
67
69
|
}));
|
|
@@ -55,6 +55,7 @@ commander_1.program
|
|
|
55
55
|
.option(...option_1.option.source)
|
|
56
56
|
.option(...option_1.option.filter)
|
|
57
57
|
.option(...option_1.option.config)
|
|
58
|
+
.option(...option_1.option.specs)
|
|
58
59
|
.option(...option_1.option.types)
|
|
59
60
|
.parse(process.argv);
|
|
60
61
|
effect_1.Effect.runPromise((0, lint_semver_ranges_1.lintSemverRanges)({
|
|
@@ -63,6 +64,7 @@ effect_1.Effect.runPromise((0, lint_semver_ranges_1.lintSemverRanges)({
|
|
|
63
64
|
configPath: commander_1.program.opts().config,
|
|
64
65
|
filter: commander_1.program.opts().filter,
|
|
65
66
|
source: commander_1.program.opts().source,
|
|
67
|
+
specs: commander_1.program.opts().specs,
|
|
66
68
|
types: commander_1.program.opts().types,
|
|
67
69
|
},
|
|
68
70
|
}));
|
|
@@ -84,7 +84,7 @@ function logSemverRangeMismatch(report) {
|
|
|
84
84
|
const _tag = report._tag;
|
|
85
85
|
const instance = report.fixable.instance;
|
|
86
86
|
const name = instance.name;
|
|
87
|
-
const actual = instance.rawSpecifier;
|
|
87
|
+
const actual = instance.rawSpecifier.raw;
|
|
88
88
|
const expected = report.fixable.raw;
|
|
89
89
|
const propPath = instance.strategy.path;
|
|
90
90
|
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
@@ -94,7 +94,7 @@ function logUnsupportedMismatch(report) {
|
|
|
94
94
|
const _tag = report._tag;
|
|
95
95
|
const instance = report.unfixable;
|
|
96
96
|
const name = instance.name;
|
|
97
|
-
const actual = instance.rawSpecifier;
|
|
97
|
+
const actual = instance.rawSpecifier.raw;
|
|
98
98
|
const propPath = instance.strategy.path;
|
|
99
99
|
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
100
100
|
return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross} name {white ${name}} or version {white ${actual}} are not supported} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
|
package/dist/bin-list/index.js
CHANGED
|
@@ -47,6 +47,7 @@ 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, list_1.list)({
|
|
@@ -55,6 +56,7 @@ effect_1.Effect.runPromise((0, list_1.list)({
|
|
|
55
56
|
configPath: commander_1.program.opts().config,
|
|
56
57
|
filter: commander_1.program.opts().filter,
|
|
57
58
|
source: commander_1.program.opts().source,
|
|
59
|
+
specs: commander_1.program.opts().specs,
|
|
58
60
|
types: commander_1.program.opts().types,
|
|
59
61
|
},
|
|
60
62
|
}));
|
package/dist/bin-list/list.js
CHANGED
|
@@ -132,13 +132,13 @@ function logMismatchingReport(groupReport, messages) {
|
|
|
132
132
|
}
|
|
133
133
|
function getLogForFixable(report) {
|
|
134
134
|
const _tag = report._tag;
|
|
135
|
-
const actual = report.fixable.instance.rawSpecifier;
|
|
135
|
+
const actual = report.fixable.instance.rawSpecifier.raw;
|
|
136
136
|
const expected = report.fixable.raw;
|
|
137
137
|
return (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {green ${expected}} {gray [${_tag}]}`;
|
|
138
138
|
}
|
|
139
139
|
function getLogForUnfixable(report) {
|
|
140
140
|
const _tag = report._tag;
|
|
141
|
-
const actual = report.unfixable.rawSpecifier;
|
|
141
|
+
const actual = report.unfixable.rawSpecifier.raw;
|
|
142
142
|
return (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {gray [${_tag}]}`;
|
|
143
143
|
}
|
|
144
144
|
function logOtherCommands() {
|
|
@@ -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
|
.parse(process.argv);
|
|
54
55
|
effect_1.Effect.runPromise((0, list_mismatches_1.listMismatches)({
|
|
@@ -57,6 +58,7 @@ effect_1.Effect.runPromise((0, list_mismatches_1.listMismatches)({
|
|
|
57
58
|
configPath: commander_1.program.opts().config,
|
|
58
59
|
filter: commander_1.program.opts().filter,
|
|
59
60
|
source: commander_1.program.opts().source,
|
|
61
|
+
specs: commander_1.program.opts().specs,
|
|
60
62
|
types: commander_1.program.opts().types,
|
|
61
63
|
},
|
|
62
64
|
}));
|
|
@@ -101,7 +101,7 @@ const onReportTag = {
|
|
|
101
101
|
const fixable = report.fixable;
|
|
102
102
|
const instance = fixable.instance;
|
|
103
103
|
const jsonFile = instance.packageJsonFile.jsonFile;
|
|
104
|
-
const actual = instance.rawSpecifier;
|
|
104
|
+
const actual = instance.rawSpecifier.raw;
|
|
105
105
|
const expected = fixable.raw;
|
|
106
106
|
const name = instance.name;
|
|
107
107
|
const path = instance.strategy.path;
|
|
@@ -115,7 +115,7 @@ const onReportTag = {
|
|
|
115
115
|
const _tag = report._tag;
|
|
116
116
|
const fixable = report.fixable;
|
|
117
117
|
const instance = fixable.instance;
|
|
118
|
-
const actual = instance.rawSpecifier;
|
|
118
|
+
const actual = instance.rawSpecifier.raw;
|
|
119
119
|
const expected = fixable.raw;
|
|
120
120
|
const name = instance.name;
|
|
121
121
|
const path = instance.strategy.path;
|
|
@@ -126,7 +126,7 @@ const onReportTag = {
|
|
|
126
126
|
const _tag = report._tag;
|
|
127
127
|
const fixable = report.fixable;
|
|
128
128
|
const instance = fixable.instance;
|
|
129
|
-
const actual = instance.rawSpecifier;
|
|
129
|
+
const actual = instance.rawSpecifier.raw;
|
|
130
130
|
const expected = fixable.raw;
|
|
131
131
|
const name = instance.name;
|
|
132
132
|
const path = instance.strategy.path;
|
|
@@ -137,7 +137,7 @@ const onReportTag = {
|
|
|
137
137
|
const instance = report.unfixable;
|
|
138
138
|
const localPath = report.localInstance.packageJsonFile.jsonFile.shortPath;
|
|
139
139
|
const jsonFile = instance.packageJsonFile.jsonFile;
|
|
140
|
-
const actual = instance.rawSpecifier;
|
|
140
|
+
const actual = instance.rawSpecifier.raw;
|
|
141
141
|
const name = instance.name;
|
|
142
142
|
const path = instance.strategy.path;
|
|
143
143
|
const shortPath = jsonFile.shortPath;
|
|
@@ -149,7 +149,7 @@ const onReportTag = {
|
|
|
149
149
|
MissingSnappedToMismatch(report) {
|
|
150
150
|
const instance = report.unfixable;
|
|
151
151
|
const jsonFile = instance.packageJsonFile.jsonFile;
|
|
152
|
-
const actual = instance.rawSpecifier;
|
|
152
|
+
const actual = instance.rawSpecifier.raw;
|
|
153
153
|
const name = instance.name;
|
|
154
154
|
const path = instance.strategy.path;
|
|
155
155
|
const shortPath = jsonFile.shortPath;
|
|
@@ -162,7 +162,7 @@ const onReportTag = {
|
|
|
162
162
|
const _tag = report._tag;
|
|
163
163
|
const fixable = report.fixable;
|
|
164
164
|
const instance = fixable.instance;
|
|
165
|
-
const actual = instance.rawSpecifier;
|
|
165
|
+
const actual = instance.rawSpecifier.raw;
|
|
166
166
|
const expected = fixable.raw;
|
|
167
167
|
const name = instance.name;
|
|
168
168
|
const path = instance.strategy.path;
|
|
@@ -172,7 +172,7 @@ const onReportTag = {
|
|
|
172
172
|
SameRangeMismatch(report) {
|
|
173
173
|
const instance = report.unfixable;
|
|
174
174
|
const jsonFile = instance.packageJsonFile.jsonFile;
|
|
175
|
-
const actual = instance.rawSpecifier;
|
|
175
|
+
const actual = instance.rawSpecifier.raw;
|
|
176
176
|
const name = instance.name;
|
|
177
177
|
const path = instance.strategy.path;
|
|
178
178
|
const shortPath = jsonFile.shortPath;
|
|
@@ -186,7 +186,7 @@ const onReportTag = {
|
|
|
186
186
|
const _tag = report._tag;
|
|
187
187
|
const fixable = report.fixable;
|
|
188
188
|
const instance = fixable.instance;
|
|
189
|
-
const actual = instance.rawSpecifier;
|
|
189
|
+
const actual = instance.rawSpecifier.raw;
|
|
190
190
|
const expected = fixable.raw;
|
|
191
191
|
const name = instance.name;
|
|
192
192
|
const path = instance.strategy.path;
|
|
@@ -197,7 +197,7 @@ const onReportTag = {
|
|
|
197
197
|
const _tag = report._tag;
|
|
198
198
|
const fixable = report.fixable;
|
|
199
199
|
const instance = fixable.instance;
|
|
200
|
-
const actual = instance.rawSpecifier;
|
|
200
|
+
const actual = instance.rawSpecifier.raw;
|
|
201
201
|
const expected = fixable.raw;
|
|
202
202
|
const name = instance.name;
|
|
203
203
|
const path = instance.strategy.path;
|
|
@@ -207,7 +207,7 @@ const onReportTag = {
|
|
|
207
207
|
UnsupportedMismatch(report) {
|
|
208
208
|
const instance = report.unfixable;
|
|
209
209
|
const jsonFile = instance.packageJsonFile.jsonFile;
|
|
210
|
-
const actual = instance.rawSpecifier;
|
|
210
|
+
const actual = instance.rawSpecifier.raw;
|
|
211
211
|
const name = instance.name;
|
|
212
212
|
const path = instance.strategy.path;
|
|
213
213
|
const shortPath = jsonFile.shortPath;
|
package/dist/bin-prompt/index.js
CHANGED
|
@@ -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
|
},
|
|
@@ -57,6 +57,7 @@ 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);
|
|
@@ -67,6 +68,7 @@ effect_1.Effect.runPromise((0, set_semver_ranges_1.setSemverRanges)({
|
|
|
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);
|
package/dist/bin-update/index.js
CHANGED
|
@@ -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 === '
|
|
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
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CUSTOM_TYPES } from '../constants';
|
|
2
|
+
import type { Specifier } from '../specifier';
|
|
1
3
|
/**
|
|
2
4
|
* Aliases for semver range formats supported by syncpack
|
|
3
5
|
*
|
|
@@ -18,11 +20,15 @@
|
|
|
18
20
|
* @default ""
|
|
19
21
|
*/
|
|
20
22
|
export type SemverRange = '' | '*' | '>' | '>=' | '.x' | '<' | '<=' | '^' | '~' | 'workspace:';
|
|
23
|
+
type DefaultDependencyType = keyof typeof CUSTOM_TYPES;
|
|
24
|
+
export type DependencyType = DefaultDependencyType | `!${DefaultDependencyType}` | (string & {});
|
|
25
|
+
export type SpecifierType = Specifier.Any['name'] | `!${Specifier.Any['name']}` | (string & {});
|
|
21
26
|
export interface GroupConfig {
|
|
22
27
|
dependencies?: string[];
|
|
23
|
-
dependencyTypes?:
|
|
28
|
+
dependencyTypes?: DependencyType[];
|
|
24
29
|
label?: string;
|
|
25
30
|
packages?: string[];
|
|
31
|
+
specifierTypes?: SpecifierType[];
|
|
26
32
|
}
|
|
27
33
|
export declare namespace SemverGroupConfig {
|
|
28
34
|
interface Disabled extends GroupConfig {
|
|
@@ -85,13 +91,14 @@ export interface CliConfig {
|
|
|
85
91
|
readonly filter: string;
|
|
86
92
|
readonly indent: string;
|
|
87
93
|
readonly source: string[];
|
|
94
|
+
readonly specs: string;
|
|
88
95
|
readonly types: string;
|
|
89
96
|
}
|
|
90
97
|
export interface RcConfig {
|
|
91
98
|
/** @see https://jamiemason.github.io/syncpack/config/custom-types */
|
|
92
99
|
customTypes: Record<string, CustomTypeConfig.Any>;
|
|
93
100
|
/** @see https://jamiemason.github.io/syncpack/config/dependency-types */
|
|
94
|
-
dependencyTypes:
|
|
101
|
+
dependencyTypes: DependencyType[];
|
|
95
102
|
/** @see https://jamiemason.github.io/syncpack/config/filter */
|
|
96
103
|
filter: string;
|
|
97
104
|
/** @see https://jamiemason.github.io/syncpack/config/indent */
|
|
@@ -104,6 +111,8 @@ export interface RcConfig {
|
|
|
104
111
|
sortFirst: string[];
|
|
105
112
|
/** @see https://jamiemason.github.io/syncpack/config/source */
|
|
106
113
|
source: string[];
|
|
114
|
+
/** @see https://jamiemason.github.io/syncpack/config/specifier-types */
|
|
115
|
+
specifierTypes: SpecifierType[];
|
|
107
116
|
/** @see https://jamiemason.github.io/syncpack/config/version-groups */
|
|
108
117
|
versionGroups: VersionGroupConfig.Any[];
|
|
109
118
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -24,44 +24,76 @@ export declare const RANGE: {
|
|
|
24
24
|
readonly WORKSPACE: "workspace:";
|
|
25
25
|
};
|
|
26
26
|
export declare const INTERNAL_TYPES: readonly ["dev", "local", "overrides", "peer", "pnpmOverrides", "prod", "resolutions"];
|
|
27
|
+
export declare const CUSTOM_TYPES: {
|
|
28
|
+
readonly dev: {
|
|
29
|
+
readonly strategy: "versionsByName";
|
|
30
|
+
readonly path: "devDependencies";
|
|
31
|
+
};
|
|
32
|
+
readonly local: {
|
|
33
|
+
readonly strategy: "name~version";
|
|
34
|
+
readonly namePath: "name";
|
|
35
|
+
readonly path: "version";
|
|
36
|
+
};
|
|
37
|
+
readonly overrides: {
|
|
38
|
+
readonly strategy: "versionsByName";
|
|
39
|
+
readonly path: "overrides";
|
|
40
|
+
};
|
|
41
|
+
readonly peer: {
|
|
42
|
+
readonly strategy: "versionsByName";
|
|
43
|
+
readonly path: "peerDependencies";
|
|
44
|
+
};
|
|
45
|
+
readonly pnpmOverrides: {
|
|
46
|
+
readonly strategy: "versionsByName";
|
|
47
|
+
readonly path: "pnpm.overrides";
|
|
48
|
+
};
|
|
49
|
+
readonly prod: {
|
|
50
|
+
readonly strategy: "versionsByName";
|
|
51
|
+
readonly path: "dependencies";
|
|
52
|
+
};
|
|
53
|
+
readonly resolutions: {
|
|
54
|
+
readonly strategy: "versionsByName";
|
|
55
|
+
readonly path: "resolutions";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
27
58
|
export declare const DEFAULT_CONFIG: {
|
|
28
59
|
customTypes: {
|
|
29
|
-
dev: {
|
|
30
|
-
strategy: "versionsByName";
|
|
31
|
-
path:
|
|
60
|
+
readonly dev: {
|
|
61
|
+
readonly strategy: "versionsByName";
|
|
62
|
+
readonly path: "devDependencies";
|
|
32
63
|
};
|
|
33
|
-
local: {
|
|
34
|
-
strategy: "name~version";
|
|
35
|
-
namePath:
|
|
36
|
-
path:
|
|
64
|
+
readonly local: {
|
|
65
|
+
readonly strategy: "name~version";
|
|
66
|
+
readonly namePath: "name";
|
|
67
|
+
readonly path: "version";
|
|
37
68
|
};
|
|
38
|
-
overrides: {
|
|
39
|
-
strategy: "versionsByName";
|
|
40
|
-
path:
|
|
69
|
+
readonly overrides: {
|
|
70
|
+
readonly strategy: "versionsByName";
|
|
71
|
+
readonly path: "overrides";
|
|
41
72
|
};
|
|
42
|
-
peer: {
|
|
43
|
-
strategy: "versionsByName";
|
|
44
|
-
path:
|
|
73
|
+
readonly peer: {
|
|
74
|
+
readonly strategy: "versionsByName";
|
|
75
|
+
readonly path: "peerDependencies";
|
|
45
76
|
};
|
|
46
|
-
pnpmOverrides: {
|
|
47
|
-
strategy: "versionsByName";
|
|
48
|
-
path:
|
|
77
|
+
readonly pnpmOverrides: {
|
|
78
|
+
readonly strategy: "versionsByName";
|
|
79
|
+
readonly path: "pnpm.overrides";
|
|
49
80
|
};
|
|
50
|
-
prod: {
|
|
51
|
-
strategy: "versionsByName";
|
|
52
|
-
path:
|
|
81
|
+
readonly prod: {
|
|
82
|
+
readonly strategy: "versionsByName";
|
|
83
|
+
readonly path: "dependencies";
|
|
53
84
|
};
|
|
54
|
-
resolutions: {
|
|
55
|
-
strategy: "versionsByName";
|
|
56
|
-
path:
|
|
85
|
+
readonly resolutions: {
|
|
86
|
+
readonly strategy: "versionsByName";
|
|
87
|
+
readonly path: "resolutions";
|
|
57
88
|
};
|
|
58
89
|
};
|
|
59
|
-
dependencyTypes:
|
|
90
|
+
dependencyTypes: "**"[];
|
|
60
91
|
filter: string;
|
|
61
92
|
indent: string;
|
|
62
93
|
semverGroups: never[];
|
|
63
94
|
sortAz: string[];
|
|
64
95
|
sortFirst: string[];
|
|
65
96
|
source: string[];
|
|
97
|
+
specifierTypes: "**"[];
|
|
66
98
|
versionGroups: never[];
|
|
67
99
|
};
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
3
|
+
exports.DEFAULT_CONFIG = exports.CUSTOM_TYPES = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
4
4
|
/** Single source of truth, intended to aid testing or to override */
|
|
5
5
|
exports.CWD = process.env.MOCK_CWD || process.cwd();
|
|
6
6
|
/** Single source of truth for icons used in output */
|
|
@@ -35,38 +35,39 @@ exports.INTERNAL_TYPES = [
|
|
|
35
35
|
'prod',
|
|
36
36
|
'resolutions',
|
|
37
37
|
];
|
|
38
|
-
exports.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
path: 'pnpm.overrides',
|
|
60
|
-
},
|
|
61
|
-
prod: {
|
|
62
|
-
strategy: 'versionsByName',
|
|
63
|
-
path: 'dependencies',
|
|
64
|
-
},
|
|
65
|
-
resolutions: {
|
|
66
|
-
strategy: 'versionsByName',
|
|
67
|
-
path: 'resolutions',
|
|
68
|
-
},
|
|
38
|
+
exports.CUSTOM_TYPES = {
|
|
39
|
+
dev: {
|
|
40
|
+
strategy: 'versionsByName',
|
|
41
|
+
path: 'devDependencies',
|
|
42
|
+
},
|
|
43
|
+
local: {
|
|
44
|
+
strategy: 'name~version',
|
|
45
|
+
namePath: 'name',
|
|
46
|
+
path: 'version',
|
|
47
|
+
},
|
|
48
|
+
overrides: {
|
|
49
|
+
strategy: 'versionsByName',
|
|
50
|
+
path: 'overrides',
|
|
51
|
+
},
|
|
52
|
+
peer: {
|
|
53
|
+
strategy: 'versionsByName',
|
|
54
|
+
path: 'peerDependencies',
|
|
55
|
+
},
|
|
56
|
+
pnpmOverrides: {
|
|
57
|
+
strategy: 'versionsByName',
|
|
58
|
+
path: 'pnpm.overrides',
|
|
69
59
|
},
|
|
60
|
+
prod: {
|
|
61
|
+
strategy: 'versionsByName',
|
|
62
|
+
path: 'dependencies',
|
|
63
|
+
},
|
|
64
|
+
resolutions: {
|
|
65
|
+
strategy: 'versionsByName',
|
|
66
|
+
path: 'resolutions',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
exports.DEFAULT_CONFIG = {
|
|
70
|
+
customTypes: exports.CUSTOM_TYPES,
|
|
70
71
|
dependencyTypes: ['**'],
|
|
71
72
|
filter: '.',
|
|
72
73
|
indent: ' ',
|
|
@@ -82,5 +83,6 @@ exports.DEFAULT_CONFIG = {
|
|
|
82
83
|
],
|
|
83
84
|
sortFirst: ['name', 'description', 'version', 'author'],
|
|
84
85
|
source: ['package.json', 'packages/*/package.json'],
|
|
86
|
+
specifierTypes: ['**'],
|
|
85
87
|
versionGroups: [],
|
|
86
88
|
};
|
|
@@ -2,6 +2,7 @@ import type { Effect } from 'effect';
|
|
|
2
2
|
import type { Strategy } from '../config/get-custom-types';
|
|
3
3
|
import type { PackageJsonFile } from '../get-package-json-files/package-json-file';
|
|
4
4
|
import type { SemverGroup } from '../semver-group';
|
|
5
|
+
import { Specifier } from '../specifier';
|
|
5
6
|
import type { VersionGroup } from '../version-group';
|
|
6
7
|
import type { Delete } from '../version-group/lib/delete';
|
|
7
8
|
export declare class Instance {
|
|
@@ -10,7 +11,7 @@ export declare class Instance {
|
|
|
10
11
|
/** The .name property of the package.json file of this instance */
|
|
11
12
|
pkgName: string;
|
|
12
13
|
/** The specifier as it is on disk before being fixed */
|
|
13
|
-
rawSpecifier:
|
|
14
|
+
rawSpecifier: Specifier.Any;
|
|
14
15
|
/** The package this dependency is installed in this specific time */
|
|
15
16
|
packageJsonFile: PackageJsonFile;
|
|
16
17
|
/** Locates where in the file this dependency is installed */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Instance = void 0;
|
|
4
|
+
const specifier_1 = require("../specifier");
|
|
4
5
|
class Instance {
|
|
5
6
|
/** The name of this dependency */
|
|
6
7
|
name;
|
|
@@ -19,16 +20,16 @@ class Instance {
|
|
|
19
20
|
constructor(name, rawSpecifier, packageJsonFile, strategy) {
|
|
20
21
|
this.name = name;
|
|
21
22
|
this.pkgName = packageJsonFile.jsonFile.contents.name || 'PACKAGE_JSON_HAS_NO_NAME';
|
|
22
|
-
this.rawSpecifier = rawSpecifier;
|
|
23
23
|
this.packageJsonFile = packageJsonFile;
|
|
24
24
|
this.strategy = strategy;
|
|
25
25
|
this.semverGroup = null;
|
|
26
26
|
this.versionGroup = null;
|
|
27
|
+
this.rawSpecifier = specifier_1.Specifier.create(this, rawSpecifier);
|
|
27
28
|
}
|
|
28
29
|
/** Mutate the package.json file in memory with the latest version specifier */
|
|
29
30
|
write(rawSpecifier) {
|
|
30
|
-
this.rawSpecifier = rawSpecifier;
|
|
31
|
-
return this.strategy.write(this.packageJsonFile, [this.name, this.rawSpecifier]);
|
|
31
|
+
this.rawSpecifier = specifier_1.Specifier.create(this, rawSpecifier);
|
|
32
|
+
return this.strategy.write(this.packageJsonFile, [this.name, this.rawSpecifier.raw]);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
exports.Instance = Instance;
|
|
@@ -4,11 +4,12 @@ exports.canAddToGroup = void 0;
|
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
5
|
const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
|
|
6
6
|
function canAddToGroup(packageJsonFilesByName, group, instance) {
|
|
7
|
-
const { dependencies, dependencyTypes, packages } = group.config;
|
|
7
|
+
const { dependencies, dependencyTypes, packages, specifierTypes } = group.config;
|
|
8
8
|
return (group.canAdd(instance) &&
|
|
9
9
|
matchesDependencyTypes(dependencyTypes, instance) &&
|
|
10
10
|
matchesPackages(packages, instance) &&
|
|
11
|
-
matchesDependencies(packageJsonFilesByName, group, dependencies, instance)
|
|
11
|
+
matchesDependencies(packageJsonFilesByName, group, dependencies, instance) &&
|
|
12
|
+
matchesSpecifierTypes(specifierTypes, instance));
|
|
12
13
|
}
|
|
13
14
|
exports.canAddToGroup = canAddToGroup;
|
|
14
15
|
function matchesDependencies(packageJsonFilesByName, group, dependencies, instance) {
|
|
@@ -28,14 +29,20 @@ function matchesPackages(packages, instance) {
|
|
|
28
29
|
return packages.some((pattern) => (0, minimatch_1.minimatch)(instance.pkgName, pattern));
|
|
29
30
|
}
|
|
30
31
|
function matchesDependencyTypes(dependencyTypes, instance) {
|
|
32
|
+
return matchesKnownList(dependencyTypes, instance.strategy.name);
|
|
33
|
+
}
|
|
34
|
+
function matchesSpecifierTypes(specifierTypes, instance) {
|
|
35
|
+
return matchesKnownList(specifierTypes, instance.rawSpecifier.name);
|
|
36
|
+
}
|
|
37
|
+
function matchesKnownList(values, value) {
|
|
31
38
|
// matches if not defined
|
|
32
|
-
if (!(0, is_non_empty_array_1.isNonEmptyArray)(
|
|
39
|
+
if (!(0, is_non_empty_array_1.isNonEmptyArray)(values))
|
|
33
40
|
return true;
|
|
34
|
-
if (
|
|
41
|
+
if (values.join('') === '**')
|
|
35
42
|
return true;
|
|
36
43
|
const negative = [];
|
|
37
44
|
const positive = [];
|
|
38
|
-
|
|
45
|
+
values.forEach((name) => {
|
|
39
46
|
if (name.startsWith('!')) {
|
|
40
47
|
negative.push(name.replace('!', ''));
|
|
41
48
|
}
|
|
@@ -43,7 +50,7 @@ function matchesDependencyTypes(dependencyTypes, instance) {
|
|
|
43
50
|
positive.push(name);
|
|
44
51
|
}
|
|
45
52
|
});
|
|
46
|
-
if ((0, is_non_empty_array_1.isNonEmptyArray)(negative) && !negative.includes(
|
|
53
|
+
if ((0, is_non_empty_array_1.isNonEmptyArray)(negative) && !negative.includes(value))
|
|
47
54
|
return true;
|
|
48
|
-
return (0, is_non_empty_array_1.isNonEmptyArray)(positive) && positive.includes(
|
|
55
|
+
return (0, is_non_empty_array_1.isNonEmptyArray)(positive) && positive.includes(value);
|
|
49
56
|
}
|