syncpack 12.4.0 → 14.0.0-alpha.1
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/index.js +48 -0
- package/package.json +17 -76
- package/schema.json +917 -0
- package/syncpack.d.ts +122 -0
- package/LICENSE +0 -20
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +0 -16
- package/dist/bin-fix-mismatches/fix-mismatches.js +0 -110
- package/dist/bin-fix-mismatches/index.d.ts +0 -2
- package/dist/bin-fix-mismatches/index.js +0 -64
- package/dist/bin-format/format.d.ts +0 -13
- package/dist/bin-format/format.js +0 -90
- package/dist/bin-format/index.d.ts +0 -2
- package/dist/bin-format/index.js +0 -53
- package/dist/bin-lint/index.d.ts +0 -2
- package/dist/bin-lint/index.js +0 -38
- package/dist/bin-lint/lint.d.ts +0 -11
- package/dist/bin-lint/lint.js +0 -52
- package/dist/bin-lint-semver-ranges/index.d.ts +0 -2
- package/dist/bin-lint-semver-ranges/index.js +0 -65
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +0 -16
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +0 -91
- package/dist/bin-list/index.d.ts +0 -2
- package/dist/bin-list/index.js +0 -57
- package/dist/bin-list/list.d.ts +0 -14
- package/dist/bin-list/list.js +0 -147
- package/dist/bin-list-mismatches/index.d.ts +0 -2
- package/dist/bin-list-mismatches/index.js +0 -59
- package/dist/bin-list-mismatches/list-mismatches.d.ts +0 -18
- package/dist/bin-list-mismatches/list-mismatches.js +0 -218
- package/dist/bin-prompt/index.d.ts +0 -2
- package/dist/bin-prompt/index.js +0 -61
- package/dist/bin-prompt/prompt.d.ts +0 -11
- package/dist/bin-prompt/prompt.js +0 -93
- package/dist/bin-set-semver-ranges/index.d.ts +0 -2
- package/dist/bin-set-semver-ranges/index.js +0 -69
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +0 -11
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +0 -58
- package/dist/bin-update/effects.d.ts +0 -52
- package/dist/bin-update/effects.js +0 -267
- package/dist/bin-update/index.d.ts +0 -2
- package/dist/bin-update/index.js +0 -54
- package/dist/bin-update/update.d.ts +0 -6
- package/dist/bin-update/update.js +0 -59
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -37
- package/dist/config/get-custom-types.d.ts +0 -19
- package/dist/config/get-custom-types.js +0 -50
- package/dist/config/get-enabled-types.d.ts +0 -17
- package/dist/config/get-enabled-types.js +0 -94
- package/dist/config/get-filter.d.ts +0 -2
- package/dist/config/get-filter.js +0 -10
- package/dist/config/get-indent.d.ts +0 -2
- package/dist/config/get-indent.js +0 -9
- package/dist/config/get-sort-az.d.ts +0 -2
- package/dist/config/get-sort-az.js +0 -8
- package/dist/config/get-sort-exports.d.ts +0 -2
- package/dist/config/get-sort-exports.js +0 -8
- package/dist/config/get-sort-first.d.ts +0 -2
- package/dist/config/get-sort-first.js +0 -8
- package/dist/config/get-source.d.ts +0 -2
- package/dist/config/get-source.js +0 -8
- package/dist/config/tag.d.ts +0 -3
- package/dist/config/tag.js +0 -2
- package/dist/config/types.d.ts +0 -132
- package/dist/config/types.js +0 -1
- package/dist/constants.d.ts +0 -106
- package/dist/constants.js +0 -103
- package/dist/error-handlers/default-error-handlers.d.ts +0 -25
- package/dist/error-handlers/default-error-handlers.js +0 -80
- package/dist/get-context/index.d.ts +0 -23
- package/dist/get-context/index.js +0 -18
- package/dist/get-context/lib/key-by.d.ts +0 -6
- package/dist/get-context/lib/key-by.js +0 -12
- package/dist/get-instances/index.d.ts +0 -14
- package/dist/get-instances/index.js +0 -42
- package/dist/get-instances/instance.d.ts +0 -26
- package/dist/get-instances/instance.js +0 -31
- package/dist/get-package-json-files/get-file-paths.d.ts +0 -21
- package/dist/get-package-json-files/get-file-paths.js +0 -22
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +0 -10
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +0 -14
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +0 -3
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +0 -16
- package/dist/get-package-json-files/get-patterns/index.d.ts +0 -8
- package/dist/get-package-json-files/get-patterns/index.js +0 -23
- package/dist/get-package-json-files/index.d.ts +0 -10
- package/dist/get-package-json-files/index.js +0 -8
- package/dist/get-package-json-files/package-json-file.d.ts +0 -47
- package/dist/get-package-json-files/package-json-file.js +0 -29
- package/dist/guards/can-add-to-group.d.ts +0 -5
- package/dist/guards/can-add-to-group.js +0 -52
- package/dist/guards/is-semver.d.ts +0 -2
- package/dist/guards/is-semver.js +0 -13
- package/dist/guards/is-valid-semver-range.d.ts +0 -3
- package/dist/guards/is-valid-semver-range.js +0 -14
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/io/ask-for-choice.d.ts +0 -14
- package/dist/io/ask-for-choice.js +0 -17
- package/dist/io/ask-for-input.d.ts +0 -13
- package/dist/io/ask-for-input.js +0 -14
- package/dist/io/exit-if-invalid.d.ts +0 -4
- package/dist/io/exit-if-invalid.js +0 -9
- package/dist/io/glob-sync.d.ts +0 -11
- package/dist/io/glob-sync.js +0 -14
- package/dist/io/index.d.ts +0 -27
- package/dist/io/index.js +0 -26
- package/dist/io/read-config-file.d.ts +0 -7
- package/dist/io/read-config-file.js +0 -22
- package/dist/io/read-file-sync.d.ts +0 -12
- package/dist/io/read-file-sync.js +0 -9
- package/dist/io/read-json-file-sync.d.ts +0 -30
- package/dist/io/read-json-file-sync.js +0 -19
- package/dist/io/read-yaml-file-sync.d.ts +0 -12
- package/dist/io/read-yaml-file-sync.js +0 -9
- package/dist/io/to-json.d.ts +0 -9
- package/dist/io/to-json.js +0 -29
- package/dist/io/write-file-sync.d.ts +0 -12
- package/dist/io/write-file-sync.js +0 -10
- package/dist/io/write-if-changed.d.ts +0 -5
- package/dist/io/write-if-changed.js +0 -10
- package/dist/lib/format-repository-url.d.ts +0 -1
- package/dist/lib/format-repository-url.js +0 -37
- package/dist/lib/get-group-header.d.ts +0 -10
- package/dist/lib/get-group-header.js +0 -23
- package/dist/lib/get.d.ts +0 -11
- package/dist/lib/get.js +0 -36
- package/dist/lib/pad-start.d.ts +0 -1
- package/dist/lib/pad-start.js +0 -3
- package/dist/lib/ring-buffer.d.ts +0 -10
- package/dist/lib/ring-buffer.js +0 -20
- package/dist/lib/set-semver-range.d.ts +0 -3
- package/dist/lib/set-semver-range.js +0 -20
- package/dist/lib/show-help-on-error.d.ts +0 -2
- package/dist/lib/show-help-on-error.js +0 -32
- package/dist/lib/sort-by-name.d.ts +0 -5
- package/dist/lib/sort-by-name.js +0 -9
- package/dist/lib/with-logger.d.ts +0 -2
- package/dist/lib/with-logger.js +0 -29
- package/dist/option.d.ts +0 -10
- package/dist/option.js +0 -27
- package/dist/report.d.ts +0 -131
- package/dist/report.js +0 -129
- package/dist/schema.json +0 -544
- package/dist/semver-group/create-semver-groups.d.ts +0 -4
- package/dist/semver-group/create-semver-groups.js +0 -79
- package/dist/semver-group/disabled.d.ts +0 -26
- package/dist/semver-group/disabled.js +0 -28
- package/dist/semver-group/filtered-out.d.ts +0 -27
- package/dist/semver-group/filtered-out.js +0 -34
- package/dist/semver-group/ignored.d.ts +0 -22
- package/dist/semver-group/ignored.js +0 -24
- package/dist/semver-group/index.d.ts +0 -20
- package/dist/semver-group/index.js +0 -7
- package/dist/semver-group/with-range.d.ts +0 -22
- package/dist/semver-group/with-range.js +0 -45
- package/dist/specifier/alias.d.ts +0 -17
- package/dist/specifier/alias.js +0 -20
- package/dist/specifier/base.d.ts +0 -41
- package/dist/specifier/base.js +0 -54
- package/dist/specifier/delete.d.ts +0 -17
- package/dist/specifier/delete.js +0 -16
- package/dist/specifier/exact.d.ts +0 -20
- package/dist/specifier/exact.js +0 -21
- package/dist/specifier/file.d.ts +0 -8
- package/dist/specifier/file.js +0 -7
- package/dist/specifier/hosted-git.d.ts +0 -15
- package/dist/specifier/hosted-git.js +0 -22
- package/dist/specifier/index.d.ts +0 -28
- package/dist/specifier/index.js +0 -63
- package/dist/specifier/latest.d.ts +0 -19
- package/dist/specifier/latest.js +0 -20
- package/dist/specifier/lib/non-semver-error.d.ts +0 -11
- package/dist/specifier/lib/non-semver-error.js +0 -6
- package/dist/specifier/lib/parse-specifier.d.ts +0 -14
- package/dist/specifier/lib/parse-specifier.js +0 -16
- package/dist/specifier/lib/specific-registry-result.d.ts +0 -9
- package/dist/specifier/lib/specific-registry-result.js +0 -1
- package/dist/specifier/range.d.ts +0 -19
- package/dist/specifier/range.js +0 -20
- package/dist/specifier/tag.d.ts +0 -11
- package/dist/specifier/tag.js +0 -10
- package/dist/specifier/unsupported.d.ts +0 -7
- package/dist/specifier/unsupported.js +0 -7
- package/dist/specifier/url.d.ts +0 -8
- package/dist/specifier/url.js +0 -7
- package/dist/specifier/workspace-protocol.d.ts +0 -19
- package/dist/specifier/workspace-protocol.js +0 -34
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +0 -3
- package/dist/strategy/lib/get-non-empty-string-prop.js +0 -7
- package/dist/strategy/name-and-version-props.d.ts +0 -12
- package/dist/strategy/name-and-version-props.js +0 -60
- package/dist/strategy/named-version-string.d.ts +0 -11
- package/dist/strategy/named-version-string.js +0 -49
- package/dist/strategy/unnamed-version-string.d.ts +0 -11
- package/dist/strategy/unnamed-version-string.js +0 -45
- package/dist/strategy/versions-by-name.d.ts +0 -11
- package/dist/strategy/versions-by-name.js +0 -25
- package/dist/version-group/banned.d.ts +0 -17
- package/dist/version-group/banned.js +0 -26
- package/dist/version-group/create-version-groups.d.ts +0 -4
- package/dist/version-group/create-version-groups.js +0 -114
- package/dist/version-group/filtered-out.d.ts +0 -19
- package/dist/version-group/filtered-out.js +0 -30
- package/dist/version-group/ignored.d.ts +0 -17
- package/dist/version-group/ignored.js +0 -23
- package/dist/version-group/index.d.ts +0 -26
- package/dist/version-group/index.js +0 -7
- package/dist/version-group/lib/clean.d.ts +0 -2
- package/dist/version-group/lib/clean.js +0 -6
- package/dist/version-group/lib/delete.d.ts +0 -2
- package/dist/version-group/lib/delete.js +0 -1
- package/dist/version-group/lib/get-highest-version.d.ts +0 -6
- package/dist/version-group/lib/get-highest-version.js +0 -8
- package/dist/version-group/lib/get-lowest-version.d.ts +0 -6
- package/dist/version-group/lib/get-lowest-version.js +0 -8
- package/dist/version-group/lib/get-preferred-version.d.ts +0 -5
- package/dist/version-group/lib/get-preferred-version.js +0 -44
- package/dist/version-group/lib/get-range-score.d.ts +0 -2
- package/dist/version-group/lib/get-range-score.js +0 -18
- package/dist/version-group/lib/group-by.d.ts +0 -5
- package/dist/version-group/lib/group-by.js +0 -11
- package/dist/version-group/pinned.d.ts +0 -17
- package/dist/version-group/pinned.js +0 -26
- package/dist/version-group/same-range.d.ts +0 -19
- package/dist/version-group/same-range.js +0 -96
- package/dist/version-group/snapped-to.d.ts +0 -17
- package/dist/version-group/snapped-to.js +0 -69
- package/dist/version-group/standard.d.ts +0 -18
- package/dist/version-group/standard.js +0 -116
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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 `
|
|
10
|
-
Check dependency versions within {yellow dependencies}, {yellow devDependencies},
|
|
11
|
-
{yellow peerDependencies}, {yellow overrides}, and {yellow resolutions} follow a consistent format.`.replace(/^\n/, ''));
|
|
12
|
-
program.on('--help', () => {
|
|
13
|
-
console.log(chalk `
|
|
14
|
-
Examples:
|
|
15
|
-
{dim # uses defaults for resolving packages}
|
|
16
|
-
syncpack lint-semver-ranges
|
|
17
|
-
{dim # uses packages defined by --source when provided}
|
|
18
|
-
syncpack lint-semver-ranges --source {yellow "apps/*/package.json"}
|
|
19
|
-
{dim # multiple globs can be provided like this}
|
|
20
|
-
syncpack lint-semver-ranges --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
21
|
-
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
22
|
-
syncpack lint-semver-ranges --filter {yellow "typescript|tslint"}
|
|
23
|
-
|
|
24
|
-
Supported Ranges:
|
|
25
|
-
< {dim <1.4.2}
|
|
26
|
-
<= {dim <=1.4.2}
|
|
27
|
-
"" {dim 1.4.2}
|
|
28
|
-
~ {dim ~1.4.2}
|
|
29
|
-
^ {dim ^1.4.2}
|
|
30
|
-
>= {dim >=1.4.2}
|
|
31
|
-
> {dim >1.4.2}
|
|
32
|
-
* {dim *}
|
|
33
|
-
|
|
34
|
-
Resolving Packages:
|
|
35
|
-
1. If {yellow --source} globs are provided, use those.
|
|
36
|
-
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
37
|
-
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
38
|
-
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
39
|
-
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
40
|
-
|
|
41
|
-
Reference:
|
|
42
|
-
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
43
|
-
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
44
|
-
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
45
|
-
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
46
|
-
`);
|
|
47
|
-
});
|
|
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)
|
|
55
|
-
.parse(process.argv);
|
|
56
|
-
Effect.runPromise(lintSemverRanges({
|
|
57
|
-
io,
|
|
58
|
-
cli: {
|
|
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,
|
|
64
|
-
},
|
|
65
|
-
}));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
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
|
-
interface Input {
|
|
7
|
-
io: Io;
|
|
8
|
-
cli: Partial<CliConfig>;
|
|
9
|
-
errorHandlers?: ErrorHandlers;
|
|
10
|
-
}
|
|
11
|
-
export declare function lintSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
|
|
12
|
-
/** Exported to be reused by `syncpack lint` */
|
|
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
|
-
export {};
|
|
@@ -1,91 +0,0 @@
|
|
|
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);
|
|
17
|
-
}
|
|
18
|
-
/** Exported to be reused by `syncpack lint` */
|
|
19
|
-
export function pipeline(ctx, io, errorHandlers) {
|
|
20
|
-
return Effect.gen(function* ($) {
|
|
21
|
-
// no semver groups have been configured, they are disabled by default
|
|
22
|
-
if (!isNonEmptyArray(ctx.config.rcFile.semverGroups)) {
|
|
23
|
-
yield* $(logSemverGroupsDisabledWarning());
|
|
24
|
-
return ctx;
|
|
25
|
-
}
|
|
26
|
-
const { semverGroups } = yield* $(getInstances(ctx, io, errorHandlers));
|
|
27
|
-
let index = 0;
|
|
28
|
-
for (const group of semverGroups) {
|
|
29
|
-
const groupSize = group.instances.length;
|
|
30
|
-
let validCount = 0;
|
|
31
|
-
if (group._tag === 'Ignored') {
|
|
32
|
-
yield* $(Effect.logInfo(getSemverGroupHeader({ group, index })));
|
|
33
|
-
yield* $(logIgnoredSize(groupSize));
|
|
34
|
-
}
|
|
35
|
-
else if (group._tag === 'WithRange') {
|
|
36
|
-
yield* $(Effect.logInfo(getSemverGroupHeader({ group, index })));
|
|
37
|
-
for (const instance of group.instances) {
|
|
38
|
-
const report = yield* $(group.inspect(instance));
|
|
39
|
-
if (report._tag === 'Valid') {
|
|
40
|
-
validCount++;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
ctx.isInvalid = true;
|
|
44
|
-
if (report._tag === 'SemverRangeMismatch') {
|
|
45
|
-
yield* $(logSemverRangeMismatch(report));
|
|
46
|
-
}
|
|
47
|
-
else if (report._tag === 'UnsupportedMismatch') {
|
|
48
|
-
yield* $(logUnsupportedMismatch(report));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (validCount > 0)
|
|
53
|
-
yield* $(logValidSize(validCount));
|
|
54
|
-
index++;
|
|
55
|
-
}
|
|
56
|
-
return ctx;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
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));
|
|
64
|
-
}
|
|
65
|
-
export function logIgnoredSize(amount) {
|
|
66
|
-
const msg = chalk `${padStart(amount)} {dim ${ICON.skip}} ${amount} ignored`;
|
|
67
|
-
return Effect.logInfo(msg);
|
|
68
|
-
}
|
|
69
|
-
function logValidSize(amount) {
|
|
70
|
-
const msg = chalk `{green ${ICON.tick}} {dim ${amount} valid}`;
|
|
71
|
-
return Effect.logInfo(msg);
|
|
72
|
-
}
|
|
73
|
-
function logSemverRangeMismatch(report) {
|
|
74
|
-
const _tag = report._tag;
|
|
75
|
-
const instance = report.fixable.instance;
|
|
76
|
-
const name = instance.name;
|
|
77
|
-
const actual = instance.rawSpecifier.raw;
|
|
78
|
-
const expected = report.fixable.raw;
|
|
79
|
-
const propPath = instance.strategy.path;
|
|
80
|
-
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
81
|
-
return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
|
|
82
|
-
}
|
|
83
|
-
function logUnsupportedMismatch(report) {
|
|
84
|
-
const _tag = report._tag;
|
|
85
|
-
const instance = report.unfixable;
|
|
86
|
-
const name = instance.name;
|
|
87
|
-
const actual = instance.rawSpecifier.raw;
|
|
88
|
-
const propPath = instance.strategy.path;
|
|
89
|
-
const filePath = instance.packageJsonFile.jsonFile.shortPath;
|
|
90
|
-
return Effect.logInfo(chalk `{red ${ICON.cross} name {white ${name}} or version {white ${actual}} are not supported} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
|
|
91
|
-
}
|
package/dist/bin-list/index.d.ts
DELETED
package/dist/bin-list/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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 `
|
|
12
|
-
Examples:
|
|
13
|
-
{dim # uses defaults for resolving packages}
|
|
14
|
-
syncpack list
|
|
15
|
-
{dim # uses packages defined by --source when provided}
|
|
16
|
-
syncpack list --source {yellow "apps/*/package.json"}
|
|
17
|
-
{dim # multiple globs can be provided like this}
|
|
18
|
-
syncpack list --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
19
|
-
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
20
|
-
syncpack list --filter {yellow "typescript|tslint"}
|
|
21
|
-
{dim # only inspect "devDependencies"}
|
|
22
|
-
syncpack list --types dev
|
|
23
|
-
{dim # only inspect "devDependencies" and "peerDependencies"}
|
|
24
|
-
syncpack list --types dev,peer
|
|
25
|
-
|
|
26
|
-
Resolving Packages:
|
|
27
|
-
1. If {yellow --source} globs are provided, use those.
|
|
28
|
-
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
29
|
-
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
30
|
-
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
31
|
-
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
32
|
-
|
|
33
|
-
Reference:
|
|
34
|
-
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
35
|
-
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
36
|
-
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
37
|
-
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
38
|
-
`);
|
|
39
|
-
});
|
|
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)
|
|
47
|
-
.parse(process.argv);
|
|
48
|
-
Effect.runPromise(list({
|
|
49
|
-
io,
|
|
50
|
-
cli: {
|
|
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,
|
|
56
|
-
},
|
|
57
|
-
}));
|
package/dist/bin-list/list.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
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
|
-
interface Input {
|
|
7
|
-
io: Io;
|
|
8
|
-
cli: Partial<CliConfig>;
|
|
9
|
-
errorHandlers?: ErrorHandlers;
|
|
10
|
-
}
|
|
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
|
-
export {};
|
package/dist/bin-list/list.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
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);
|
|
16
|
-
}
|
|
17
|
-
export function pipeline(ctx, io, errorHandlers) {
|
|
18
|
-
return Effect.gen(function* ($) {
|
|
19
|
-
const { versionGroups } = yield* $(getInstances(ctx, io, errorHandlers));
|
|
20
|
-
let index = 0;
|
|
21
|
-
for (const group of versionGroups) {
|
|
22
|
-
yield* $(Effect.logInfo(getVersionGroupHeader({ group, index })));
|
|
23
|
-
yield* $(onGroupTag[group._tag](group));
|
|
24
|
-
if (group._tag === 'Banned' || group._tag === 'FilteredOut' || group._tag === 'Ignored') {
|
|
25
|
-
if (group._tag === 'Banned')
|
|
26
|
-
ctx.isInvalid = true;
|
|
27
|
-
index++;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
for (const groupReport of yield* $(group.inspectAll())) {
|
|
31
|
-
const matches = new Set();
|
|
32
|
-
const mismatches = new Set();
|
|
33
|
-
for (const report of groupReport.reports) {
|
|
34
|
-
if (report.isInvalid)
|
|
35
|
-
ctx.isInvalid = true;
|
|
36
|
-
switch (report._tagGroup) {
|
|
37
|
-
case 'Valid': {
|
|
38
|
-
const actual = report.specifier.raw;
|
|
39
|
-
matches.add(chalk `{gray ${actual}}`);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case 'Fixable': {
|
|
43
|
-
mismatches.add(getLogForFixable(report));
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case 'Unfixable': {
|
|
47
|
-
mismatches.add(getLogForUnfixable(report));
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (mismatches.size === 0) {
|
|
53
|
-
yield* $(logMatchingReport(groupReport, matches));
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
yield* $(logMismatchingReport(groupReport, mismatches));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
index++;
|
|
60
|
-
}
|
|
61
|
-
yield* $(logOtherCommands());
|
|
62
|
-
return ctx;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
const onGroupTag = {
|
|
66
|
-
Banned(group) {
|
|
67
|
-
return Effect.gen(function* ($) {
|
|
68
|
-
for (const groupReport of yield* $(group.inspectAll())) {
|
|
69
|
-
const name = groupReport.name;
|
|
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));
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
FilteredOut(group) {
|
|
78
|
-
return Effect.gen(function* ($) {
|
|
79
|
-
for (const groupReport of yield* $(group.inspectAll())) {
|
|
80
|
-
const name = groupReport.name;
|
|
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));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
Ignored(group) {
|
|
89
|
-
return Effect.gen(function* ($) {
|
|
90
|
-
for (const groupReport of yield* $(group.inspectAll())) {
|
|
91
|
-
const name = groupReport.name;
|
|
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));
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
Pinned(_group) {
|
|
100
|
-
return Effect.void;
|
|
101
|
-
},
|
|
102
|
-
SameRange(_group) {
|
|
103
|
-
return Effect.void;
|
|
104
|
-
},
|
|
105
|
-
SnappedTo(_group) {
|
|
106
|
-
return Effect.void;
|
|
107
|
-
},
|
|
108
|
-
Standard(_group) {
|
|
109
|
-
return Effect.void;
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
function logMatchingReport(groupReport, messages) {
|
|
113
|
-
const name = groupReport.name;
|
|
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 , }`)}`);
|
|
117
|
-
}
|
|
118
|
-
function logMismatchingReport(groupReport, messages) {
|
|
119
|
-
const name = groupReport.name;
|
|
120
|
-
const usages = `${padStart(groupReport.reports.length)}x`;
|
|
121
|
-
const label = chalk `{gray ${usages}} {red ${name}}{gray :}`;
|
|
122
|
-
const indent = usages.replace(/./g, ' ');
|
|
123
|
-
return Effect.logInfo(chalk `${label}${['', ...messages].join(chalk `${EOL}${indent} {red ${ICON.cross}} `)}`);
|
|
124
|
-
}
|
|
125
|
-
function getLogForFixable(report) {
|
|
126
|
-
const _tag = report._tag;
|
|
127
|
-
const actual = report.fixable.instance.rawSpecifier.raw;
|
|
128
|
-
const expected = report.fixable.raw;
|
|
129
|
-
return chalk `{red ${actual}} {gray ${ICON.rightArrow}} {green ${expected}} {gray [${_tag}]}`;
|
|
130
|
-
}
|
|
131
|
-
function getLogForUnfixable(report) {
|
|
132
|
-
const _tag = report._tag;
|
|
133
|
-
const actual = report.unfixable.rawSpecifier.raw;
|
|
134
|
-
return chalk `{red ${actual}} {gray ${ICON.rightArrow}} {gray [${_tag}]}`;
|
|
135
|
-
}
|
|
136
|
-
export function logOtherCommands() {
|
|
137
|
-
return Effect.logInfo([
|
|
138
|
-
'',
|
|
139
|
-
' What next?',
|
|
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`,
|
|
145
|
-
'',
|
|
146
|
-
].join(EOL));
|
|
147
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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(`
|
|
10
|
-
List dependencies which are required by multiple packages, where the version
|
|
11
|
-
is not the same across every package.`.replace(/^\n/, ''));
|
|
12
|
-
program.on('--help', () => {
|
|
13
|
-
console.log(chalk `
|
|
14
|
-
Examples:
|
|
15
|
-
{dim # uses defaults for resolving packages}
|
|
16
|
-
syncpack list-mismatches
|
|
17
|
-
{dim # uses packages defined by --source when provided}
|
|
18
|
-
syncpack list-mismatches --source {yellow "apps/*/package.json"}
|
|
19
|
-
{dim # multiple globs can be provided like this}
|
|
20
|
-
syncpack list-mismatches --source {yellow "apps/*/package.json"} --source {yellow "core/*/package.json"}
|
|
21
|
-
{dim # uses dependencies regular expression defined by --filter when provided}
|
|
22
|
-
syncpack list-mismatches --filter {yellow "typescript|tslint"}
|
|
23
|
-
{dim # only inspect "devDependencies"}
|
|
24
|
-
syncpack list-mismatches --types dev
|
|
25
|
-
{dim # only inspect "devDependencies" and "peerDependencies"}
|
|
26
|
-
syncpack list-mismatches --types dev,peer
|
|
27
|
-
|
|
28
|
-
Resolving Packages:
|
|
29
|
-
1. If {yellow --source} globs are provided, use those.
|
|
30
|
-
2. If using Pnpm Workspaces, read {yellow packages} from {yellow pnpm-workspace.yaml} in the root of the project.
|
|
31
|
-
3. If using Yarn Workspaces, read {yellow workspaces} from {yellow package.json}.
|
|
32
|
-
4. If using Lerna, read {yellow packages} from {yellow lerna.json}.
|
|
33
|
-
5. Default to {yellow "package.json"} and {yellow "packages/*/package.json"}.
|
|
34
|
-
|
|
35
|
-
Reference:
|
|
36
|
-
globs {blue.underline https://github.com/isaacs/node-glob#glob-primer}
|
|
37
|
-
lerna.json {blue.underline https://github.com/lerna/lerna#lernajson}
|
|
38
|
-
Yarn Workspaces {blue.underline https://yarnpkg.com/lang/en/docs/workspaces}
|
|
39
|
-
Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
|
|
40
|
-
`);
|
|
41
|
-
});
|
|
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)
|
|
49
|
-
.parse(process.argv);
|
|
50
|
-
Effect.runPromise(listMismatches({
|
|
51
|
-
io,
|
|
52
|
-
cli: {
|
|
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,
|
|
58
|
-
},
|
|
59
|
-
}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
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
|
-
interface Input {
|
|
7
|
-
io: Io;
|
|
8
|
-
cli: Partial<CliConfig>;
|
|
9
|
-
errorHandlers?: ErrorHandlers;
|
|
10
|
-
}
|
|
11
|
-
export declare function listMismatches({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
|
|
12
|
-
/** Exported to be reused by `syncpack lint` */
|
|
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
|
-
export {};
|