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.
Files changed (206) hide show
  1. package/dist/bin-fix-mismatches/fix-mismatches.d.ts +9 -9
  2. package/dist/bin-fix-mismatches/fix-mismatches.js +43 -54
  3. package/dist/bin-fix-mismatches/index.js +26 -31
  4. package/dist/bin-format/format.d.ts +6 -6
  5. package/dist/bin-format/format.js +27 -32
  6. package/dist/bin-format/index.js +20 -25
  7. package/dist/bin-lint/index.js +15 -20
  8. package/dist/bin-lint/lint.d.ts +4 -4
  9. package/dist/bin-lint/lint.js +28 -35
  10. package/dist/bin-lint-semver-ranges/index.js +24 -29
  11. package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +8 -8
  12. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +34 -44
  13. package/dist/bin-list/index.js +24 -29
  14. package/dist/bin-list/list.d.ts +7 -7
  15. package/dist/bin-list/list.js +55 -64
  16. package/dist/bin-list-mismatches/index.js +24 -29
  17. package/dist/bin-list-mismatches/list-mismatches.d.ts +10 -10
  18. package/dist/bin-list-mismatches/list-mismatches.js +62 -70
  19. package/dist/bin-prompt/index.js +26 -31
  20. package/dist/bin-prompt/prompt.d.ts +4 -4
  21. package/dist/bin-prompt/prompt.js +41 -48
  22. package/dist/bin-set-semver-ranges/index.js +26 -31
  23. package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -4
  24. package/dist/bin-set-semver-ranges/set-semver-ranges.js +26 -30
  25. package/dist/bin-update/effects.d.ts +18 -18
  26. package/dist/bin-update/effects.js +77 -106
  27. package/dist/bin-update/index.js +23 -28
  28. package/dist/bin-update/update.d.ts +5 -5
  29. package/dist/bin-update/update.js +33 -40
  30. package/dist/bin.js +8 -5
  31. package/dist/config/get-custom-types.d.ts +9 -9
  32. package/dist/config/get-custom-types.js +22 -27
  33. package/dist/config/get-enabled-types.d.ts +8 -8
  34. package/dist/config/get-enabled-types.js +42 -48
  35. package/dist/config/get-filter.d.ts +1 -1
  36. package/dist/config/get-filter.js +6 -10
  37. package/dist/config/get-indent.d.ts +1 -1
  38. package/dist/config/get-indent.js +6 -10
  39. package/dist/config/get-sort-az.d.ts +1 -1
  40. package/dist/config/get-sort-az.js +6 -10
  41. package/dist/config/get-sort-exports.d.ts +1 -1
  42. package/dist/config/get-sort-exports.js +6 -10
  43. package/dist/config/get-sort-first.d.ts +1 -1
  44. package/dist/config/get-sort-first.js +6 -10
  45. package/dist/config/get-source.d.ts +1 -1
  46. package/dist/config/get-source.js +4 -8
  47. package/dist/config/tag.d.ts +1 -1
  48. package/dist/config/tag.js +2 -5
  49. package/dist/config/types.d.ts +2 -5
  50. package/dist/config/types.js +1 -2
  51. package/dist/constants.js +7 -10
  52. package/dist/error-handlers/default-error-handlers.d.ts +10 -10
  53. package/dist/error-handlers/default-error-handlers.js +55 -61
  54. package/dist/get-context/index.d.ts +5 -5
  55. package/dist/get-context/index.js +13 -17
  56. package/dist/get-context/lib/key-by.js +1 -5
  57. package/dist/get-instances/index.d.ts +7 -7
  58. package/dist/get-instances/index.js +19 -23
  59. package/dist/get-instances/instance.d.ts +7 -7
  60. package/dist/get-instances/instance.js +4 -8
  61. package/dist/get-package-json-files/get-file-paths.d.ts +7 -7
  62. package/dist/get-package-json-files/get-file-paths.js +10 -15
  63. package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -2
  64. package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +8 -12
  65. package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -2
  66. package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +8 -12
  67. package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -2
  68. package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +14 -18
  69. package/dist/get-package-json-files/get-patterns/index.d.ts +3 -3
  70. package/dist/get-package-json-files/get-patterns/index.js +11 -15
  71. package/dist/get-package-json-files/index.d.ts +8 -8
  72. package/dist/get-package-json-files/index.js +6 -10
  73. package/dist/get-package-json-files/package-json-file.d.ts +6 -6
  74. package/dist/get-package-json-files/package-json-file.js +8 -12
  75. package/dist/guards/can-add-to-group.d.ts +4 -4
  76. package/dist/guards/can-add-to-group.js +10 -14
  77. package/dist/guards/is-semver.js +3 -7
  78. package/dist/guards/is-valid-semver-range.d.ts +1 -1
  79. package/dist/guards/is-valid-semver-range.js +12 -16
  80. package/dist/index.d.ts +1 -1
  81. package/dist/index.js +1 -2
  82. package/dist/io/ask-for-choice.d.ts +5 -5
  83. package/dist/io/ask-for-choice.js +5 -9
  84. package/dist/io/ask-for-input.d.ts +5 -5
  85. package/dist/io/ask-for-input.js +5 -9
  86. package/dist/io/exit-if-invalid.d.ts +3 -3
  87. package/dist/io/exit-if-invalid.js +5 -9
  88. package/dist/io/glob-sync.d.ts +5 -5
  89. package/dist/io/glob-sync.js +4 -9
  90. package/dist/io/index.d.ts +8 -8
  91. package/dist/io/index.js +12 -38
  92. package/dist/io/read-config-file.d.ts +7 -0
  93. package/dist/io/read-config-file.js +22 -0
  94. package/dist/io/read-file-sync.d.ts +5 -5
  95. package/dist/io/read-file-sync.js +4 -9
  96. package/dist/io/read-json-file-sync.d.ts +8 -8
  97. package/dist/io/read-json-file-sync.js +10 -16
  98. package/dist/io/read-yaml-file-sync.d.ts +5 -5
  99. package/dist/io/read-yaml-file-sync.js +4 -8
  100. package/dist/io/to-json.d.ts +2 -2
  101. package/dist/io/to-json.js +8 -12
  102. package/dist/io/write-file-sync.d.ts +5 -5
  103. package/dist/io/write-file-sync.js +5 -10
  104. package/dist/io/write-if-changed.d.ts +4 -4
  105. package/dist/io/write-if-changed.js +9 -16
  106. package/dist/lib/format-repository-url.js +1 -5
  107. package/dist/lib/get-group-header.d.ts +2 -2
  108. package/dist/lib/get-group-header.js +4 -12
  109. package/dist/lib/get.d.ts +10 -10
  110. package/dist/lib/get.js +15 -19
  111. package/dist/lib/pad-start.js +1 -5
  112. package/dist/lib/ring-buffer.js +1 -5
  113. package/dist/lib/set-semver-range.d.ts +1 -1
  114. package/dist/lib/set-semver-range.js +8 -12
  115. package/dist/lib/show-help-on-error.js +3 -10
  116. package/dist/lib/sort-by-name.js +1 -5
  117. package/dist/lib/with-logger.d.ts +1 -1
  118. package/dist/lib/with-logger.js +17 -24
  119. package/dist/option.d.ts +1 -1
  120. package/dist/option.js +8 -14
  121. package/dist/report.d.ts +2 -2
  122. package/dist/report.js +2 -5
  123. package/dist/semver-group/create-semver-groups.d.ts +3 -3
  124. package/dist/semver-group/create-semver-groups.js +28 -32
  125. package/dist/semver-group/disabled.d.ts +11 -11
  126. package/dist/semver-group/disabled.js +6 -10
  127. package/dist/semver-group/filtered-out.d.ts +12 -12
  128. package/dist/semver-group/filtered-out.js +8 -12
  129. package/dist/semver-group/ignored.d.ts +11 -11
  130. package/dist/semver-group/ignored.js +6 -10
  131. package/dist/semver-group/index.d.ts +6 -7
  132. package/dist/semver-group/index.js +4 -7
  133. package/dist/semver-group/with-range.d.ts +11 -11
  134. package/dist/semver-group/with-range.js +13 -17
  135. package/dist/specifier/alias.d.ts +5 -5
  136. package/dist/specifier/alias.js +9 -13
  137. package/dist/specifier/base.d.ts +7 -7
  138. package/dist/specifier/base.js +9 -13
  139. package/dist/specifier/delete.d.ts +5 -5
  140. package/dist/specifier/delete.js +5 -9
  141. package/dist/specifier/exact.d.ts +6 -6
  142. package/dist/specifier/exact.js +7 -11
  143. package/dist/specifier/file.d.ts +1 -1
  144. package/dist/specifier/file.js +2 -6
  145. package/dist/specifier/hosted-git.d.ts +5 -5
  146. package/dist/specifier/hosted-git.js +9 -13
  147. package/dist/specifier/index.d.ts +13 -13
  148. package/dist/specifier/index.js +28 -31
  149. package/dist/specifier/latest.d.ts +6 -6
  150. package/dist/specifier/latest.js +7 -11
  151. package/dist/specifier/lib/non-semver-error.d.ts +5 -5
  152. package/dist/specifier/lib/non-semver-error.js +3 -7
  153. package/dist/specifier/lib/parse-specifier.d.ts +1 -1
  154. package/dist/specifier/lib/parse-specifier.js +4 -11
  155. package/dist/specifier/lib/specific-registry-result.js +1 -2
  156. package/dist/specifier/range.d.ts +6 -6
  157. package/dist/specifier/range.js +7 -11
  158. package/dist/specifier/tag.d.ts +2 -2
  159. package/dist/specifier/tag.js +2 -6
  160. package/dist/specifier/unsupported.d.ts +1 -1
  161. package/dist/specifier/unsupported.js +2 -6
  162. package/dist/specifier/url.d.ts +1 -1
  163. package/dist/specifier/url.js +2 -6
  164. package/dist/specifier/workspace-protocol.d.ts +7 -7
  165. package/dist/specifier/workspace-protocol.js +9 -13
  166. package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
  167. package/dist/strategy/lib/get-non-empty-string-prop.js +6 -10
  168. package/dist/strategy/name-and-version-props.d.ts +4 -4
  169. package/dist/strategy/name-and-version-props.js +19 -23
  170. package/dist/strategy/named-version-string.d.ts +4 -4
  171. package/dist/strategy/named-version-string.js +20 -24
  172. package/dist/strategy/unnamed-version-string.d.ts +4 -4
  173. package/dist/strategy/unnamed-version-string.js +17 -21
  174. package/dist/strategy/versions-by-name.d.ts +4 -4
  175. package/dist/strategy/versions-by-name.js +11 -15
  176. package/dist/version-group/banned.d.ts +7 -7
  177. package/dist/version-group/banned.js +8 -12
  178. package/dist/version-group/create-version-groups.d.ts +3 -3
  179. package/dist/version-group/create-version-groups.js +34 -38
  180. package/dist/version-group/filtered-out.d.ts +8 -8
  181. package/dist/version-group/filtered-out.js +8 -12
  182. package/dist/version-group/ignored.d.ts +7 -7
  183. package/dist/version-group/ignored.js +6 -10
  184. package/dist/version-group/index.d.ts +9 -10
  185. package/dist/version-group/index.js +4 -7
  186. package/dist/version-group/lib/clean.js +4 -11
  187. package/dist/version-group/lib/delete.js +1 -4
  188. package/dist/version-group/lib/get-highest-version.d.ts +2 -2
  189. package/dist/version-group/lib/get-highest-version.js +3 -7
  190. package/dist/version-group/lib/get-lowest-version.d.ts +2 -2
  191. package/dist/version-group/lib/get-lowest-version.js +3 -7
  192. package/dist/version-group/lib/get-preferred-version.d.ts +4 -4
  193. package/dist/version-group/lib/get-preferred-version.js +17 -24
  194. package/dist/version-group/lib/get-range-score.js +13 -17
  195. package/dist/version-group/lib/group-by.js +1 -5
  196. package/dist/version-group/pinned.d.ts +7 -7
  197. package/dist/version-group/pinned.js +8 -12
  198. package/dist/version-group/same-range.d.ts +8 -8
  199. package/dist/version-group/same-range.js +23 -30
  200. package/dist/version-group/snapped-to.d.ts +7 -7
  201. package/dist/version-group/snapped-to.js +20 -24
  202. package/dist/version-group/standard.d.ts +7 -7
  203. package/dist/version-group/standard.js +29 -33
  204. package/package.json +30 -37
  205. package/dist/io/read-config-file-sync.d.ts +0 -7
  206. package/dist/io/read-config-file-sync.js +0 -26
