syncpack 11.2.1 → 12.0.0-alpha.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.d.ts +15 -3
- package/dist/bin-fix-mismatches/fix-mismatches.js +119 -35
- package/dist/bin-fix-mismatches/index.js +12 -32
- package/dist/bin-format/format.d.ts +11 -3
- package/dist/bin-format/format.js +46 -61
- package/dist/bin-format/index.js +11 -31
- package/dist/bin-lint/index.js +8 -28
- package/dist/bin-lint/lint.d.ts +10 -3
- package/dist/bin-lint/lint.js +11 -35
- package/dist/bin-lint-semver-ranges/index.js +11 -39
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +15 -3
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +93 -34
- package/dist/bin-list/index.js +11 -31
- package/dist/bin-list/list.d.ts +11 -3
- package/dist/bin-list/list.js +120 -34
- package/dist/bin-list-mismatches/index.js +11 -31
- package/dist/bin-list-mismatches/list-mismatches.d.ts +18 -3
- package/dist/bin-list-mismatches/list-mismatches.js +253 -34
- package/dist/bin-prompt/index.js +15 -31
- package/dist/bin-prompt/prompt.d.ts +10 -3
- package/dist/bin-prompt/prompt.js +82 -33
- package/dist/bin-set-semver-ranges/index.js +12 -40
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +10 -3
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +49 -35
- package/dist/bin-update/effects.d.ts +45 -5
- package/dist/bin-update/effects.js +214 -128
- package/dist/bin-update/index.js +4 -27
- package/dist/bin-update/update.d.ts +5 -3
- package/dist/bin-update/update.js +51 -37
- package/dist/bin.js +0 -1
- package/dist/config/get-custom-types.d.ts +11 -1
- package/dist/config/get-custom-types.js +26 -21
- package/dist/config/get-enabled-types.d.ts +7 -8
- package/dist/config/get-enabled-types.js +63 -73
- package/dist/config/get-indent.js +1 -1
- package/dist/config/tag.d.ts +1 -1
- package/dist/config/tag.js +2 -25
- package/dist/config/types.d.ts +8 -9
- package/dist/constants.d.ts +4 -1
- package/dist/constants.js +4 -2
- package/dist/create-program/effects.d.ts +51 -29
- package/dist/error-handlers/default-error-handlers.d.ts +38 -2
- package/dist/error-handlers/default-error-handlers.js +80 -37
- package/dist/get-context/index.d.ts +12 -6
- package/dist/get-context/index.js +13 -30
- package/dist/get-context/lib/key-by.d.ts +6 -0
- package/dist/get-context/lib/key-by.js +16 -0
- package/dist/get-instances/index.d.ts +14 -0
- package/dist/get-instances/index.js +46 -0
- package/dist/get-instances/instance.d.ts +25 -0
- package/dist/get-instances/instance.js +20 -0
- package/dist/get-package-json-files/get-file-paths.d.ts +6 -7
- package/dist/get-package-json-files/get-file-paths.js +10 -33
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +3 -4
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +6 -32
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +3 -4
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +6 -32
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +3 -4
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +11 -40
- package/dist/get-package-json-files/get-patterns/index.d.ts +3 -5
- package/dist/get-package-json-files/get-patterns/index.js +6 -33
- package/dist/get-package-json-files/index.d.ts +6 -5
- package/dist/get-package-json-files/index.js +4 -28
- package/dist/get-package-json-files/package-json-file.d.ts +16 -16
- package/dist/get-package-json-files/package-json-file.js +13 -18
- package/dist/guards/can-add-to-group.d.ts +5 -4
- package/dist/guards/can-add-to-group.js +8 -4
- package/dist/guards/is-semver.d.ts +1 -1
- package/dist/guards/is-semver.js +1 -1
- package/dist/guards/is-valid-semver-range.d.ts +1 -1
- package/dist/guards/is-valid-semver-range.js +1 -1
- package/dist/io/ask-for-choice.d.ts +14 -0
- package/dist/io/ask-for-choice.js +22 -0
- package/dist/io/ask-for-input.d.ts +13 -0
- package/dist/io/ask-for-input.js +19 -0
- package/dist/io/exit-if-invalid.d.ts +4 -0
- package/dist/io/exit-if-invalid.js +13 -0
- package/dist/io/glob-sync.d.ts +11 -0
- package/dist/io/glob-sync.js +19 -0
- package/dist/io/index.d.ts +28 -0
- package/dist/{env/exit-if-invalid.js → io/index.js} +27 -9
- package/dist/io/read-config-file-sync.d.ts +7 -0
- package/dist/io/read-config-file-sync.js +26 -0
- package/dist/io/read-file-sync.d.ts +12 -0
- package/dist/io/read-file-sync.js +14 -0
- package/dist/io/read-json-file-sync.d.ts +30 -0
- package/dist/io/read-json-file-sync.js +25 -0
- package/dist/io/read-yaml-file-sync.d.ts +12 -0
- package/dist/io/read-yaml-file-sync.js +14 -0
- package/dist/io/write-file-sync.d.ts +12 -0
- package/dist/io/write-file-sync.js +15 -0
- package/dist/{env → io}/write-if-changed.d.ts +4 -4
- package/dist/io/write-if-changed.js +45 -0
- package/dist/lib/get-group-header.d.ts +10 -0
- package/dist/lib/get-group-header.js +31 -0
- package/dist/lib/get.d.ts +11 -0
- package/dist/lib/get.js +40 -0
- package/dist/lib/pad-start.d.ts +1 -0
- package/dist/lib/pad-start.js +7 -0
- package/dist/lib/ring-buffer.d.ts +10 -0
- package/dist/lib/ring-buffer.js +22 -0
- package/dist/lib/set-semver-range.d.ts +1 -1
- package/dist/lib/set-semver-range.js +7 -11
- package/dist/lib/with-logger.d.ts +2 -0
- package/dist/lib/with-logger.js +35 -0
- package/dist/option.d.ts +0 -1
- package/dist/option.js +0 -4
- package/dist/report.d.ts +166 -0
- package/dist/report.js +67 -0
- package/dist/schema.json +51 -20
- package/dist/semver-group/create-semver-groups.d.ts +4 -0
- package/dist/semver-group/create-semver-groups.js +77 -0
- package/dist/semver-group/disabled.d.ts +26 -0
- package/dist/semver-group/disabled.js +34 -0
- package/dist/semver-group/filtered-out.d.ts +27 -0
- package/dist/semver-group/filtered-out.js +40 -0
- package/dist/semver-group/ignored.d.ts +22 -0
- package/dist/semver-group/ignored.js +30 -0
- package/dist/semver-group/index.d.ts +22 -0
- package/dist/semver-group/index.js +10 -0
- package/dist/semver-group/with-range.d.ts +22 -0
- package/dist/semver-group/with-range.js +57 -0
- package/dist/specifier/alias.d.ts +15 -0
- package/dist/specifier/alias.js +25 -0
- package/dist/specifier/base.d.ts +39 -0
- package/dist/specifier/base.js +38 -0
- package/dist/specifier/delete.d.ts +15 -0
- package/dist/specifier/delete.js +16 -0
- package/dist/specifier/file.d.ts +6 -0
- package/dist/specifier/file.js +12 -0
- package/dist/specifier/hosted-git.d.ts +13 -0
- package/dist/specifier/hosted-git.js +27 -0
- package/dist/specifier/index.d.ts +27 -0
- package/dist/specifier/index.js +62 -0
- package/dist/specifier/lib/non-semver-error.d.ts +11 -0
- package/dist/specifier/lib/non-semver-error.js +10 -0
- package/dist/specifier/lib/parse-specifier.d.ts +14 -0
- package/dist/specifier/lib/parse-specifier.js +23 -0
- package/dist/specifier/lib/specific-registry-result.d.ts +9 -0
- package/dist/specifier/lib/specific-registry-result.js +2 -0
- package/dist/specifier/range.d.ts +18 -0
- package/dist/specifier/range.js +26 -0
- package/dist/specifier/tag.d.ts +9 -0
- package/dist/specifier/tag.js +15 -0
- package/dist/specifier/unsupported.d.ts +5 -0
- package/dist/specifier/unsupported.js +12 -0
- package/dist/specifier/url.d.ts +6 -0
- package/dist/specifier/url.js +13 -0
- package/dist/specifier/version.d.ts +18 -0
- package/dist/specifier/version.js +26 -0
- package/dist/specifier/workspace-protocol.d.ts +17 -0
- package/dist/specifier/workspace-protocol.js +38 -0
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
- package/dist/strategy/lib/get-non-empty-string-prop.js +4 -5
- package/dist/strategy/name-and-version-props.d.ts +4 -4
- package/dist/strategy/name-and-version-props.js +32 -21
- package/dist/strategy/named-version-string.d.ts +4 -4
- package/dist/strategy/named-version-string.js +22 -24
- package/dist/strategy/unnamed-version-string.d.ts +4 -4
- package/dist/strategy/unnamed-version-string.js +20 -21
- package/dist/strategy/versions-by-name.d.ts +4 -4
- package/dist/strategy/versions-by-name.js +9 -11
- package/dist/version-group/banned.d.ts +17 -0
- package/dist/version-group/banned.js +32 -0
- package/dist/version-group/create-version-groups.d.ts +4 -0
- package/dist/version-group/create-version-groups.js +107 -0
- package/dist/version-group/filtered-out.d.ts +19 -0
- package/dist/version-group/filtered-out.js +34 -0
- package/dist/version-group/ignored.d.ts +17 -0
- package/dist/version-group/ignored.js +27 -0
- package/dist/version-group/index.d.ts +28 -0
- package/dist/version-group/index.js +10 -0
- package/dist/version-group/lib/get-highest-version.d.ts +6 -0
- package/dist/version-group/lib/get-highest-version.js +12 -0
- package/dist/version-group/lib/get-lowest-version.d.ts +6 -0
- package/dist/version-group/lib/get-lowest-version.js +12 -0
- package/dist/version-group/lib/get-preferred-version.d.ts +5 -0
- package/dist/{get-version-groups/lib/compare-semver.js → version-group/lib/get-preferred-version.js} +14 -2
- package/dist/version-group/lib/group-by.d.ts +5 -0
- package/dist/{get-version-groups → version-group}/lib/group-by.js +4 -0
- package/dist/version-group/pinned.d.ts +17 -0
- package/dist/version-group/pinned.js +30 -0
- package/dist/version-group/same-range.d.ts +19 -0
- package/dist/version-group/same-range.js +108 -0
- package/dist/version-group/snapped-to.d.ts +17 -0
- package/dist/version-group/snapped-to.js +83 -0
- package/dist/version-group/standard.d.ts +18 -0
- package/dist/version-group/standard.js +131 -0
- package/package.json +24 -23
- package/dist/bin-fix-mismatches/effects.d.ts +0 -2
- package/dist/bin-fix-mismatches/effects.js +0 -112
- package/dist/bin-format/format-cli.d.ts +0 -4
- package/dist/bin-format/format-cli.js +0 -42
- package/dist/bin-lint-semver-ranges/effects.d.ts +0 -2
- package/dist/bin-lint-semver-ranges/effects.js +0 -70
- package/dist/bin-list/effects.d.ts +0 -2
- package/dist/bin-list/effects.js +0 -114
- package/dist/bin-list-mismatches/effects.d.ts +0 -2
- package/dist/bin-list-mismatches/effects.js +0 -136
- package/dist/bin-prompt/effects.d.ts +0 -2
- package/dist/bin-prompt/effects.js +0 -110
- package/dist/bin-set-semver-ranges/effects.d.ts +0 -2
- package/dist/bin-set-semver-ranges/effects.js +0 -61
- package/dist/config/get-semver-range.d.ts +0 -3
- package/dist/config/get-semver-range.js +0 -12
- package/dist/create-program/semver-ranges.d.ts +0 -7
- package/dist/create-program/semver-ranges.js +0 -55
- package/dist/create-program/versions.d.ts +0 -7
- package/dist/create-program/versions.js +0 -70
- package/dist/env/create-env.d.ts +0 -21
- package/dist/env/create-env.js +0 -81
- package/dist/env/default-env.d.ts +0 -18
- package/dist/env/default-env.js +0 -100
- package/dist/env/exit-if-invalid.d.ts +0 -4
- package/dist/env/tags.d.ts +0 -58
- package/dist/env/tags.js +0 -50
- package/dist/env/write-if-changed.js +0 -73
- package/dist/error-handlers/create-error-handlers.d.ts +0 -20
- package/dist/error-handlers/create-error-handlers.js +0 -60
- package/dist/get-package-json-files/get-patterns/read-json-safe.d.ts +0 -23
- package/dist/get-package-json-files/get-patterns/read-json-safe.js +0 -43
- package/dist/get-semver-groups/filtered-out.d.ts +0 -19
- package/dist/get-semver-groups/filtered-out.js +0 -55
- package/dist/get-semver-groups/ignored.d.ts +0 -17
- package/dist/get-semver-groups/ignored.js +0 -48
- package/dist/get-semver-groups/index.d.ts +0 -84
- package/dist/get-semver-groups/index.js +0 -139
- package/dist/get-semver-groups/with-range.d.ts +0 -18
- package/dist/get-semver-groups/with-range.js +0 -79
- package/dist/get-version-groups/banned.d.ts +0 -17
- package/dist/get-version-groups/banned.js +0 -50
- package/dist/get-version-groups/filtered-out.d.ts +0 -19
- package/dist/get-version-groups/filtered-out.js +0 -57
- package/dist/get-version-groups/ignored.d.ts +0 -17
- package/dist/get-version-groups/ignored.js +0 -50
- package/dist/get-version-groups/index.d.ts +0 -187
- package/dist/get-version-groups/index.js +0 -246
- package/dist/get-version-groups/lib/compare-semver.d.ts +0 -1
- package/dist/get-version-groups/lib/get-highest-version.d.ts +0 -2
- package/dist/get-version-groups/lib/get-highest-version.js +0 -13
- package/dist/get-version-groups/lib/get-lowest-version.d.ts +0 -2
- package/dist/get-version-groups/lib/get-lowest-version.js +0 -13
- package/dist/get-version-groups/lib/get-unique-specifiers.d.ts +0 -2
- package/dist/get-version-groups/lib/get-unique-specifiers.js +0 -11
- package/dist/get-version-groups/lib/group-by.d.ts +0 -1
- package/dist/get-version-groups/pinned.d.ts +0 -17
- package/dist/get-version-groups/pinned.js +0 -66
- package/dist/get-version-groups/same-range.d.ts +0 -17
- package/dist/get-version-groups/same-range.js +0 -73
- package/dist/get-version-groups/snapped-to.d.ts +0 -17
- package/dist/get-version-groups/snapped-to.js +0 -78
- package/dist/get-version-groups/standard.d.ts +0 -18
- package/dist/get-version-groups/standard.js +0 -109
- package/dist/guards/is-loose-semver.d.ts +0 -2
- package/dist/guards/is-loose-semver.js +0 -10
- package/dist/instance/create.d.ts +0 -4
- package/dist/instance/create.js +0 -142
- package/dist/instance/index.d.ts +0 -122
- package/dist/instance/index.js +0 -154
- package/dist/lib/$R.d.ts +0 -12
- package/dist/lib/$R.js +0 -34
- package/dist/lib/log-group-header.d.ts +0 -6
- package/dist/lib/log-group-header.js +0 -34
- package/dist/lib/log-verbose.d.ts +0 -1
- package/dist/lib/log-verbose.js +0 -24
- package/dist/lib/split-name-and-version.d.ts +0 -5
- package/dist/lib/split-name-and-version.js +0 -12
- /package/dist/{get-version-groups → version-group}/lib/clean.d.ts +0 -0
- /package/dist/{get-version-groups → version-group}/lib/clean.js +0 -0
- /package/dist/{get-version-groups → version-group}/lib/delete.d.ts +0 -0
- /package/dist/{get-version-groups → version-group}/lib/delete.js +0 -0
- /package/dist/{get-version-groups → version-group}/lib/get-range-score.d.ts +0 -0
- /package/dist/{get-version-groups → version-group}/lib/get-range-score.js +0 -0
|
@@ -1,42 +1,261 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.listMismatches = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
6
|
+
exports.logSameRangeMismatch = exports.logUnsupportedMismatch = exports.logMissingSnappedToMismatch = exports.logMissingLocalVersion = exports.pipeline = exports.listMismatches = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const effect_1 = require("effect");
|
|
9
|
+
const os_1 = require("os");
|
|
30
10
|
const tag_1 = require("../config/tag");
|
|
31
|
-
const
|
|
32
|
-
const create_env_1 = require("../env/create-env");
|
|
33
|
-
const exit_if_invalid_1 = require("../env/exit-if-invalid");
|
|
34
|
-
const tags_1 = require("../env/tags");
|
|
35
|
-
const create_error_handlers_1 = require("../error-handlers/create-error-handlers");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
36
12
|
const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
|
|
37
13
|
const get_context_1 = require("../get-context");
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
const get_instances_1 = require("../get-instances");
|
|
15
|
+
const io_1 = require("../io");
|
|
16
|
+
const exit_if_invalid_1 = require("../io/exit-if-invalid");
|
|
17
|
+
const get_group_header_1 = require("../lib/get-group-header");
|
|
18
|
+
const pad_start_1 = require("../lib/pad-start");
|
|
19
|
+
const with_logger_1 = require("../lib/with-logger");
|
|
20
|
+
function listMismatches({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
|
|
21
|
+
return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.flatMap((ctx) => pipeline(ctx, io, errorHandlers)), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
41
22
|
}
|
|
42
23
|
exports.listMismatches = listMismatches;
|
|
24
|
+
/** Exported to be reused by `syncpack lint` */
|
|
25
|
+
function pipeline(ctx, io, errorHandlers) {
|
|
26
|
+
return effect_1.Effect.gen(function* ($) {
|
|
27
|
+
const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
|
|
28
|
+
let index = 0;
|
|
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
|
+
}
|
|
38
|
+
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
|
+
for (const groupReport of yield* $(group.inspectAll())) {
|
|
46
|
+
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') {
|
|
77
|
+
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
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (validCount)
|
|
109
|
+
yield* $(logValidSize(validCount));
|
|
110
|
+
if (fixableCount)
|
|
111
|
+
yield* $(logFixableSize(fixableCount));
|
|
112
|
+
if (unfixableCount)
|
|
113
|
+
yield* $(logUnfixableSize(unfixableCount));
|
|
114
|
+
index++;
|
|
115
|
+
}
|
|
116
|
+
return ctx;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [${_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}} {gray.dim [missing local version]}`,
|
|
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}} {gray.dim [missing snapTo version]}`,
|
|
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}} {gray.dim [unsupported mismatch]}`,
|
|
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}} {gray.dim [same range mismatch]}`,
|
|
258
|
+
(0, chalk_1.default) ` {gray use {blue syncpack prompt} to fix this manually}`,
|
|
259
|
+
].join(os_1.EOL));
|
|
260
|
+
}
|
|
261
|
+
exports.logSameRangeMismatch = logSameRangeMismatch;
|
package/dist/bin-prompt/index.js
CHANGED
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
5
|
};
|
|
29
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const Effect = __importStar(require("@effect/io/Effect"));
|
|
31
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
32
8
|
const commander_1 = require("commander");
|
|
33
|
-
const
|
|
9
|
+
const effect_1 = require("effect");
|
|
10
|
+
const io_1 = require("../io");
|
|
34
11
|
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
35
12
|
const option_1 = require("../option");
|
|
36
13
|
const prompt_1 = require("./prompt");
|
|
@@ -50,6 +27,8 @@ commander_1.program.on('--help', () => {
|
|
|
50
27
|
syncpack prompt --types dev
|
|
51
28
|
{dim # only inspect "devDependencies" and "peerDependencies"}
|
|
52
29
|
syncpack prompt --types dev,peer
|
|
30
|
+
{dim # indent package.json with 4 spaces instead of 2}
|
|
31
|
+
syncpack prompt --indent {yellow " "}
|
|
53
32
|
|
|
54
33
|
Resolving Packages:
|
|
55
34
|
1. If {yellow --source} globs are provided, use those.
|
|
@@ -71,10 +50,15 @@ commander_1.program
|
|
|
71
50
|
.option(...option_1.option.filter)
|
|
72
51
|
.option(...option_1.option.config)
|
|
73
52
|
.option(...option_1.option.types)
|
|
53
|
+
.option(...option_1.option.indent)
|
|
74
54
|
.parse(process.argv);
|
|
75
|
-
Effect.runPromise((0, prompt_1.prompt)({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
effect_1.Effect.runPromise((0, prompt_1.prompt)({
|
|
56
|
+
io: io_1.io,
|
|
57
|
+
cli: {
|
|
58
|
+
configPath: commander_1.program.opts().config,
|
|
59
|
+
filter: commander_1.program.opts().filter,
|
|
60
|
+
source: commander_1.program.opts().source,
|
|
61
|
+
types: commander_1.program.opts().types,
|
|
62
|
+
indent: commander_1.program.opts().indent,
|
|
63
|
+
},
|
|
64
|
+
}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
2
|
import { type CliConfig } from '../config/types';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
4
|
+
import type { Io } from '../io';
|
|
5
|
+
interface Input {
|
|
6
|
+
io: Io;
|
|
7
|
+
cli: Partial<CliConfig>;
|
|
8
|
+
errorHandlers?: ErrorHandlers;
|
|
9
|
+
}
|
|
10
|
+
export declare function prompt({ io, cli, errorHandlers }: Input): Effect.Effect<never, never, unknown>;
|
|
11
|
+
export {};
|
|
@@ -1,42 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.prompt = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const effect_1 = require("effect");
|
|
9
|
+
const uniq_1 = require("tightrope/array/uniq");
|
|
10
|
+
const is_string_1 = require("tightrope/guard/is-string");
|
|
11
|
+
const list_1 = require("../bin-list/list");
|
|
30
12
|
const tag_1 = require("../config/tag");
|
|
31
|
-
const
|
|
32
|
-
const create_env_1 = require("../env/create-env");
|
|
33
|
-
const tags_1 = require("../env/tags");
|
|
34
|
-
const write_if_changed_1 = require("../env/write-if-changed");
|
|
35
|
-
const create_error_handlers_1 = require("../error-handlers/create-error-handlers");
|
|
13
|
+
const constants_1 = require("../constants");
|
|
36
14
|
const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
|
|
37
15
|
const get_context_1 = require("../get-context");
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
16
|
+
const get_instances_1 = require("../get-instances");
|
|
17
|
+
const io_1 = require("../io");
|
|
18
|
+
const ask_for_choice_1 = require("../io/ask-for-choice");
|
|
19
|
+
const ask_for_input_1 = require("../io/ask-for-input");
|
|
20
|
+
const exit_if_invalid_1 = require("../io/exit-if-invalid");
|
|
21
|
+
const write_if_changed_1 = require("../io/write-if-changed");
|
|
22
|
+
const get_group_header_1 = require("../lib/get-group-header");
|
|
23
|
+
const with_logger_1 = require("../lib/with-logger");
|
|
24
|
+
function prompt({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
|
|
25
|
+
return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)(effect_1.Effect.gen(function* ($) {
|
|
26
|
+
const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
|
|
27
|
+
let unfixableCount = 0;
|
|
28
|
+
let index = 0;
|
|
29
|
+
for (const group of versionGroups) {
|
|
30
|
+
const unfixable = [];
|
|
31
|
+
for (const groupReport of yield* $(group.inspectAll())) {
|
|
32
|
+
for (const report of groupReport.reports) {
|
|
33
|
+
if (isUnfixable(report)) {
|
|
34
|
+
unfixable.push(report);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (unfixable.length) {
|
|
38
|
+
unfixableCount += unfixable.length;
|
|
39
|
+
effect_1.Effect.logInfo((0, get_group_header_1.getVersionGroupHeader)({ group, index }));
|
|
40
|
+
yield* $(askForNextVersion(groupReport, unfixable));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
index++;
|
|
44
|
+
}
|
|
45
|
+
if (unfixableCount) {
|
|
46
|
+
yield* $((0, write_if_changed_1.writeIfChanged)(ctx));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const msg = (0, chalk_1.default) `{green ${constants_1.ICON.tick}} no issues which syncpack cannot fix automatically`;
|
|
50
|
+
yield* $(effect_1.Effect.logInfo(msg));
|
|
51
|
+
yield* $((0, list_1.logOtherCommands)());
|
|
52
|
+
}
|
|
53
|
+
return ctx;
|
|
54
|
+
}), effect_1.Effect.catchTags((0, default_error_handlers_1.chainErrorHandlers)(ctx, errorHandlers)), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid))), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
|
|
41
55
|
}
|
|
42
56
|
exports.prompt = prompt;
|
|
57
|
+
function isUnfixable(report) {
|
|
58
|
+
return (report._tag === 'MissingLocalVersion' ||
|
|
59
|
+
report._tag === 'MissingSnappedToMismatch' ||
|
|
60
|
+
report._tag === 'SameRangeMismatch' ||
|
|
61
|
+
report._tag === 'UnsupportedMismatch');
|
|
62
|
+
}
|
|
63
|
+
function askForNextVersion(groupReport, unfixable) {
|
|
64
|
+
return (0, effect_1.pipe)(effect_1.Effect.gen(function* ($) {
|
|
65
|
+
const choices = (0, uniq_1.uniq)(groupReport.reports.map((instanceReport) => instanceReport.specifier?.raw ||
|
|
66
|
+
instanceReport.fixable?.raw ||
|
|
67
|
+
instanceReport.unfixable?.rawSpecifier)).filter(is_string_1.isString);
|
|
68
|
+
const OTHER = chalk_1.default.dim('Other');
|
|
69
|
+
const SKIP = chalk_1.default.dim('Skip');
|
|
70
|
+
const QUIT = chalk_1.default.dim('Quit');
|
|
71
|
+
// Ask user to choose a version to align on
|
|
72
|
+
const choice = yield* $((0, ask_for_choice_1.askForChoice)({
|
|
73
|
+
message: groupReport.name,
|
|
74
|
+
choices: [...choices, OTHER, SKIP, QUIT],
|
|
75
|
+
}));
|
|
76
|
+
if (choice === SKIP)
|
|
77
|
+
return;
|
|
78
|
+
// @TODO: Learn https://www.effect.website/docs/data-types/exit
|
|
79
|
+
if (choice === QUIT)
|
|
80
|
+
return process.exit(0);
|
|
81
|
+
const nextVersion = choice === OTHER
|
|
82
|
+
? yield* $((0, ask_for_input_1.askForInput)({
|
|
83
|
+
message: (0, chalk_1.default) `${groupReport.name} {dim Enter a replacement version}`,
|
|
84
|
+
}))
|
|
85
|
+
: choice;
|
|
86
|
+
yield* $((0, effect_1.pipe)(unfixable, effect_1.Effect.forEach((report) => report.unfixable.write(nextVersion))));
|
|
87
|
+
}), effect_1.Effect.catchTags({
|
|
88
|
+
AskForChoiceError: effect_1.Effect.logDebug,
|
|
89
|
+
AskForInputError: effect_1.Effect.logDebug,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
5
|
};
|
|
29
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const Effect = __importStar(require("@effect/io/Effect"));
|
|
31
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
32
8
|
const commander_1 = require("commander");
|
|
33
|
-
const
|
|
9
|
+
const effect_1 = require("effect");
|
|
10
|
+
const io_1 = require("../io");
|
|
34
11
|
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
35
12
|
const option_1 = require("../option");
|
|
36
13
|
const set_semver_ranges_1 = require("./set-semver-ranges");
|
|
@@ -48,12 +25,6 @@ Examples:
|
|
|
48
25
|
syncpack set-semver-ranges --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
49
26
|
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
50
27
|
syncpack set-semver-ranges --filter {yellow "typescript|tslint"}
|
|
51
|
-
{dim # use ~ range instead of default ""}
|
|
52
|
-
syncpack set-semver-ranges --semver-range ~
|
|
53
|
-
{dim # set ~ range in "devDependencies"}
|
|
54
|
-
syncpack set-semver-ranges --types dev --semver-range ~
|
|
55
|
-
{dim # set ~ range in "devDependencies" and "peerDependencies"}
|
|
56
|
-
syncpack set-semver-ranges --types dev,peer --semver-range ~
|
|
57
28
|
{dim # indent package.json with 4 spaces instead of 2}
|
|
58
29
|
syncpack set-semver-ranges --indent {yellow " "}
|
|
59
30
|
|
|
@@ -86,15 +57,16 @@ commander_1.program
|
|
|
86
57
|
.option(...option_1.option.source)
|
|
87
58
|
.option(...option_1.option.filter)
|
|
88
59
|
.option(...option_1.option.config)
|
|
89
|
-
.option(...option_1.option.semverRange)
|
|
90
60
|
.option(...option_1.option.types)
|
|
91
61
|
.option(...option_1.option.indent)
|
|
92
62
|
.parse(process.argv);
|
|
93
|
-
Effect.runSync((0, set_semver_ranges_1.setSemverRanges)({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
63
|
+
effect_1.Effect.runSync((0, set_semver_ranges_1.setSemverRanges)({
|
|
64
|
+
io: io_1.io,
|
|
65
|
+
cli: {
|
|
66
|
+
configPath: commander_1.program.opts().config,
|
|
67
|
+
filter: commander_1.program.opts().filter,
|
|
68
|
+
indent: commander_1.program.opts().indent,
|
|
69
|
+
source: commander_1.program.opts().source,
|
|
70
|
+
types: commander_1.program.opts().types,
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
2
|
import { type CliConfig } from '../config/types';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
4
|
+
import type { Io } from '../io';
|
|
5
|
+
interface Input {
|
|
6
|
+
io: Io;
|
|
7
|
+
cli: Partial<CliConfig>;
|
|
8
|
+
errorHandlers?: ErrorHandlers;
|
|
9
|
+
}
|
|
10
|
+
export declare function setSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<never, never, unknown>;
|
|
11
|
+
export {};
|