syncpack 12.3.1 → 12.3.3
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-update/effects.js +1 -1
- package/dist/bin-update/update.js +14 -13
- package/package.json +3 -2
|
@@ -160,7 +160,7 @@ export const updateEffects = {
|
|
|
160
160
|
...doState.premajorAnswers,
|
|
161
161
|
...doState.majorAnswers,
|
|
162
162
|
...doState.prereleaseAnswers,
|
|
163
|
-
], Effect.forEach((
|
|
163
|
+
], Effect.forEach(({ instance, versions }) => pipe(instance.semverGroup.getFixed(Specifier.create(instance, versions.latest)), Effect.flatMap((latestWithRange) => instance.write(latestWithRange.raw)), Effect.catchTag('NonSemverError', Effect.logError))), Effect.flatMap(() => Effect.void))));
|
|
164
164
|
},
|
|
165
165
|
};
|
|
166
166
|
function promptForReleaseType(releaseType, doState) {
|
|
@@ -13,12 +13,13 @@ import { withLogger } from '../lib/with-logger.js';
|
|
|
13
13
|
import { Specifier } from '../specifier/index.js';
|
|
14
14
|
import { updateEffects } from './effects.js';
|
|
15
15
|
export function update(io, cli, effects = updateEffects, errorHandlers = defaultErrorHandlers) {
|
|
16
|
-
return pipe(Effect.Do, Effect.bind('ctx', () => getContext({ io, cli, errorHandlers })), Effect.bind('instances', ({ ctx }) => getInstances(ctx, io, errorHandlers)), Effect.bind('
|
|
16
|
+
return pipe(Effect.Do, Effect.bind('ctx', () => getContext({ io, cli, errorHandlers })), Effect.bind('instances', ({ ctx }) => getInstances(ctx, io, errorHandlers)), Effect.bind('update', ({ instances }) => pipe(Effect.succeed(instances.all), Effect.map((instances) => {
|
|
17
17
|
const isVisitedByName = {};
|
|
18
18
|
const updateable = [];
|
|
19
|
-
instances.
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
instances.forEach((instance) => {
|
|
20
|
+
if (!isVisitedByName[instance.name] &&
|
|
21
|
+
(instance.versionGroup._tag === 'SameRange' ||
|
|
22
|
+
instance.versionGroup._tag === 'Standard')) {
|
|
22
23
|
const specifier = Specifier.create(instance, instance.rawSpecifier.raw);
|
|
23
24
|
if (specifier._tag === 'Range' || specifier._tag === 'Exact') {
|
|
24
25
|
isVisitedByName[instance.name] = true;
|
|
@@ -26,15 +27,15 @@ export function update(io, cli, effects = updateEffects, errorHandlers = default
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
|
-
return
|
|
30
|
-
}), Effect.
|
|
31
|
-
onFailure: () =>
|
|
32
|
-
onSuccess: ({ versions }) =>
|
|
30
|
+
return updateable;
|
|
31
|
+
}), Effect.tap(updateEffects.onFetchAllStart), Effect.flatMap((instances) => pipe(instances, Effect.partition((instance) => pipe(Effect.succeed(instance), Effect.tap(() => updateEffects.onFetchStart(instance, instances.length)), Effect.flatMap(effects.fetchLatestVersions), Effect.tapBoth({
|
|
32
|
+
onFailure: () => updateEffects.onFetchEnd(instance),
|
|
33
|
+
onSuccess: ({ versions }) => updateEffects.onFetchEnd(instance, versions),
|
|
33
34
|
}),
|
|
34
35
|
// move up to date dependencies to error channel
|
|
35
36
|
Effect.flatMap((updateable) => gtr(updateable.versions.latest, String(instance.rawSpecifier.raw))
|
|
36
|
-
? pipe(
|
|
37
|
-
: pipe(
|
|
37
|
+
? pipe(updateEffects.onOutdated(instance, updateable.versions.latest), Effect.map(() => updateable))
|
|
38
|
+
: pipe(updateEffects.onUpToDate(instance), Effect.flatMap(() => Effect.fail(updateable)))),
|
|
38
39
|
// log error but don't catch it
|
|
39
40
|
Effect.tapErrorTag('HttpError', ({ error }) => Effect.logError(chalk `{red ${ICON.cross} ${error}}`)),
|
|
40
41
|
// log error but don't catch it
|
|
@@ -43,11 +44,11 @@ export function update(io, cli, effects = updateEffects, errorHandlers = default
|
|
|
43
44
|
Effect.flatMap(([_, outOfDate]) => Effect.succeed(outOfDate)))),
|
|
44
45
|
// always remove the spinner when we're done
|
|
45
46
|
Effect.tapBoth({
|
|
46
|
-
onFailure:
|
|
47
|
-
onSuccess:
|
|
47
|
+
onFailure: updateEffects.onFetchAllEnd,
|
|
48
|
+
onSuccess: updateEffects.onFetchAllEnd,
|
|
48
49
|
}),
|
|
49
50
|
// ask the user which updates they want
|
|
50
|
-
Effect.flatMap(
|
|
51
|
+
Effect.flatMap(updateEffects.promptForUpdates),
|
|
51
52
|
// if we think the user cancelled, say so
|
|
52
53
|
Effect.catchTag('PromptCancelled', () => Effect.logInfo(chalk `{red ${ICON.panic}} aborting after {blue syncpack update} was cancelled`)))), Effect.flatMap(({ ctx }) => pipe(writeIfChanged(ctx), Effect.catchTags({
|
|
53
54
|
WriteFileError: flow(errorHandlers.WriteFileError, Effect.map(() => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "syncpack",
|
|
3
3
|
"description": "Consistent dependency versions in large JavaScript Monorepos",
|
|
4
|
-
"version": "12.3.
|
|
4
|
+
"version": "12.3.3",
|
|
5
5
|
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)",
|
|
6
6
|
"bin": {
|
|
7
7
|
"syncpack": "dist/bin.js",
|
|
@@ -121,5 +121,6 @@
|
|
|
121
121
|
"release": "release-it",
|
|
122
122
|
"test": "vitest run --config vitest.config.ts"
|
|
123
123
|
},
|
|
124
|
-
"type": "module"
|
|
124
|
+
"type": "module",
|
|
125
|
+
"types": "./dist/index.d.ts"
|
|
125
126
|
}
|