@@ -1,21 +1,16 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const commander_1 = require("commander");
9
- const effect_1 = require("effect");
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
- commander_1.program.on('--help', () => {
18
- console.log((0, chalk_1.default) `
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
- (0, show_help_on_error_1.showHelpOnError)(commander_1.program);
54
- commander_1.program
55
- .option(...option_1.option.source)
56
- .option(...option_1.option.filter)
57
- .option(...option_1.option.config)
58
- .option(...option_1.option.specs)
59
- .option(...option_1.option.types)
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
- effect_1.Effect.runPromise((0, lint_semver_ranges_1.lintSemverRanges)({
62
- io: io_1.io,
56
+ Effect.runPromise(lintSemverRanges({
57
+ io,
63
58
  cli: {
64
- configPath: commander_1.program.opts().config,
65
- filter: commander_1.program.opts().filter,
66
- source: commander_1.program.opts().source,
67
- specs: commander_1.program.opts().specs,
68
- types: commander_1.program.opts().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<never, never, unknown>;
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<never, never, Ctx>;
14
- export declare function logSemverGroupsDisabledWarning(): Effect.Effect<never, never, void>;
15
- export declare function logIgnoredSize(amount: number): Effect.Effect<never, never, void>;
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
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logIgnoredSize = exports.logSemverGroupsDisabledWarning = exports.pipeline = exports.lintSemverRanges = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const effect_1 = require("effect");
9
- const os_1 = require("os");
10
- const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
11
- const tag_1 = require("../config/tag");
12
- const constants_1 = require("../constants");
13
- const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
14
- const get_context_1 = require("../get-context");
15
- const get_instances_1 = require("../get-instances");
16
- const io_1 = require("../io");
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 effect_1.Effect.gen(function* ($) {
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 (!(0, is_non_empty_array_1.isNonEmptyArray)(ctx.config.rcFile.semverGroups)) {
22
+ if (!isNonEmptyArray(ctx.config.rcFile.semverGroups)) {
30
23
  yield* $(logSemverGroupsDisabledWarning());
31
24
  return ctx;
32
25
  }
33
- const { semverGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
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* $(effect_1.Effect.logInfo((0, get_group_header_1.getSemverGroupHeader)({ group, index })));
32
+ yield* $(Effect.logInfo(getSemverGroupHeader({ group, index })));
40
33
  yield* $(logIgnoredSize(groupSize));
41
34
  }
42
35
  else if (group._tag === 'WithRange') {
43
- yield* $(effect_1.Effect.logInfo((0, get_group_header_1.getSemverGroupHeader)({ group, index })));
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
- exports.pipeline = pipeline;
67
- function logSemverGroupsDisabledWarning() {
68
- return effect_1.Effect.logInfo([
69
- (0, chalk_1.default) `{red ${constants_1.ICON.panic} it looks like semver ranges have not yet been configured for this project}`,
70
- (0, chalk_1.default) ` {red see the guide at} {yellow https://jamiemason.github.io/syncpack/guide/semver-groups}`,
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
- exports.logSemverGroupsDisabledWarning = logSemverGroupsDisabledWarning;
74
- function logIgnoredSize(amount) {
75
- const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {dim ${constants_1.ICON.skip}} ${amount} ignored`;
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 = (0, chalk_1.default) `{green ${constants_1.ICON.tick}} {dim ${amount} valid}`;
81
- return effect_1.Effect.logInfo(msg);
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 effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
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 effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross} name {white ${name}} or version {white ${actual}} are not supported} {gray ${filePath} > ${propPath}} {blue [${_tag}]}`);
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
  }
@@ -1,19 +1,14 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const commander_1 = require("commander");
9
- const effect_1 = require("effect");
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_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
- (0, show_help_on_error_1.showHelpOnError)(commander_1.program);
46
- commander_1.program
47
- .option(...option_1.option.source)
48
- .option(...option_1.option.filter)
49
- .option(...option_1.option.config)
50
- .option(...option_1.option.specs)
51
- .option(...option_1.option.types)
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
- effect_1.Effect.runPromise((0, list_1.list)({
54
- io: io_1.io,
48
+ Effect.runPromise(list({
49
+ io,
55
50
  cli: {
56
- configPath: commander_1.program.opts().config,
57
- filter: commander_1.program.opts().filter,
58
- source: commander_1.program.opts().source,
59
- specs: commander_1.program.opts().specs,
60
- types: commander_1.program.opts().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
  }));
@@ -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<never, never, unknown>;
12
- export declare function pipeline(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<never, never, Ctx>;
13
- export declare function logOtherCommands(): Effect.Effect<never, never, void>;
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 {};
@@ -1,32 +1,25 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.logOtherCommands = exports.pipeline = exports.list = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const effect_1 = require("effect");
9
- const os_1 = require("os");
10
- const tag_1 = require("../config/tag");
11
- const constants_1 = require("../constants");
12
- const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
13
- const get_context_1 = require("../get-context");
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 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
- exports.list = list;
24
- function pipeline(ctx, io, errorHandlers) {
25
- return effect_1.Effect.gen(function* ($) {
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* $(effect_1.Effect.logInfo((0, get_group_header_1.getVersionGroupHeader)({ group, index })));
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((0, chalk_1.default) `{gray ${actual}}`);
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 effect_1.Effect.gen(function* ($) {
67
+ return Effect.gen(function* ($) {
76
68
  for (const groupReport of yield* $(group.inspectAll())) {
77
69
  const name = groupReport.name;
78
- const usages = `${(0, pad_start_1.padStart)(groupReport.reports.length)}x`;
79
- const invalidLabel = (0, chalk_1.default) `{gray ${usages}} {red ${name}}`;
80
- const msg = (0, chalk_1.default) `${invalidLabel} {gray [Banned]}`;
81
- yield* $(effect_1.Effect.logInfo(msg));
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 effect_1.Effect.gen(function* ($) {
78
+ return Effect.gen(function* ($) {
87
79
  for (const groupReport of yield* $(group.inspectAll())) {
88
80
  const name = groupReport.name;
89
- const usages = `${(0, pad_start_1.padStart)(groupReport.reports.length)}x`;
90
- const invalidLabel = (0, chalk_1.default) `{gray ${usages}} {gray ${name}}`;
91
- const msg = (0, chalk_1.default) `${invalidLabel} {gray [FilteredOut]}`;
92
- yield* $(effect_1.Effect.logInfo(msg));
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 effect_1.Effect.gen(function* ($) {
89
+ return Effect.gen(function* ($) {
98
90
  for (const groupReport of yield* $(group.inspectAll())) {
99
91
  const name = groupReport.name;
100
- const usages = `${(0, pad_start_1.padStart)(groupReport.reports.length)}x`;
101
- const invalidLabel = (0, chalk_1.default) `{gray ${usages}} {gray ${name}}`;
102
- const msg = (0, chalk_1.default) `${invalidLabel} {gray [Ignored]}`;
103
- yield* $(effect_1.Effect.logInfo(msg));
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 effect_1.Effect.unit;
100
+ return Effect.void;
109
101
  },
110
102
  SameRange(_group) {
111
- return effect_1.Effect.unit;
103
+ return Effect.void;
112
104
  },
113
105
  SnappedTo(_group) {
114
- return effect_1.Effect.unit;
106
+ return Effect.void;
115
107
  },
116
108
  Standard(_group) {
117
- return effect_1.Effect.unit;
109
+ return Effect.void;
118
110
  },
119
111
  };
120
112
  function logMatchingReport(groupReport, messages) {
121
113
  const name = groupReport.name;
122
- const usages = `${(0, pad_start_1.padStart)(groupReport.reports.length)}x`;
123
- const label = (0, chalk_1.default) `{gray ${usages}} ${name}{gray :}`;
124
- return effect_1.Effect.logInfo((0, chalk_1.default) `${label} ${[...messages].join((0, chalk_1.default) `{gray , }`)}`);
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 = `${(0, pad_start_1.padStart)(groupReport.reports.length)}x`;
129
- const label = (0, chalk_1.default) `{gray ${usages}} {red ${name}}{gray :}`;
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 effect_1.Effect.logInfo((0, chalk_1.default) `${label}${['', ...messages].join((0, chalk_1.default) `${os_1.EOL}${indent} {red ${constants_1.ICON.cross}} `)}`);
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 (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {green ${expected}} {gray [${_tag}]}`;
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 (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {gray [${_tag}]}`;
134
+ return chalk `{red ${actual}} {gray ${ICON.rightArrow}} {gray [${_tag}]}`;
143
135
  }
144
- function logOtherCommands() {
145
- return effect_1.Effect.logInfo([
136
+ export function logOtherCommands() {
137
+ return Effect.logInfo([
146
138
  '',
147
139
  ' What next?',
148
- (0, chalk_1.default) `{dim -} {yellow syncpack list-mismatches} to see more detail about mismatching versions`,
149
- (0, chalk_1.default) `{dim -} {yellow syncpack fix-mismatches} to fix version mismatches automatically`,
150
- (0, chalk_1.default) `{dim -} {yellow syncpack format} to sort and prettify your package.json files`,
151
- (0, chalk_1.default) `{dim -} {yellow syncpack update} to choose updates from the npm registry`,
152
- (0, chalk_1.default) `{dim -} {yellow syncpack --help} for everything else`,
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(os_1.EOL));
146
+ ].join(EOL));
155
147
  }
156
- exports.logOtherCommands = logOtherCommands;
@@ -1,21 +1,16 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const commander_1 = require("commander");
9
- const effect_1 = require("effect");
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
- commander_1.program.on('--help', () => {
18
- console.log((0, chalk_1.default) `
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
- (0, show_help_on_error_1.showHelpOnError)(commander_1.program);
48
- commander_1.program
49
- .option(...option_1.option.source)
50
- .option(...option_1.option.filter)
51
- .option(...option_1.option.config)
52
- .option(...option_1.option.specs)
53
- .option(...option_1.option.types)
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
- effect_1.Effect.runPromise((0, list_mismatches_1.listMismatches)({
56
- io: io_1.io,
50
+ Effect.runPromise(listMismatches({
51
+ io,
57
52
  cli: {
58
- configPath: commander_1.program.opts().config,
59
- filter: commander_1.program.opts().filter,
60
- source: commander_1.program.opts().source,
61
- specs: commander_1.program.opts().specs,
62
- types: commander_1.program.opts().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<never, never, unknown>;
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<never, never, Ctx>;
14
- export declare const logMissingLocalVersion: (report: any) => Effect.Effect<never, never, void>;
15
- export declare const logMissingSnappedToMismatch: (report: any) => Effect.Effect<never, never, void>;
16
- export declare const logUnsupportedMismatch: (report: any) => Effect.Effect<never, never, void>;
17
- export declare const logSameRangeMismatch: (report: any) => Effect.Effect<never, never, void>;
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 {};