syncpack 12.3.0 → 12.3.2
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 +9 -9
- package/dist/bin-fix-mismatches/fix-mismatches.js +43 -54
- package/dist/bin-fix-mismatches/index.js +26 -31
- package/dist/bin-format/format.d.ts +6 -6
- package/dist/bin-format/format.js +27 -32
- package/dist/bin-format/index.js +20 -25
- package/dist/bin-lint/index.js +15 -20
- package/dist/bin-lint/lint.d.ts +4 -4
- package/dist/bin-lint/lint.js +28 -35
- package/dist/bin-lint-semver-ranges/index.js +24 -29
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +8 -8
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +34 -44
- package/dist/bin-list/index.js +24 -29
- package/dist/bin-list/list.d.ts +7 -7
- package/dist/bin-list/list.js +55 -64
- package/dist/bin-list-mismatches/index.js +24 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +10 -10
- package/dist/bin-list-mismatches/list-mismatches.js +62 -70
- package/dist/bin-prompt/index.js +26 -31
- package/dist/bin-prompt/prompt.d.ts +4 -4
- package/dist/bin-prompt/prompt.js +41 -48
- package/dist/bin-set-semver-ranges/index.js +26 -31
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +26 -30
- package/dist/bin-update/effects.d.ts +18 -18
- package/dist/bin-update/effects.js +77 -106
- package/dist/bin-update/index.js +23 -28
- package/dist/bin-update/update.d.ts +5 -5
- package/dist/bin-update/update.js +33 -40
- package/dist/bin.js +8 -5
- package/dist/config/get-custom-types.d.ts +9 -9
- package/dist/config/get-custom-types.js +22 -27
- package/dist/config/get-enabled-types.d.ts +8 -8
- package/dist/config/get-enabled-types.js +42 -48
- package/dist/config/get-filter.d.ts +1 -1
- package/dist/config/get-filter.js +6 -10
- package/dist/config/get-indent.d.ts +1 -1
- package/dist/config/get-indent.js +6 -10
- package/dist/config/get-sort-az.d.ts +1 -1
- package/dist/config/get-sort-az.js +6 -10
- package/dist/config/get-sort-exports.d.ts +1 -1
- package/dist/config/get-sort-exports.js +6 -10
- package/dist/config/get-sort-first.d.ts +1 -1
- package/dist/config/get-sort-first.js +6 -10
- package/dist/config/get-source.d.ts +1 -1
- package/dist/config/get-source.js +4 -8
- package/dist/config/tag.d.ts +1 -1
- package/dist/config/tag.js +2 -5
- package/dist/config/types.d.ts +2 -5
- package/dist/config/types.js +1 -2
- package/dist/constants.js +7 -10
- package/dist/error-handlers/default-error-handlers.d.ts +10 -10
- package/dist/error-handlers/default-error-handlers.js +55 -61
- package/dist/get-context/index.d.ts +5 -5
- package/dist/get-context/index.js +13 -17
- package/dist/get-context/lib/key-by.js +1 -5
- package/dist/get-instances/index.d.ts +7 -7
- package/dist/get-instances/index.js +19 -23
- package/dist/get-instances/instance.d.ts +7 -7
- package/dist/get-instances/instance.js +4 -8
- package/dist/get-package-json-files/get-file-paths.d.ts +7 -7
- package/dist/get-package-json-files/get-file-paths.js +10 -15
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +14 -18
- package/dist/get-package-json-files/get-patterns/index.d.ts +3 -3
- package/dist/get-package-json-files/get-patterns/index.js +11 -15
- package/dist/get-package-json-files/index.d.ts +8 -8
- package/dist/get-package-json-files/index.js +6 -10
- package/dist/get-package-json-files/package-json-file.d.ts +6 -6
- package/dist/get-package-json-files/package-json-file.js +8 -12
- package/dist/guards/can-add-to-group.d.ts +4 -4
- package/dist/guards/can-add-to-group.js +10 -14
- package/dist/guards/is-semver.js +3 -7
- package/dist/guards/is-valid-semver-range.d.ts +1 -1
- package/dist/guards/is-valid-semver-range.js +12 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/io/ask-for-choice.d.ts +5 -5
- package/dist/io/ask-for-choice.js +5 -9
- package/dist/io/ask-for-input.d.ts +5 -5
- package/dist/io/ask-for-input.js +5 -9
- package/dist/io/exit-if-invalid.d.ts +3 -3
- package/dist/io/exit-if-invalid.js +5 -9
- package/dist/io/glob-sync.d.ts +5 -5
- package/dist/io/glob-sync.js +4 -9
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +12 -38
- package/dist/io/read-config-file.d.ts +7 -0
- package/dist/io/read-config-file.js +22 -0
- package/dist/io/read-file-sync.d.ts +5 -5
- package/dist/io/read-file-sync.js +4 -9
- package/dist/io/read-json-file-sync.d.ts +8 -8
- package/dist/io/read-json-file-sync.js +10 -16
- package/dist/io/read-yaml-file-sync.d.ts +5 -5
- package/dist/io/read-yaml-file-sync.js +4 -8
- package/dist/io/to-json.d.ts +2 -2
- package/dist/io/to-json.js +8 -12
- package/dist/io/write-file-sync.d.ts +5 -5
- package/dist/io/write-file-sync.js +5 -10
- package/dist/io/write-if-changed.d.ts +4 -4
- package/dist/io/write-if-changed.js +9 -16
- package/dist/lib/format-repository-url.js +1 -5
- package/dist/lib/get-group-header.d.ts +2 -2
- package/dist/lib/get-group-header.js +4 -12
- package/dist/lib/get.d.ts +10 -10
- package/dist/lib/get.js +15 -19
- package/dist/lib/pad-start.js +1 -5
- package/dist/lib/ring-buffer.js +1 -5
- package/dist/lib/set-semver-range.d.ts +1 -1
- package/dist/lib/set-semver-range.js +8 -12
- package/dist/lib/show-help-on-error.js +3 -10
- package/dist/lib/sort-by-name.js +1 -5
- package/dist/lib/with-logger.d.ts +1 -1
- package/dist/lib/with-logger.js +17 -24
- package/dist/option.d.ts +1 -1
- package/dist/option.js +8 -14
- package/dist/report.d.ts +2 -2
- package/dist/report.js +2 -5
- package/dist/semver-group/create-semver-groups.d.ts +3 -3
- package/dist/semver-group/create-semver-groups.js +28 -32
- package/dist/semver-group/disabled.d.ts +11 -11
- package/dist/semver-group/disabled.js +6 -10
- package/dist/semver-group/filtered-out.d.ts +12 -12
- package/dist/semver-group/filtered-out.js +8 -12
- package/dist/semver-group/ignored.d.ts +11 -11
- package/dist/semver-group/ignored.js +6 -10
- package/dist/semver-group/index.d.ts +6 -7
- package/dist/semver-group/index.js +4 -7
- package/dist/semver-group/with-range.d.ts +11 -11
- package/dist/semver-group/with-range.js +13 -17
- package/dist/specifier/alias.d.ts +5 -5
- package/dist/specifier/alias.js +9 -13
- package/dist/specifier/base.d.ts +7 -7
- package/dist/specifier/base.js +9 -13
- package/dist/specifier/delete.d.ts +5 -5
- package/dist/specifier/delete.js +5 -9
- package/dist/specifier/exact.d.ts +6 -6
- package/dist/specifier/exact.js +7 -11
- package/dist/specifier/file.d.ts +1 -1
- package/dist/specifier/file.js +2 -6
- package/dist/specifier/hosted-git.d.ts +5 -5
- package/dist/specifier/hosted-git.js +9 -13
- package/dist/specifier/index.d.ts +13 -13
- package/dist/specifier/index.js +28 -31
- package/dist/specifier/latest.d.ts +6 -6
- package/dist/specifier/latest.js +7 -11
- package/dist/specifier/lib/non-semver-error.d.ts +5 -5
- package/dist/specifier/lib/non-semver-error.js +3 -7
- package/dist/specifier/lib/parse-specifier.d.ts +1 -1
- package/dist/specifier/lib/parse-specifier.js +4 -11
- package/dist/specifier/lib/specific-registry-result.js +1 -2
- package/dist/specifier/range.d.ts +6 -6
- package/dist/specifier/range.js +7 -11
- package/dist/specifier/tag.d.ts +2 -2
- package/dist/specifier/tag.js +2 -6
- package/dist/specifier/unsupported.d.ts +1 -1
- package/dist/specifier/unsupported.js +2 -6
- package/dist/specifier/url.d.ts +1 -1
- package/dist/specifier/url.js +2 -6
- package/dist/specifier/workspace-protocol.d.ts +7 -7
- package/dist/specifier/workspace-protocol.js +9 -13
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
- package/dist/strategy/lib/get-non-empty-string-prop.js +6 -10
- package/dist/strategy/name-and-version-props.d.ts +4 -4
- package/dist/strategy/name-and-version-props.js +19 -23
- package/dist/strategy/named-version-string.d.ts +4 -4
- package/dist/strategy/named-version-string.js +20 -24
- package/dist/strategy/unnamed-version-string.d.ts +4 -4
- package/dist/strategy/unnamed-version-string.js +17 -21
- package/dist/strategy/versions-by-name.d.ts +4 -4
- package/dist/strategy/versions-by-name.js +11 -15
- package/dist/version-group/banned.d.ts +7 -7
- package/dist/version-group/banned.js +8 -12
- package/dist/version-group/create-version-groups.d.ts +3 -3
- package/dist/version-group/create-version-groups.js +34 -38
- package/dist/version-group/filtered-out.d.ts +8 -8
- package/dist/version-group/filtered-out.js +8 -12
- package/dist/version-group/ignored.d.ts +7 -7
- package/dist/version-group/ignored.js +6 -10
- package/dist/version-group/index.d.ts +9 -10
- package/dist/version-group/index.js +4 -7
- package/dist/version-group/lib/clean.js +4 -11
- package/dist/version-group/lib/delete.js +1 -4
- package/dist/version-group/lib/get-highest-version.d.ts +2 -2
- package/dist/version-group/lib/get-highest-version.js +3 -7
- package/dist/version-group/lib/get-lowest-version.d.ts +2 -2
- package/dist/version-group/lib/get-lowest-version.js +3 -7
- package/dist/version-group/lib/get-preferred-version.d.ts +4 -4
- package/dist/version-group/lib/get-preferred-version.js +17 -24
- package/dist/version-group/lib/get-range-score.js +13 -17
- package/dist/version-group/lib/group-by.js +1 -5
- package/dist/version-group/pinned.d.ts +7 -7
- package/dist/version-group/pinned.js +8 -12
- package/dist/version-group/same-range.d.ts +8 -8
- package/dist/version-group/same-range.js +23 -30
- package/dist/version-group/snapped-to.d.ts +7 -7
- package/dist/version-group/snapped-to.js +20 -24
- package/dist/version-group/standard.d.ts +7 -7
- package/dist/version-group/standard.js +29 -33
- package/package.json +30 -37
- package/dist/io/read-config-file-sync.d.ts +0 -7
- package/dist/io/read-config-file-sync.js +0 -26
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const io_1 = require("../io");
|
|
11
|
-
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
12
|
-
const option_1 = require("../option");
|
|
13
|
-
const lint_semver_ranges_1 = require("./lint-semver-ranges");
|
|
14
|
-
commander_1.program.description((0, chalk_1.default) `
|
|
2
|
+
import chalk from 'chalk-template';
|
|
3
|
+
import { program } from 'commander';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
import { io } from '../io/index.js';
|
|
6
|
+
import { showHelpOnError } from '../lib/show-help-on-error.js';
|
|
7
|
+
import { option } from '../option.js';
|
|
8
|
+
import { lintSemverRanges } from './lint-semver-ranges.js';
|
|
9
|
+
program.description(chalk `
|
|
15
10
|
Check dependency versions within {yellow dependencies}, {yellow devDependencies},
|
|
16
11
|
{yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format.`.replace(/^\n/, ''));
|
|
17
|
-
|
|
18
|
-
console.log(
|
|
12
|
+
program.on('--help', () => {
|
|
13
|
+
console.log(chalk `
|
|
19
14
|
Examples:
|
|
20
15
|
{dim # uses defaults for resolving packages}
|
|
21
16
|
syncpack lint-semver-ranges
|
|
@@ -50,21 +45,21 @@ Reference:
|
|
|
50
45
|
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
51
46
|
`);
|
|
52
47
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.option(...
|
|
56
|
-
.option(...
|
|
57
|
-
.option(...
|
|
58
|
-
.option(...
|
|
59
|
-
.option(...
|
|
48
|
+
showHelpOnError(program);
|
|
49
|
+
program
|
|
50
|
+
.option(...option.source)
|
|
51
|
+
.option(...option.filter)
|
|
52
|
+
.option(...option.config)
|
|
53
|
+
.option(...option.specs)
|
|
54
|
+
.option(...option.types)
|
|
60
55
|
.parse(process.argv);
|
|
61
|
-
|
|
62
|
-
io
|
|
56
|
+
Effect.runPromise(lintSemverRanges({
|
|
57
|
+
io,
|
|
63
58
|
cli: {
|
|
64
|
-
configPath:
|
|
65
|
-
filter:
|
|
66
|
-
source:
|
|
67
|
-
specs:
|
|
68
|
-
types:
|
|
59
|
+
configPath: program.opts().config,
|
|
60
|
+
filter: program.opts().filter,
|
|
61
|
+
source: program.opts().source,
|
|
62
|
+
specs: program.opts().specs,
|
|
63
|
+
types: program.opts().types,
|
|
69
64
|
},
|
|
70
65
|
}));
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import { type CliConfig } from '../config/types';
|
|
3
|
-
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
4
|
-
import type { Ctx } from '../get-context';
|
|
5
|
-
import type { Io } from '../io';
|
|
2
|
+
import { type CliConfig } from '../config/types.js';
|
|
3
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
4
|
+
import type { Ctx } from '../get-context/index.js';
|
|
5
|
+
import type { Io } from '../io/index.js';
|
|
6
6
|
interface Input {
|
|
7
7
|
io: Io;
|
|
8
8
|
cli: Partial<CliConfig>;
|
|
9
9
|
errorHandlers?: ErrorHandlers;
|
|
10
10
|
}
|
|
11
|
-
export declare function lintSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<
|
|
11
|
+
export declare function lintSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
|
|
12
12
|
/** Exported to be reused by `syncpack lint` */
|
|
13
|
-
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<
|
|
14
|
-
export declare function logSemverGroupsDisabledWarning(): Effect.Effect<
|
|
15
|
-
export declare function logIgnoredSize(amount: number): Effect.Effect<
|
|
13
|
+
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<Ctx>;
|
|
14
|
+
export declare function logSemverGroupsDisabledWarning(): Effect.Effect<void, never, never>;
|
|
15
|
+
export declare function logIgnoredSize(amount: number): Effect.Effect<void, never, never>;
|
|
16
16
|
export {};
|
|
@@ -1,46 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const exit_if_invalid_1 = require("../io/exit-if-invalid");
|
|
18
|
-
const get_group_header_1 = require("../lib/get-group-header");
|
|
19
|
-
const pad_start_1 = require("../lib/pad-start");
|
|
20
|
-
const with_logger_1 = require("../lib/with-logger");
|
|
21
|
-
function lintSemverRanges({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
|
|
22
|
-
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);
|
|
1
|
+
import chalk from 'chalk-template';
|
|
2
|
+
import { Context, Effect, pipe } from 'effect';
|
|
3
|
+
import { EOL } from 'os';
|
|
4
|
+
import { isNonEmptyArray } from 'tightrope/guard/is-non-empty-array.js';
|
|
5
|
+
import { CliConfigTag } from '../config/tag.js';
|
|
6
|
+
import { ICON } from '../constants.js';
|
|
7
|
+
import { defaultErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
8
|
+
import { getContext } from '../get-context/index.js';
|
|
9
|
+
import { getInstances } from '../get-instances/index.js';
|
|
10
|
+
import { exitIfInvalid } from '../io/exit-if-invalid.js';
|
|
11
|
+
import { IoTag } from '../io/index.js';
|
|
12
|
+
import { getSemverGroupHeader } from '../lib/get-group-header.js';
|
|
13
|
+
import { padStart } from '../lib/pad-start.js';
|
|
14
|
+
import { withLogger } from '../lib/with-logger.js';
|
|
15
|
+
export function lintSemverRanges({ io, cli, errorHandlers = defaultErrorHandlers }) {
|
|
16
|
+
return pipe(getContext({ io, cli, errorHandlers }), Effect.flatMap((ctx) => pipeline(ctx, io, errorHandlers)), Effect.flatMap(exitIfInvalid), Effect.provide(pipe(Context.empty(), Context.add(CliConfigTag, cli), Context.add(IoTag, io))), withLogger);
|
|
23
17
|
}
|
|
24
|
-
exports.lintSemverRanges = lintSemverRanges;
|
|
25
18
|
/** Exported to be reused by `syncpack lint` */
|
|
26
|
-
function pipeline(ctx, io, errorHandlers) {
|
|
27
|
-
return
|
|
19
|
+
export function pipeline(ctx, io, errorHandlers) {
|
|
20
|
+
return Effect.gen(function* ($) {
|
|
28
21
|
// no semver groups have been configured, they are disabled by default
|
|
29
|
-
if (!
|
|
22
|
+
if (!isNonEmptyArray(ctx.config.rcFile.semverGroups)) {
|
|
30
23
|
yield* $(logSemverGroupsDisabledWarning());
|
|
31
24
|
return ctx;
|
|
32
25
|
}
|
|
33
|
-
const { semverGroups } = yield* $(
|
|
26
|
+
const { semverGroups } = yield* $(getInstances(ctx, io, errorHandlers));
|
|
34
27
|
let index = 0;
|
|
35
28
|
for (const group of semverGroups) {
|
|
36
29
|
const groupSize = group.instances.length;
|
|
37
30
|
let validCount = 0;
|
|
38
31
|
if (group._tag === 'Ignored') {
|
|
39
|
-
yield* $(
|
|
32
|
+
yield* $(Effect.logInfo(getSemverGroupHeader({ group, index })));
|
|
40
33
|
yield* $(logIgnoredSize(groupSize));
|
|
41
34
|
}
|
|
42
35
|
else if (group._tag === 'WithRange') {
|
|
43
|
-
yield* $(
|
|
36
|
+
yield* $(Effect.logInfo(getSemverGroupHeader({ group, index })));
|
|
44
37
|
for (const instance of group.instances) {
|
|
45
38
|
const report = yield* $(group.inspect(instance));
|
|
46
39
|
if (report._tag === 'Valid') {
|
|
@@ -63,22 +56,19 @@ function pipeline(ctx, io, errorHandlers) {
|
|
|
63
56
|
return ctx;
|
|
64
57
|
});
|
|
65
58
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
].join(os_1.EOL));
|
|
59
|
+
export function logSemverGroupsDisabledWarning() {
|
|
60
|
+
return Effect.logInfo([
|
|
61
|
+
chalk `{red ${ICON.panic} it looks like semver ranges have not yet been configured for this project}`,
|
|
62
|
+
chalk ` {red see the guide at} {yellow https://jamiemason.github.io/syncpack/guide/semver-groups}`,
|
|
63
|
+
].join(EOL));
|
|
72
64
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return effect_1.Effect.logInfo(msg);
|
|
65
|
+
export function logIgnoredSize(amount) {
|
|
66
|
+
const msg = chalk `${padStart(amount)} {dim ${ICON.skip}} ${amount} ignored`;
|
|
67
|
+
return Effect.logInfo(msg);
|
|
77
68
|
}
|
|
78
|
-
exports.logIgnoredSize = logIgnoredSize;
|
|
79
69
|
function logValidSize(amount) {
|
|
80
|
-
const msg =
|
|
81
|
-
return
|
|
70
|
+
const msg = chalk `{green ${ICON.tick}} {dim ${amount} valid}`;
|
|
71
|
+
return Effect.logInfo(msg);
|
|
82
72
|
}
|
|
83
73
|
function logSemverRangeMismatch(report) {
|
|
84
74
|
const _tag = report._tag;
|
|
@@ -88,7 +78,7 @@ function logSemverRangeMismatch(report) {
|
|
|
88
78
|
const expected = report.fixable.raw;
|
|
89
79
|
const propPath = instance.strategy.path;
|
|
90
80
|
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
91
|
-
return
|
|
81
|
+
return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
|
|
92
82
|
}
|
|
93
83
|
function logUnsupportedMismatch(report) {
|
|
94
84
|
const _tag = report._tag;
|
|
@@ -97,5 +87,5 @@ function logUnsupportedMismatch(report) {
|
|
|
97
87
|
const actual = instance.rawSpecifier.raw;
|
|
98
88
|
const propPath = instance.strategy.path;
|
|
99
89
|
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
100
|
-
return
|
|
90
|
+
return Effect.logInfo(chalk `{red ${ICON.cross} name {white ${name}} or version {white ${actual}} are not supported} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
|
|
101
91
|
}
|
package/dist/bin-list/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const option_1 = require("../option");
|
|
13
|
-
const list_1 = require("./list");
|
|
14
|
-
commander_1.program.description(' List all dependencies required by your packages.');
|
|
15
|
-
commander_1.program.on('--help', () => {
|
|
16
|
-
console.log((0, chalk_1.default) `
|
|
2
|
+
import chalk from 'chalk-template';
|
|
3
|
+
import { program } from 'commander';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
import { io } from '../io/index.js';
|
|
6
|
+
import { showHelpOnError } from '../lib/show-help-on-error.js';
|
|
7
|
+
import { option } from '../option.js';
|
|
8
|
+
import { list } from './list.js';
|
|
9
|
+
program.description(' List all dependencies required by your packages.');
|
|
10
|
+
program.on('--help', () => {
|
|
11
|
+
console.log(chalk `
|
|
17
12
|
Examples:
|
|
18
13
|
{dim # uses defaults for resolving packages}
|
|
19
14
|
syncpack list
|
|
@@ -42,21 +37,21 @@ Reference:
|
|
|
42
37
|
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
43
38
|
`);
|
|
44
39
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.option(...
|
|
48
|
-
.option(...
|
|
49
|
-
.option(...
|
|
50
|
-
.option(...
|
|
51
|
-
.option(...
|
|
40
|
+
showHelpOnError(program);
|
|
41
|
+
program
|
|
42
|
+
.option(...option.source)
|
|
43
|
+
.option(...option.filter)
|
|
44
|
+
.option(...option.config)
|
|
45
|
+
.option(...option.specs)
|
|
46
|
+
.option(...option.types)
|
|
52
47
|
.parse(process.argv);
|
|
53
|
-
|
|
54
|
-
io
|
|
48
|
+
Effect.runPromise(list({
|
|
49
|
+
io,
|
|
55
50
|
cli: {
|
|
56
|
-
configPath:
|
|
57
|
-
filter:
|
|
58
|
-
source:
|
|
59
|
-
specs:
|
|
60
|
-
types:
|
|
51
|
+
configPath: program.opts().config,
|
|
52
|
+
filter: program.opts().filter,
|
|
53
|
+
source: program.opts().source,
|
|
54
|
+
specs: program.opts().specs,
|
|
55
|
+
types: program.opts().types,
|
|
61
56
|
},
|
|
62
57
|
}));
|
package/dist/bin-list/list.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import { type CliConfig } from '../config/types';
|
|
3
|
-
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
4
|
-
import type { Ctx } from '../get-context';
|
|
5
|
-
import type { Io } from '../io';
|
|
2
|
+
import { type CliConfig } from '../config/types.js';
|
|
3
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
4
|
+
import type { Ctx } from '../get-context/index.js';
|
|
5
|
+
import type { Io } from '../io/index.js';
|
|
6
6
|
interface Input {
|
|
7
7
|
io: Io;
|
|
8
8
|
cli: Partial<CliConfig>;
|
|
9
9
|
errorHandlers?: ErrorHandlers;
|
|
10
10
|
}
|
|
11
|
-
export declare function list({ io, cli, errorHandlers }: Input): Effect.Effect<
|
|
12
|
-
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<
|
|
13
|
-
export declare function logOtherCommands(): Effect.Effect<
|
|
11
|
+
export declare function list({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
|
|
12
|
+
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<Ctx>;
|
|
13
|
+
export declare function logOtherCommands(): Effect.Effect<void, never, never>;
|
|
14
14
|
export {};
|
package/dist/bin-list/list.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 list({ 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);
|
|
1
|
+
import chalk from 'chalk-template';
|
|
2
|
+
import { Context, Effect, pipe } from 'effect';
|
|
3
|
+
import { EOL } from 'os';
|
|
4
|
+
import { CliConfigTag } from '../config/tag.js';
|
|
5
|
+
import { ICON } from '../constants.js';
|
|
6
|
+
import { defaultErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
7
|
+
import { getContext } from '../get-context/index.js';
|
|
8
|
+
import { getInstances } from '../get-instances/index.js';
|
|
9
|
+
import { exitIfInvalid } from '../io/exit-if-invalid.js';
|
|
10
|
+
import { IoTag } from '../io/index.js';
|
|
11
|
+
import { getVersionGroupHeader } from '../lib/get-group-header.js';
|
|
12
|
+
import { padStart } from '../lib/pad-start.js';
|
|
13
|
+
import { withLogger } from '../lib/with-logger.js';
|
|
14
|
+
export function list({ io, cli, errorHandlers = defaultErrorHandlers }) {
|
|
15
|
+
return pipe(getContext({ io, cli, errorHandlers }), Effect.flatMap((ctx) => pipeline(ctx, io, errorHandlers)), Effect.flatMap(exitIfInvalid), Effect.provide(pipe(Context.empty(), Context.add(CliConfigTag, cli), Context.add(IoTag, io))), withLogger);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
|
|
17
|
+
export function pipeline(ctx, io, errorHandlers) {
|
|
18
|
+
return Effect.gen(function* ($) {
|
|
19
|
+
const { versionGroups } = yield* $(getInstances(ctx, io, errorHandlers));
|
|
27
20
|
let index = 0;
|
|
28
21
|
for (const group of versionGroups) {
|
|
29
|
-
yield* $(
|
|
22
|
+
yield* $(Effect.logInfo(getVersionGroupHeader({ group, index })));
|
|
30
23
|
yield* $(onGroupTag[group._tag](group));
|
|
31
24
|
if (group._tag === 'Banned' || group._tag === 'FilteredOut' || group._tag === 'Ignored') {
|
|
32
25
|
if (group._tag === 'Banned')
|
|
@@ -43,7 +36,7 @@ function pipeline(ctx, io, errorHandlers) {
|
|
|
43
36
|
switch (report._tagGroup) {
|
|
44
37
|
case 'Valid': {
|
|
45
38
|
const actual = report.specifier.raw;
|
|
46
|
-
matches.add(
|
|
39
|
+
matches.add(chalk `{gray ${actual}}`);
|
|
47
40
|
break;
|
|
48
41
|
}
|
|
49
42
|
case 'Fixable': {
|
|
@@ -69,88 +62,86 @@ function pipeline(ctx, io, errorHandlers) {
|
|
|
69
62
|
return ctx;
|
|
70
63
|
});
|
|
71
64
|
}
|
|
72
|
-
exports.pipeline = pipeline;
|
|
73
65
|
const onGroupTag = {
|
|
74
66
|
Banned(group) {
|
|
75
|
-
return
|
|
67
|
+
return Effect.gen(function* ($) {
|
|
76
68
|
for (const groupReport of yield* $(group.inspectAll())) {
|
|
77
69
|
const name = groupReport.name;
|
|
78
|
-
const usages = `${
|
|
79
|
-
const invalidLabel =
|
|
80
|
-
const msg =
|
|
81
|
-
yield* $(
|
|
70
|
+
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
71
|
+
const invalidLabel = chalk `{gray ${usages}} {red ${name}}`;
|
|
72
|
+
const msg = chalk `${invalidLabel} {gray [Banned]}`;
|
|
73
|
+
yield* $(Effect.logInfo(msg));
|
|
82
74
|
}
|
|
83
75
|
});
|
|
84
76
|
},
|
|
85
77
|
FilteredOut(group) {
|
|
86
|
-
return
|
|
78
|
+
return Effect.gen(function* ($) {
|
|
87
79
|
for (const groupReport of yield* $(group.inspectAll())) {
|
|
88
80
|
const name = groupReport.name;
|
|
89
|
-
const usages = `${
|
|
90
|
-
const invalidLabel =
|
|
91
|
-
const msg =
|
|
92
|
-
yield* $(
|
|
81
|
+
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
82
|
+
const invalidLabel = chalk `{gray ${usages}} {gray ${name}}`;
|
|
83
|
+
const msg = chalk `${invalidLabel} {gray [FilteredOut]}`;
|
|
84
|
+
yield* $(Effect.logInfo(msg));
|
|
93
85
|
}
|
|
94
86
|
});
|
|
95
87
|
},
|
|
96
88
|
Ignored(group) {
|
|
97
|
-
return
|
|
89
|
+
return Effect.gen(function* ($) {
|
|
98
90
|
for (const groupReport of yield* $(group.inspectAll())) {
|
|
99
91
|
const name = groupReport.name;
|
|
100
|
-
const usages = `${
|
|
101
|
-
const invalidLabel =
|
|
102
|
-
const msg =
|
|
103
|
-
yield* $(
|
|
92
|
+
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
93
|
+
const invalidLabel = chalk `{gray ${usages}} {gray ${name}}`;
|
|
94
|
+
const msg = chalk `${invalidLabel} {gray [Ignored]}`;
|
|
95
|
+
yield* $(Effect.logInfo(msg));
|
|
104
96
|
}
|
|
105
97
|
});
|
|
106
98
|
},
|
|
107
99
|
Pinned(_group) {
|
|
108
|
-
return
|
|
100
|
+
return Effect.void;
|
|
109
101
|
},
|
|
110
102
|
SameRange(_group) {
|
|
111
|
-
return
|
|
103
|
+
return Effect.void;
|
|
112
104
|
},
|
|
113
105
|
SnappedTo(_group) {
|
|
114
|
-
return
|
|
106
|
+
return Effect.void;
|
|
115
107
|
},
|
|
116
108
|
Standard(_group) {
|
|
117
|
-
return
|
|
109
|
+
return Effect.void;
|
|
118
110
|
},
|
|
119
111
|
};
|
|
120
112
|
function logMatchingReport(groupReport, messages) {
|
|
121
113
|
const name = groupReport.name;
|
|
122
|
-
const usages = `${
|
|
123
|
-
const label =
|
|
124
|
-
return
|
|
114
|
+
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
115
|
+
const label = chalk `{gray ${usages}} ${name}{gray :}`;
|
|
116
|
+
return Effect.logInfo(chalk `${label} ${[...messages].join(chalk `{gray , }`)}`);
|
|
125
117
|
}
|
|
126
118
|
function logMismatchingReport(groupReport, messages) {
|
|
127
119
|
const name = groupReport.name;
|
|
128
|
-
const usages = `${
|
|
129
|
-
const label =
|
|
120
|
+
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
121
|
+
const label = chalk `{gray ${usages}} {red ${name}}{gray :}`;
|
|
130
122
|
const indent = usages.replace(/./g, ' ');
|
|
131
|
-
return
|
|
123
|
+
return Effect.logInfo(chalk `${label}${['', ...messages].join(chalk `${EOL}${indent} {red ${ICON.cross}} `)}`);
|
|
132
124
|
}
|
|
133
125
|
function getLogForFixable(report) {
|
|
134
126
|
const _tag = report._tag;
|
|
135
127
|
const actual = report.fixable.instance.rawSpecifier.raw;
|
|
136
128
|
const expected = report.fixable.raw;
|
|
137
|
-
return
|
|
129
|
+
return chalk `{red ${actual}} {gray ${ICON.rightArrow}} {green ${expected}} {gray [${_tag}]}`;
|
|
138
130
|
}
|
|
139
131
|
function getLogForUnfixable(report) {
|
|
140
132
|
const _tag = report._tag;
|
|
141
133
|
const actual = report.unfixable.rawSpecifier.raw;
|
|
142
|
-
return
|
|
134
|
+
return chalk `{red ${actual}} {gray ${ICON.rightArrow}} {gray [${_tag}]}`;
|
|
143
135
|
}
|
|
144
|
-
function logOtherCommands() {
|
|
145
|
-
return
|
|
136
|
+
export function logOtherCommands() {
|
|
137
|
+
return Effect.logInfo([
|
|
146
138
|
'',
|
|
147
139
|
' What next?',
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
chalk `{dim -} {yellow syncpack list-mismatches} to see more detail about mismatching versions`,
|
|
141
|
+
chalk `{dim -} {yellow syncpack fix-mismatches} to fix version mismatches automatically`,
|
|
142
|
+
chalk `{dim -} {yellow syncpack format} to sort and prettify your package.json files`,
|
|
143
|
+
chalk `{dim -} {yellow syncpack update} to choose updates from the npm registry`,
|
|
144
|
+
chalk `{dim -} {yellow syncpack --help} for everything else`,
|
|
153
145
|
'',
|
|
154
|
-
].join(
|
|
146
|
+
].join(EOL));
|
|
155
147
|
}
|
|
156
|
-
exports.logOtherCommands = logOtherCommands;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const io_1 = require("../io");
|
|
11
|
-
const show_help_on_error_1 = require("../lib/show-help-on-error");
|
|
12
|
-
const option_1 = require("../option");
|
|
13
|
-
const list_mismatches_1 = require("./list-mismatches");
|
|
14
|
-
commander_1.program.description(`
|
|
2
|
+
import chalk from 'chalk-template';
|
|
3
|
+
import { program } from 'commander';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
import { io } from '../io/index.js';
|
|
6
|
+
import { showHelpOnError } from '../lib/show-help-on-error.js';
|
|
7
|
+
import { option } from '../option.js';
|
|
8
|
+
import { listMismatches } from './list-mismatches.js';
|
|
9
|
+
program.description(`
|
|
15
10
|
List dependencies which are required by multiple packages, where the version
|
|
16
11
|
is not the same across every package.`.replace(/^\n/, ''));
|
|
17
|
-
|
|
18
|
-
console.log(
|
|
12
|
+
program.on('--help', () => {
|
|
13
|
+
console.log(chalk `
|
|
19
14
|
Examples:
|
|
20
15
|
{dim # uses defaults for resolving packages}
|
|
21
16
|
syncpack list-mismatches
|
|
@@ -44,21 +39,21 @@ Reference:
|
|
|
44
39
|
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
45
40
|
`);
|
|
46
41
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.option(...
|
|
50
|
-
.option(...
|
|
51
|
-
.option(...
|
|
52
|
-
.option(...
|
|
53
|
-
.option(...
|
|
42
|
+
showHelpOnError(program);
|
|
43
|
+
program
|
|
44
|
+
.option(...option.source)
|
|
45
|
+
.option(...option.filter)
|
|
46
|
+
.option(...option.config)
|
|
47
|
+
.option(...option.specs)
|
|
48
|
+
.option(...option.types)
|
|
54
49
|
.parse(process.argv);
|
|
55
|
-
|
|
56
|
-
io
|
|
50
|
+
Effect.runPromise(listMismatches({
|
|
51
|
+
io,
|
|
57
52
|
cli: {
|
|
58
|
-
configPath:
|
|
59
|
-
filter:
|
|
60
|
-
source:
|
|
61
|
-
specs:
|
|
62
|
-
types:
|
|
53
|
+
configPath: program.opts().config,
|
|
54
|
+
filter: program.opts().filter,
|
|
55
|
+
source: program.opts().source,
|
|
56
|
+
specs: program.opts().specs,
|
|
57
|
+
types: program.opts().types,
|
|
63
58
|
},
|
|
64
59
|
}));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import { type CliConfig } from '../config/types';
|
|
3
|
-
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
4
|
-
import type { Ctx } from '../get-context';
|
|
5
|
-
import type { Io } from '../io';
|
|
2
|
+
import { type CliConfig } from '../config/types.js';
|
|
3
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
4
|
+
import type { Ctx } from '../get-context/index.js';
|
|
5
|
+
import type { Io } from '../io/index.js';
|
|
6
6
|
interface Input {
|
|
7
7
|
io: Io;
|
|
8
8
|
cli: Partial<CliConfig>;
|
|
9
9
|
errorHandlers?: ErrorHandlers;
|
|
10
10
|
}
|
|
11
|
-
export declare function listMismatches({ io, cli, errorHandlers }: Input): Effect.Effect<
|
|
11
|
+
export declare function listMismatches({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
|
|
12
12
|
/** Exported to be reused by `syncpack lint` */
|
|
13
|
-
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<
|
|
14
|
-
export declare const logMissingLocalVersion: (report: any) => Effect.Effect<
|
|
15
|
-
export declare const logMissingSnappedToMismatch: (report: any) => Effect.Effect<
|
|
16
|
-
export declare const logUnsupportedMismatch: (report: any) => Effect.Effect<
|
|
17
|
-
export declare const logSameRangeMismatch: (report: any) => Effect.Effect<
|
|
13
|
+
export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<Ctx>;
|
|
14
|
+
export declare const logMissingLocalVersion: (report: any) => Effect.Effect<void>;
|
|
15
|
+
export declare const logMissingSnappedToMismatch: (report: any) => Effect.Effect<void>;
|
|
16
|
+
export declare const logUnsupportedMismatch: (report: any) => Effect.Effect<void>;
|
|
17
|
+
export declare const logSameRangeMismatch: (report: any) => Effect.Effect<void>;
|
|
18
18
|
export {};
|