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,30 +1,23 @@
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.logSameRangeMismatch = exports.logUnsupportedMismatch = exports.logMissingSnappedToMismatch = exports.logMissingLocalVersion = exports.pipeline = exports.listMismatches = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const effect_1 = require("effect");
9
- const os_1 = require("os");
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 listMismatches({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
21
- return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.flatMap((ctx) => pipeline(ctx, io, errorHandlers)), effect_1.Effect.flatMap(exit_if_invalid_1.exitIfInvalid), effect_1.Effect.provide((0, effect_1.pipe)(effect_1.Context.empty(), effect_1.Context.add(tag_1.CliConfigTag, cli), effect_1.Context.add(io_1.IoTag, io))), with_logger_1.withLogger);
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 listMismatches({ 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.listMismatches = listMismatches;
24
17
  /** Exported to be reused by `syncpack lint` */
25
- function pipeline(ctx, io, errorHandlers) {
26
- return effect_1.Effect.gen(function* ($) {
27
- const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
18
+ export function pipeline(ctx, io, errorHandlers) {
19
+ return Effect.gen(function* ($) {
20
+ const { versionGroups } = yield* $(getInstances(ctx, io, errorHandlers));
28
21
  let index = 0;
29
22
  for (const group of versionGroups) {
30
23
  const countByReportGroup = {
@@ -33,7 +26,7 @@ function pipeline(ctx, io, errorHandlers) {
33
26
  Unfixable: 0,
34
27
  Valid: 0,
35
28
  };
36
- yield* $(effect_1.Effect.logInfo((0, get_group_header_1.getVersionGroupHeader)({ group, index })));
29
+ yield* $(Effect.logInfo(getVersionGroupHeader({ group, index })));
37
30
  for (const groupReport of yield* $(group.inspectAll())) {
38
31
  for (const report of groupReport.reports) {
39
32
  countByReportGroup[report._tagGroup]++;
@@ -53,31 +46,30 @@ function pipeline(ctx, io, errorHandlers) {
53
46
  return ctx;
54
47
  });
55
48
  }
56
- exports.pipeline = pipeline;
57
49
  const onReportGroup = {
58
50
  Excluded(amount) {
59
51
  if (amount === 0)
60
- return effect_1.Effect.unit;
61
- const msg = (0, chalk_1.default) `{gray ${(0, pad_start_1.padStart)(amount)} ${constants_1.ICON.rightArrow} ignored}`;
62
- return effect_1.Effect.logInfo(msg);
52
+ return Effect.void;
53
+ const msg = chalk `{gray ${padStart(amount)} ${ICON.rightArrow} ignored}`;
54
+ return Effect.logInfo(msg);
63
55
  },
64
56
  Fixable(amount) {
65
57
  if (amount === 0)
66
- return effect_1.Effect.unit;
67
- const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} can be auto-fixed`;
68
- return effect_1.Effect.logInfo(msg);
58
+ return Effect.void;
59
+ const msg = chalk `${padStart(amount)} {green ${ICON.tick}} can be auto-fixed`;
60
+ return Effect.logInfo(msg);
69
61
  },
70
62
  Unfixable(amount) {
71
63
  if (amount === 0)
72
- return effect_1.Effect.unit;
73
- const msg = (0, chalk_1.default) `{red ${(0, pad_start_1.padStart)(amount)} ${constants_1.ICON.panic} can be fixed manually using} {blue syncpack prompt}`;
74
- return effect_1.Effect.logInfo(msg);
64
+ return Effect.void;
65
+ const msg = chalk `{red ${padStart(amount)} ${ICON.panic} can be fixed manually using} {blue syncpack prompt}`;
66
+ return Effect.logInfo(msg);
75
67
  },
76
68
  Valid(amount) {
77
69
  if (amount === 0)
78
- return effect_1.Effect.unit;
79
- const msg = (0, chalk_1.default) `${(0, pad_start_1.padStart)(amount)} {green ${constants_1.ICON.tick}} already valid`;
80
- return effect_1.Effect.logInfo(msg);
70
+ return Effect.void;
71
+ const msg = chalk `${padStart(amount)} {green ${ICON.tick}} already valid`;
72
+ return Effect.logInfo(msg);
81
73
  },
82
74
  };
83
75
  const onReportTag = {
@@ -88,13 +80,13 @@ const onReportTag = {
88
80
  const jsonFile = instance.packageJsonFile.jsonFile;
89
81
  const path = instance.strategy.path;
90
82
  const shortPath = jsonFile.shortPath;
91
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red banned} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
83
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red banned} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
92
84
  },
93
85
  Disabled(_report) {
94
- return effect_1.Effect.unit;
86
+ return Effect.void;
95
87
  },
96
88
  FilteredOut(_report) {
97
- return effect_1.Effect.unit;
89
+ return Effect.void;
98
90
  },
99
91
  HighestSemverMismatch(report) {
100
92
  const _tag = report._tag;
@@ -106,10 +98,10 @@ const onReportTag = {
106
98
  const name = instance.name;
107
99
  const path = instance.strategy.path;
108
100
  const shortPath = jsonFile.shortPath;
109
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
101
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
110
102
  },
111
103
  Ignored(_report) {
112
- return effect_1.Effect.unit;
104
+ return Effect.void;
113
105
  },
114
106
  LocalPackageMismatch(report) {
115
107
  const _tag = report._tag;
@@ -120,7 +112,7 @@ const onReportTag = {
120
112
  const name = instance.name;
121
113
  const path = instance.strategy.path;
122
114
  const shortPath = instance.packageJsonFile.jsonFile.shortPath;
123
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
115
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
124
116
  },
125
117
  LowestSemverMismatch(report) {
126
118
  const _tag = report._tag;
@@ -131,7 +123,7 @@ const onReportTag = {
131
123
  const name = instance.name;
132
124
  const path = instance.strategy.path;
133
125
  const shortPath = instance.packageJsonFile.jsonFile.shortPath;
134
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
126
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
135
127
  },
136
128
  MissingLocalVersion(report) {
137
129
  const instance = report.unfixable;
@@ -141,10 +133,10 @@ const onReportTag = {
141
133
  const name = instance.name;
142
134
  const path = instance.strategy.path;
143
135
  const shortPath = jsonFile.shortPath;
144
- return effect_1.Effect.logInfo([
145
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingLocalVersion]}`,
146
- (0, chalk_1.default) ` {red ${localPath} does not have a .version property which is exact semver}`,
147
- ].join(os_1.EOL));
136
+ return Effect.logInfo([
137
+ chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingLocalVersion]}`,
138
+ chalk ` {red ${localPath} does not have a .version property which is exact semver}`,
139
+ ].join(EOL));
148
140
  },
149
141
  MissingSnappedToMismatch(report) {
150
142
  const instance = report.unfixable;
@@ -153,10 +145,10 @@ const onReportTag = {
153
145
  const name = instance.name;
154
146
  const path = instance.strategy.path;
155
147
  const shortPath = jsonFile.shortPath;
156
- return effect_1.Effect.logInfo([
157
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingSnappedToMismatch]}`,
158
- (0, chalk_1.default) ` {red no package in this groups .snapTo array depend on ${name}}`,
159
- ].join(os_1.EOL));
148
+ return Effect.logInfo([
149
+ chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [MissingSnappedToMismatch]}`,
150
+ chalk ` {red no package in this groups .snapTo array depend on ${name}}`,
151
+ ].join(EOL));
160
152
  },
161
153
  PinnedMismatch(report) {
162
154
  const _tag = report._tag;
@@ -167,7 +159,7 @@ const onReportTag = {
167
159
  const name = instance.name;
168
160
  const path = instance.strategy.path;
169
161
  const shortPath = instance.packageJsonFile.jsonFile.shortPath;
170
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
162
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
171
163
  },
172
164
  SameRangeMismatch(report) {
173
165
  const instance = report.unfixable;
@@ -177,10 +169,10 @@ const onReportTag = {
177
169
  const path = instance.strategy.path;
178
170
  const shortPath = jsonFile.shortPath;
179
171
  const mismatches = report.mismatches;
180
- return effect_1.Effect.logInfo([
181
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red range ${actual} does not include ${mismatches.join(', ')}} {gray ${shortPath} > ${path}} {blue [SameRangeMismatch]}`,
182
- (0, chalk_1.default) ` {gray use {blue syncpack prompt} to fix this manually}`,
183
- ].join(os_1.EOL));
172
+ return Effect.logInfo([
173
+ chalk `{red ${ICON.cross}} ${name} {red range ${actual} does not include ${mismatches.join(', ')}} {gray ${shortPath} > ${path}} {blue [SameRangeMismatch]}`,
174
+ chalk ` {gray use {blue syncpack prompt} to fix this manually}`,
175
+ ].join(EOL));
184
176
  },
185
177
  SemverRangeMismatch(report) {
186
178
  const _tag = report._tag;
@@ -191,7 +183,7 @@ const onReportTag = {
191
183
  const name = instance.name;
192
184
  const path = instance.strategy.path;
193
185
  const shortPath = instance.packageJsonFile.jsonFile.shortPath;
194
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
186
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
195
187
  },
196
188
  SnappedToMismatch(report) {
197
189
  const _tag = report._tag;
@@ -202,7 +194,7 @@ const onReportTag = {
202
194
  const name = instance.name;
203
195
  const path = instance.strategy.path;
204
196
  const shortPath = instance.packageJsonFile.jsonFile.shortPath;
205
- return effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
197
+ return Effect.logInfo(chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {green ${expected}} {gray ${shortPath} > ${path}} {blue [${_tag}]}`);
206
198
  },
207
199
  UnsupportedMismatch(report) {
208
200
  const instance = report.unfixable;
@@ -211,16 +203,16 @@ const onReportTag = {
211
203
  const name = instance.name;
212
204
  const path = instance.strategy.path;
213
205
  const shortPath = jsonFile.shortPath;
214
- return effect_1.Effect.logInfo([
215
- (0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${name} {red ${actual}} {dim ${constants_1.ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [UnsupportedMismatch]}`,
216
- (0, chalk_1.default) ` {red use {blue syncpack prompt} to fix this manually}`,
217
- ].join(os_1.EOL));
206
+ return Effect.logInfo([
207
+ chalk `{red ${ICON.cross}} ${name} {red ${actual}} {dim ${ICON.rightArrow}} {red ???} {gray ${shortPath} > ${path}} {blue [UnsupportedMismatch]}`,
208
+ chalk ` {red use {blue syncpack prompt} to fix this manually}`,
209
+ ].join(EOL));
218
210
  },
219
211
  Valid(_report) {
220
- return effect_1.Effect.unit;
212
+ return Effect.void;
221
213
  },
222
214
  };
223
- exports.logMissingLocalVersion = onReportTag.MissingLocalVersion;
224
- exports.logMissingSnappedToMismatch = onReportTag.MissingSnappedToMismatch;
225
- exports.logUnsupportedMismatch = onReportTag.UnsupportedMismatch;
226
- exports.logSameRangeMismatch = onReportTag.SameRangeMismatch;
215
+ export const logMissingLocalVersion = onReportTag.MissingLocalVersion;
216
+ export const logMissingSnappedToMismatch = onReportTag.MissingSnappedToMismatch;
217
+ export const logUnsupportedMismatch = onReportTag.UnsupportedMismatch;
218
+ export const logSameRangeMismatch = onReportTag.SameRangeMismatch;
@@ -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 prompt_1 = require("./prompt");
14
- commander_1.program.description(' displays a series of prompts to fix mismatches which syncpack cannot fix automatically');
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 { prompt } from './prompt.js';
9
+ program.description(' displays a series of prompts to fix mismatches which syncpack cannot fix automatically');
10
+ program.on('--help', () => {
11
+ console.log(chalk `
17
12
  Examples:
18
13
  {dim # uses defaults for resolving packages}
19
14
  syncpack prompt
@@ -44,23 +39,23 @@ 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)
54
- .option(...option_1.option.indent)
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
+ .option(...option.indent)
55
50
  .parse(process.argv);
56
- effect_1.Effect.runPromise((0, prompt_1.prompt)({
57
- io: io_1.io,
51
+ Effect.runPromise(prompt({
52
+ io,
58
53
  cli: {
59
- configPath: commander_1.program.opts().config,
60
- filter: commander_1.program.opts().filter,
61
- source: commander_1.program.opts().source,
62
- specs: commander_1.program.opts().specs,
63
- types: commander_1.program.opts().types,
64
- indent: commander_1.program.opts().indent,
54
+ configPath: program.opts().config,
55
+ filter: program.opts().filter,
56
+ source: program.opts().source,
57
+ specs: program.opts().specs,
58
+ types: program.opts().types,
59
+ indent: program.opts().indent,
65
60
  },
66
61
  }));
@@ -1,11 +1,11 @@
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 { 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 { Io } from '../io/index.js';
5
5
  interface Input {
6
6
  io: Io;
7
7
  cli: Partial<CliConfig>;
8
8
  errorHandlers?: ErrorHandlers;
9
9
  }
10
- export declare function prompt({ io, cli, errorHandlers }: Input): Effect.Effect<never, never, unknown>;
10
+ export declare function prompt({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
11
11
  export {};
@@ -1,29 +1,23 @@
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.prompt = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const effect_1 = require("effect");
9
- const uniq_1 = require("tightrope/array/uniq");
10
- const is_string_1 = require("tightrope/guard/is-string");
11
- const list_1 = require("../bin-list/list");
12
- const tag_1 = require("../config/tag");
13
- const constants_1 = require("../constants");
14
- const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
15
- const get_context_1 = require("../get-context");
16
- const get_instances_1 = require("../get-instances");
17
- const io_1 = require("../io");
18
- const ask_for_choice_1 = require("../io/ask-for-choice");
19
- const ask_for_input_1 = require("../io/ask-for-input");
20
- const exit_if_invalid_1 = require("../io/exit-if-invalid");
21
- const write_if_changed_1 = require("../io/write-if-changed");
22
- const get_group_header_1 = require("../lib/get-group-header");
23
- const with_logger_1 = require("../lib/with-logger");
24
- function prompt({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
25
- return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)(effect_1.Effect.gen(function* ($) {
26
- const { versionGroups } = yield* $((0, get_instances_1.getInstances)(ctx, io, errorHandlers));
1
+ import chalk from 'chalk-template';
2
+ import { Context, Effect, flow, pipe } from 'effect';
3
+ import { uniq } from 'tightrope/array/uniq.js';
4
+ import { isString } from 'tightrope/guard/is-string.js';
5
+ import { logOtherCommands } from '../bin-list/list.js';
6
+ import { CliConfigTag } from '../config/tag.js';
7
+ import { ICON } from '../constants.js';
8
+ import { defaultErrorHandlers } from '../error-handlers/default-error-handlers.js';
9
+ import { getContext } from '../get-context/index.js';
10
+ import { getInstances } from '../get-instances/index.js';
11
+ import { askForChoice } from '../io/ask-for-choice.js';
12
+ import { askForInput } from '../io/ask-for-input.js';
13
+ import { exitIfInvalid } from '../io/exit-if-invalid.js';
14
+ import { IoTag } from '../io/index.js';
15
+ import { writeIfChanged } from '../io/write-if-changed.js';
16
+ import { getVersionGroupHeader } from '../lib/get-group-header.js';
17
+ import { withLogger } from '../lib/with-logger.js';
18
+ export function prompt({ io, cli, errorHandlers = defaultErrorHandlers }) {
19
+ return pipe(getContext({ io, cli, errorHandlers }), Effect.flatMap((ctx) => pipe(Effect.gen(function* ($) {
20
+ const { versionGroups } = yield* $(getInstances(ctx, io, errorHandlers));
27
21
  let unfixableCount = 0;
28
22
  let index = 0;
29
23
  for (const group of versionGroups) {
@@ -36,29 +30,28 @@ function prompt({ io, cli, errorHandlers = default_error_handlers_1.defaultError
36
30
  }
37
31
  if (unfixable.length) {
38
32
  unfixableCount += unfixable.length;
39
- effect_1.Effect.logInfo((0, get_group_header_1.getVersionGroupHeader)({ group, index }));
33
+ Effect.logInfo(getVersionGroupHeader({ group, index }));
40
34
  yield* $(askForNextVersion(groupReport, unfixable));
41
35
  }
42
36
  }
43
37
  index++;
44
38
  }
45
39
  if (unfixableCount) {
46
- yield* $((0, write_if_changed_1.writeIfChanged)(ctx));
40
+ yield* $(writeIfChanged(ctx));
47
41
  }
48
42
  else {
49
- const msg = (0, chalk_1.default) `{green ${constants_1.ICON.tick}} no issues which syncpack cannot fix automatically`;
50
- yield* $(effect_1.Effect.logInfo(msg));
51
- yield* $((0, list_1.logOtherCommands)());
43
+ const msg = chalk `{green ${ICON.tick}} no issues which syncpack cannot fix automatically`;
44
+ yield* $(Effect.logInfo(msg));
45
+ yield* $(logOtherCommands());
52
46
  }
53
47
  return ctx;
54
- }), effect_1.Effect.catchTags({
55
- WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
48
+ }), Effect.catchTags({
49
+ WriteFileError: flow(errorHandlers.WriteFileError, Effect.map(() => {
56
50
  ctx.isInvalid = true;
57
51
  return ctx;
58
52
  })),
59
- }), 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);
53
+ }), Effect.flatMap(exitIfInvalid))), Effect.provide(pipe(Context.empty(), Context.add(CliConfigTag, cli), Context.add(IoTag, io))), withLogger);
60
54
  }
61
- exports.prompt = prompt;
62
55
  function isUnfixable(report) {
63
56
  return (report._tag === 'MissingLocalVersion' ||
64
57
  report._tag === 'MissingSnappedToMismatch' ||
@@ -66,19 +59,19 @@ function isUnfixable(report) {
66
59
  report._tag === 'UnsupportedMismatch');
67
60
  }
68
61
  function askForNextVersion(groupReport, unfixable) {
69
- return (0, effect_1.pipe)(effect_1.Effect.gen(function* ($) {
70
- const choices = (0, uniq_1.uniq)(groupReport.reports.map((report) => report._tagGroup === 'Fixable'
62
+ return pipe(Effect.gen(function* ($) {
63
+ const choices = uniq(groupReport.reports.map((report) => report._tagGroup === 'Fixable'
71
64
  ? report.fixable.raw
72
65
  : report._tagGroup === 'Unfixable'
73
66
  ? report.unfixable.rawSpecifier
74
67
  : report._tagGroup === 'Valid'
75
68
  ? report.specifier.raw
76
- : null)).filter(is_string_1.isString);
77
- const OTHER = chalk_1.default.dim('Other');
78
- const SKIP = chalk_1.default.dim('Skip');
79
- const QUIT = chalk_1.default.dim('Quit');
69
+ : null)).filter(isString);
70
+ const OTHER = chalk `{dim Other}`;
71
+ const SKIP = chalk `{dim Skip}`;
72
+ const QUIT = chalk `{dim Quit}`;
80
73
  // Ask user to choose a version to align on
81
- const choice = yield* $((0, ask_for_choice_1.askForChoice)({
74
+ const choice = yield* $(askForChoice({
82
75
  message: groupReport.name,
83
76
  choices: [...choices, OTHER, SKIP, QUIT],
84
77
  }));
@@ -88,13 +81,13 @@ function askForNextVersion(groupReport, unfixable) {
88
81
  if (choice === QUIT)
89
82
  return process.exit(0);
90
83
  const nextVersion = choice === OTHER
91
- ? yield* $((0, ask_for_input_1.askForInput)({
92
- message: (0, chalk_1.default) `${groupReport.name} {dim Enter a replacement version}`,
84
+ ? yield* $(askForInput({
85
+ message: chalk `${groupReport.name} {dim Enter a replacement version}`,
93
86
  }))
94
87
  : choice;
95
- yield* $((0, effect_1.pipe)(unfixable, effect_1.Effect.forEach((report) => report.unfixable.write(nextVersion))));
96
- }), effect_1.Effect.catchTags({
97
- AskForChoiceError: effect_1.Effect.logDebug,
98
- AskForInputError: effect_1.Effect.logDebug,
88
+ yield* $(pipe(unfixable, Effect.forEach((report) => report.unfixable.write(nextVersion))));
89
+ }), Effect.catchTags({
90
+ AskForChoiceError: Effect.logDebug,
91
+ AskForInputError: Effect.logDebug,
99
92
  }));
100
93
  }
@@ -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 set_semver_ranges_1 = require("./set-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 { setSemverRanges } from './set-semver-ranges.js';
9
+ program.description(chalk `
15
10
  Ensure 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 set-semver-ranges
@@ -52,23 +47,23 @@ Reference:
52
47
  Pnpm Workspaces {blue.underline https://pnpm.js.org/en/workspaces}
53
48
  `);
54
49
  });
55
- (0, show_help_on_error_1.showHelpOnError)(commander_1.program);
56
- commander_1.program
57
- .option(...option_1.option.source)
58
- .option(...option_1.option.filter)
59
- .option(...option_1.option.config)
60
- .option(...option_1.option.specs)
61
- .option(...option_1.option.types)
62
- .option(...option_1.option.indent)
50
+ showHelpOnError(program);
51
+ program
52
+ .option(...option.source)
53
+ .option(...option.filter)
54
+ .option(...option.config)
55
+ .option(...option.specs)
56
+ .option(...option.types)
57
+ .option(...option.indent)
63
58
  .parse(process.argv);
64
- effect_1.Effect.runPromise((0, set_semver_ranges_1.setSemverRanges)({
65
- io: io_1.io,
59
+ Effect.runPromise(setSemverRanges({
60
+ io,
66
61
  cli: {
67
- configPath: commander_1.program.opts().config,
68
- filter: commander_1.program.opts().filter,
69
- indent: commander_1.program.opts().indent,
70
- source: commander_1.program.opts().source,
71
- specs: commander_1.program.opts().specs,
72
- types: commander_1.program.opts().types,
62
+ configPath: program.opts().config,
63
+ filter: program.opts().filter,
64
+ indent: program.opts().indent,
65
+ source: program.opts().source,
66
+ specs: program.opts().specs,
67
+ types: program.opts().types,
73
68
  },
74
69
  }));
@@ -1,11 +1,11 @@
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 { 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 { Io } from '../io/index.js';
5
5
  interface Input {
6
6
  io: Io;
7
7
  cli: Partial<CliConfig>;
8
8
  errorHandlers?: ErrorHandlers;
9
9
  }
10
- export declare function setSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<never, never, unknown>;
10
+ export declare function setSemverRanges({ io, cli, errorHandlers }: Input): Effect.Effect<unknown, never, never>;
11
11
  export {};