syncpack 12.1.0 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +5 -5
  2. package/dist/bin-fix-mismatches/index.js +2 -0
  3. package/dist/bin-format/format.d.ts +2 -0
  4. package/dist/bin-format/format.js +66 -36
  5. package/dist/bin-lint/lint.js +40 -1
  6. package/dist/bin-lint-semver-ranges/index.js +2 -0
  7. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +2 -2
  8. package/dist/bin-list/index.js +2 -0
  9. package/dist/bin-list/list.js +2 -2
  10. package/dist/bin-list-mismatches/index.js +2 -0
  11. package/dist/bin-list-mismatches/list-mismatches.js +10 -10
  12. package/dist/bin-prompt/index.js +2 -0
  13. package/dist/bin-set-semver-ranges/index.js +2 -0
  14. package/dist/bin-update/effects.js +6 -6
  15. package/dist/bin-update/index.js +2 -0
  16. package/dist/bin-update/update.js +3 -3
  17. package/dist/config/get-filter.js +2 -1
  18. package/dist/config/get-indent.js +2 -1
  19. package/dist/config/get-sort-az.js +4 -11
  20. package/dist/config/get-sort-exports.d.ts +2 -0
  21. package/dist/config/get-sort-exports.js +12 -0
  22. package/dist/config/get-sort-first.js +4 -2
  23. package/dist/config/types.d.ts +25 -2
  24. package/dist/constants.d.ts +62 -23
  25. package/dist/constants.js +52 -32
  26. package/dist/get-instances/instance.d.ts +2 -1
  27. package/dist/get-instances/instance.js +4 -3
  28. package/dist/guards/can-add-to-group.js +14 -7
  29. package/dist/io/to-json.d.ts +9 -0
  30. package/dist/io/to-json.js +33 -0
  31. package/dist/io/write-if-changed.d.ts +0 -6
  32. package/dist/io/write-if-changed.js +3 -31
  33. package/dist/option.d.ts +1 -0
  34. package/dist/option.js +4 -0
  35. package/dist/schema.json +160 -12
  36. package/dist/semver-group/create-semver-groups.js +6 -0
  37. package/dist/semver-group/with-range.d.ts +1 -1
  38. package/dist/semver-group/with-range.js +3 -3
  39. package/dist/specifier/alias.d.ts +2 -0
  40. package/dist/specifier/alias.js +3 -1
  41. package/dist/specifier/base.d.ts +4 -2
  42. package/dist/specifier/base.js +3 -1
  43. package/dist/specifier/delete.d.ts +4 -2
  44. package/dist/specifier/delete.js +3 -1
  45. package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
  46. package/dist/specifier/{version.js → exact.js} +6 -4
  47. package/dist/specifier/file.d.ts +2 -0
  48. package/dist/specifier/file.js +3 -1
  49. package/dist/specifier/hosted-git.d.ts +2 -0
  50. package/dist/specifier/hosted-git.js +3 -1
  51. package/dist/specifier/index.d.ts +5 -3
  52. package/dist/specifier/index.js +7 -3
  53. package/dist/specifier/latest.d.ts +19 -0
  54. package/dist/specifier/latest.js +24 -0
  55. package/dist/specifier/range.d.ts +2 -1
  56. package/dist/specifier/range.js +3 -2
  57. package/dist/specifier/tag.d.ts +2 -0
  58. package/dist/specifier/tag.js +3 -1
  59. package/dist/specifier/unsupported.d.ts +2 -0
  60. package/dist/specifier/unsupported.js +3 -1
  61. package/dist/specifier/url.d.ts +2 -0
  62. package/dist/specifier/url.js +3 -1
  63. package/dist/specifier/workspace-protocol.d.ts +2 -0
  64. package/dist/specifier/workspace-protocol.js +3 -1
  65. package/dist/version-group/create-version-groups.js +11 -0
  66. package/dist/version-group/pinned.js +1 -1
  67. package/dist/version-group/same-range.js +5 -5
  68. package/dist/version-group/snapped-to.js +5 -5
  69. package/dist/version-group/standard.js +9 -9
  70. package/package.json +6 -6
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # syncpack
2
2
 
3
- > Consistent dependency versions in large JavaScript Monorepos.
3
+ <p align="center">
4
+ <img src="https://jamiemason.github.io/syncpack/logo.svg" width="200" height="179" alt="">
5
+ <br>Consistent dependency versions in large JavaScript Monorepos.
6
+ <br><a href="https://jamiemason.github.io/syncpack">https://jamiemason.github.io/syncpack</a>
7
+ </p>
4
8
 
5
9
  ## Installation
6
10
 
@@ -8,10 +12,6 @@
8
12
  npm install --save-dev syncpack
9
13
  ```
10
14
 
11
- ## Documentation
12
-
13
- Full information can be found in the documentation at https://jamiemason.github.io/syncpack/.
14
-
15
15
  ## Commands
16
16
 
17
17
  ### [fix-mismatches](https://jamiemason.github.io/syncpack/command/fix-mismatches)
@@ -51,6 +51,7 @@ Reference:
51
51
  commander_1.program
52
52
  .option(...option_1.option.source)
53
53
  .option(...option_1.option.filter)
54
+ .option(...option_1.option.specs)
54
55
  .option(...option_1.option.types)
55
56
  .option(...option_1.option.config)
56
57
  .option(...option_1.option.indent)
@@ -62,6 +63,7 @@ effect_1.Effect.runPromise((0, fix_mismatches_1.fixMismatches)({
62
63
  filter: commander_1.program.opts().filter,
63
64
  indent: commander_1.program.opts().indent,
64
65
  source: commander_1.program.opts().source,
66
+ specs: commander_1.program.opts().specs,
65
67
  types: commander_1.program.opts().types,
66
68
  },
67
69
  }));
@@ -1,6 +1,7 @@
1
1
  import { Effect } from 'effect';
2
2
  import { type CliConfig } from '../config/types';
3
3
  import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
4
+ import type { Ctx } from '../get-context';
4
5
  import type { Io } from '../io';
5
6
  interface Input {
6
7
  io: Io;
@@ -8,4 +9,5 @@ interface Input {
8
9
  errorHandlers?: ErrorHandlers;
9
10
  }
10
11
  export declare function format({ io, cli, errorHandlers }: Input): Effect.Effect<never, never, unknown>;
12
+ export declare function pipeline(ctx: Ctx): Effect.Effect<never, never, Ctx>;
11
13
  export {};
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.format = void 0;
3
+ exports.pipeline = exports.format = void 0;
4
4
  const effect_1 = require("effect");
5
5
  const is_array_1 = require("tightrope/guard/is-array");
6
6
  const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
7
  const is_object_1 = require("tightrope/guard/is-object");
8
8
  const get_sort_az_1 = require("../config/get-sort-az");
9
+ const get_sort_exports_1 = require("../config/get-sort-exports");
9
10
  const get_sort_first_1 = require("../config/get-sort-first");
10
11
  const tag_1 = require("../config/tag");
11
12
  const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
@@ -15,50 +16,79 @@ const exit_if_invalid_1 = require("../io/exit-if-invalid");
15
16
  const write_if_changed_1 = require("../io/write-if-changed");
16
17
  const with_logger_1 = require("../lib/with-logger");
17
18
  function format({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
18
- return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.map((ctx) => {
19
- const { packageJsonFiles } = ctx;
20
- const sortAz = (0, get_sort_az_1.getSortAz)(ctx.config);
21
- const sortFirst = (0, get_sort_first_1.getSortFirst)(ctx.config);
22
- packageJsonFiles.forEach((file) => {
23
- const { contents } = file.jsonFile;
24
- const sortedKeys = Object.keys(contents).sort();
25
- const keys = new Set(sortFirst.concat(sortedKeys));
26
- const optionalChaining = contents;
27
- const bugsUrl = optionalChaining?.bugs?.url;
28
- const repoUrl = optionalChaining?.repository?.url;
29
- const repoDir = optionalChaining?.repository?.directory;
19
+ return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.flatMap(pipeline), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags({
20
+ WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
21
+ ctx.isInvalid = true;
22
+ return ctx;
23
+ })),
24
+ }))), 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);
25
+ }
26
+ exports.format = format;
27
+ function pipeline(ctx) {
28
+ const { config, packageJsonFiles } = ctx;
29
+ const sortAz = (0, get_sort_az_1.getSortAz)(config);
30
+ const sortExports = (0, get_sort_exports_1.getSortExports)(config);
31
+ const sortFirst = (0, get_sort_first_1.getSortFirst)(config);
32
+ const sortPackages = config.rcFile.sortPackages !== false;
33
+ const formatBugs = config.rcFile.formatBugs !== false;
34
+ const formatRepository = config.rcFile.formatRepository !== false;
35
+ packageJsonFiles.forEach((file) => {
36
+ const { contents } = file.jsonFile;
37
+ const chain = contents;
38
+ if (formatBugs) {
39
+ const bugsUrl = chain?.bugs?.url;
30
40
  if (bugsUrl) {
31
41
  contents.bugs = bugsUrl;
32
42
  }
43
+ }
44
+ if (formatRepository) {
45
+ const repoUrl = chain?.repository?.url;
46
+ const repoDir = chain?.repository?.directory;
33
47
  if ((0, is_non_empty_string_1.isNonEmptyString)(repoUrl) && !(0, is_non_empty_string_1.isNonEmptyString)(repoDir)) {
34
48
  contents.repository = repoUrl.includes('github.com')
35
49
  ? repoUrl.replace(/^.+github\.com\//, '')
36
50
  : repoUrl;
37
51
  }
52
+ }
53
+ if (sortExports.length > 0) {
54
+ visitExports(sortExports, contents.exports);
55
+ }
56
+ if (sortAz.length > 0) {
38
57
  sortAz.forEach((key) => sortAlphabetically(contents[key]));
39
- sortObject(keys, contents);
40
- });
41
- return ctx;
42
- function sortObject(sortedKeys, obj) {
43
- sortedKeys.forEach((key) => {
44
- const value = obj[key];
45
- delete obj[key];
46
- obj[key] = value;
47
- });
48
58
  }
49
- function sortAlphabetically(value) {
50
- if ((0, is_array_1.isArray)(value)) {
51
- value.sort();
52
- }
53
- else if ((0, is_object_1.isObject)(value)) {
54
- sortObject(Object.keys(value).sort(), value);
55
- }
59
+ if (sortPackages) {
60
+ const sortedKeys = Object.keys(contents).sort();
61
+ sortObject(sortedKeys, contents);
56
62
  }
57
- }), effect_1.Effect.flatMap((ctx) => (0, effect_1.pipe)((0, write_if_changed_1.writeIfChanged)(ctx), effect_1.Effect.catchTags({
58
- WriteFileError: (0, effect_1.flow)(errorHandlers.WriteFileError, effect_1.Effect.map(() => {
59
- ctx.isInvalid = true;
60
- return ctx;
61
- })),
62
- }))), 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);
63
+ if (sortFirst.length > 0) {
64
+ const otherKeys = Object.keys(contents);
65
+ const sortedKeys = new Set([...sortFirst, ...otherKeys]);
66
+ sortObject(sortedKeys, contents);
67
+ }
68
+ });
69
+ return effect_1.Effect.succeed(ctx);
70
+ }
71
+ exports.pipeline = pipeline;
72
+ function visitExports(sortExports, value) {
73
+ if ((0, is_object_1.isObject)(value)) {
74
+ const otherKeys = Object.keys(value);
75
+ const sortedKeys = new Set([...sortExports, ...otherKeys]);
76
+ sortObject(sortedKeys, value);
77
+ Object.values(value).forEach((nextValue) => visitExports(sortExports, nextValue));
78
+ }
79
+ }
80
+ function sortObject(sortedKeys, obj) {
81
+ sortedKeys.forEach((key) => {
82
+ const value = obj[key];
83
+ delete obj[key];
84
+ obj[key] = value;
85
+ });
86
+ }
87
+ function sortAlphabetically(value) {
88
+ if ((0, is_array_1.isArray)(value)) {
89
+ value.sort();
90
+ }
91
+ else if ((0, is_object_1.isObject)(value)) {
92
+ sortObject(Object.keys(value).sort(), value);
93
+ }
63
94
  }
64
- exports.format = format;
@@ -6,15 +6,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.lint = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const effect_1 = require("effect");
9
+ const format_1 = require("../bin-format/format");
9
10
  const lint_semver_ranges_1 = require("../bin-lint-semver-ranges/lint-semver-ranges");
10
11
  const list_mismatches_1 = require("../bin-list-mismatches/list-mismatches");
11
12
  const tag_1 = require("../config/tag");
13
+ const constants_1 = require("../constants");
12
14
  const default_error_handlers_1 = require("../error-handlers/default-error-handlers");
13
15
  const get_context_1 = require("../get-context");
14
16
  const io_1 = require("../io");
15
17
  const exit_if_invalid_1 = require("../io/exit-if-invalid");
18
+ const to_json_1 = require("../io/to-json");
16
19
  const with_logger_1 = require("../lib/with-logger");
17
20
  function lint({ io, cli, errorHandlers = default_error_handlers_1.defaultErrorHandlers }) {
18
- return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }), effect_1.Effect.tap(() => effect_1.Effect.logInfo((0, chalk_1.default) `{yellow Versions}`)), effect_1.Effect.flatMap((ctx) => (0, list_mismatches_1.pipeline)(ctx, io, errorHandlers)), effect_1.Effect.tap(() => effect_1.Effect.logInfo((0, chalk_1.default) `{yellow Semver Ranges}`)), effect_1.Effect.flatMap((ctx) => (0, lint_semver_ranges_1.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);
21
+ return (0, effect_1.pipe)((0, get_context_1.getContext)({ io, cli, errorHandlers }),
22
+ // Versions
23
+ effect_1.Effect.flatMap((ctx) => effect_1.Effect.gen(function* ($) {
24
+ if (ctx.config.rcFile.lintVersions !== false) {
25
+ yield* $(effect_1.Effect.logInfo((0, chalk_1.default) `{yellow Versions}`));
26
+ yield* $((0, list_mismatches_1.pipeline)(ctx, io, errorHandlers));
27
+ }
28
+ return ctx;
29
+ })),
30
+ // Semver Ranges
31
+ effect_1.Effect.flatMap((ctx) => effect_1.Effect.gen(function* ($) {
32
+ if (ctx.config.rcFile.lintSemverRanges !== false) {
33
+ yield* $(effect_1.Effect.logInfo((0, chalk_1.default) `{yellow Semver Ranges}`));
34
+ yield* $((0, lint_semver_ranges_1.pipeline)(ctx, io, errorHandlers));
35
+ }
36
+ return ctx;
37
+ })),
38
+ // Formatting
39
+ effect_1.Effect.flatMap((ctx) => effect_1.Effect.gen(function* ($) {
40
+ if (ctx.config.rcFile.lintFormatting !== false) {
41
+ yield* $(effect_1.Effect.logInfo((0, chalk_1.default) `{yellow Formatting}`));
42
+ yield* $((0, format_1.pipeline)(ctx));
43
+ for (const file of ctx.packageJsonFiles) {
44
+ const nextJson = (0, to_json_1.toJson)(ctx, file);
45
+ const hasChanged = file.jsonFile.json !== nextJson;
46
+ const shortPath = file.jsonFile.shortPath;
47
+ if (hasChanged) {
48
+ ctx.isInvalid = true;
49
+ yield* $(effect_1.Effect.logInfo((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${shortPath}`));
50
+ }
51
+ else {
52
+ yield* $(effect_1.Effect.logInfo((0, chalk_1.default) `{green ${constants_1.ICON.tick}} ${shortPath}`));
53
+ }
54
+ }
55
+ }
56
+ return ctx;
57
+ })), 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);
19
58
  }
20
59
  exports.lint = lint;
@@ -55,6 +55,7 @@ commander_1.program
55
55
  .option(...option_1.option.source)
56
56
  .option(...option_1.option.filter)
57
57
  .option(...option_1.option.config)
58
+ .option(...option_1.option.specs)
58
59
  .option(...option_1.option.types)
59
60
  .parse(process.argv);
60
61
  effect_1.Effect.runPromise((0, lint_semver_ranges_1.lintSemverRanges)({
@@ -63,6 +64,7 @@ effect_1.Effect.runPromise((0, lint_semver_ranges_1.lintSemverRanges)({
63
64
  configPath: commander_1.program.opts().config,
64
65
  filter: commander_1.program.opts().filter,
65
66
  source: commander_1.program.opts().source,
67
+ specs: commander_1.program.opts().specs,
66
68
  types: commander_1.program.opts().types,
67
69
  },
68
70
  }));
@@ -84,7 +84,7 @@ function logSemverRangeMismatch(report) {
84
84
  const _tag = report._tag;
85
85
  const instance = report.fixable.instance;
86
86
  const name = instance.name;
87
- const actual = instance.rawSpecifier;
87
+ const actual = instance.rawSpecifier.raw;
88
88
  const expected = report.fixable.raw;
89
89
  const propPath = instance.strategy.path;
90
90
  const filePath = instance.packageJsonFile.jsonFile.shortPath;
@@ -94,7 +94,7 @@ function logUnsupportedMismatch(report) {
94
94
  const _tag = report._tag;
95
95
  const instance = report.unfixable;
96
96
  const name = instance.name;
97
- const actual = instance.rawSpecifier;
97
+ const actual = instance.rawSpecifier.raw;
98
98
  const propPath = instance.strategy.path;
99
99
  const filePath = instance.packageJsonFile.jsonFile.shortPath;
100
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}]}`);
@@ -47,6 +47,7 @@ commander_1.program
47
47
  .option(...option_1.option.source)
48
48
  .option(...option_1.option.filter)
49
49
  .option(...option_1.option.config)
50
+ .option(...option_1.option.specs)
50
51
  .option(...option_1.option.types)
51
52
  .parse(process.argv);
52
53
  effect_1.Effect.runPromise((0, list_1.list)({
@@ -55,6 +56,7 @@ effect_1.Effect.runPromise((0, list_1.list)({
55
56
  configPath: commander_1.program.opts().config,
56
57
  filter: commander_1.program.opts().filter,
57
58
  source: commander_1.program.opts().source,
59
+ specs: commander_1.program.opts().specs,
58
60
  types: commander_1.program.opts().types,
59
61
  },
60
62
  }));
@@ -132,13 +132,13 @@ function logMismatchingReport(groupReport, messages) {
132
132
  }
133
133
  function getLogForFixable(report) {
134
134
  const _tag = report._tag;
135
- const actual = report.fixable.instance.rawSpecifier;
135
+ const actual = report.fixable.instance.rawSpecifier.raw;
136
136
  const expected = report.fixable.raw;
137
137
  return (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {green ${expected}} {gray [${_tag}]}`;
138
138
  }
139
139
  function getLogForUnfixable(report) {
140
140
  const _tag = report._tag;
141
- const actual = report.unfixable.rawSpecifier;
141
+ const actual = report.unfixable.rawSpecifier.raw;
142
142
  return (0, chalk_1.default) `{red ${actual}} {gray ${constants_1.ICON.rightArrow}} {gray [${_tag}]}`;
143
143
  }
144
144
  function logOtherCommands() {
@@ -49,6 +49,7 @@ commander_1.program
49
49
  .option(...option_1.option.source)
50
50
  .option(...option_1.option.filter)
51
51
  .option(...option_1.option.config)
52
+ .option(...option_1.option.specs)
52
53
  .option(...option_1.option.types)
53
54
  .parse(process.argv);
54
55
  effect_1.Effect.runPromise((0, list_mismatches_1.listMismatches)({
@@ -57,6 +58,7 @@ effect_1.Effect.runPromise((0, list_mismatches_1.listMismatches)({
57
58
  configPath: commander_1.program.opts().config,
58
59
  filter: commander_1.program.opts().filter,
59
60
  source: commander_1.program.opts().source,
61
+ specs: commander_1.program.opts().specs,
60
62
  types: commander_1.program.opts().types,
61
63
  },
62
64
  }));
@@ -101,7 +101,7 @@ const onReportTag = {
101
101
  const fixable = report.fixable;
102
102
  const instance = fixable.instance;
103
103
  const jsonFile = instance.packageJsonFile.jsonFile;
104
- const actual = instance.rawSpecifier;
104
+ const actual = instance.rawSpecifier.raw;
105
105
  const expected = fixable.raw;
106
106
  const name = instance.name;
107
107
  const path = instance.strategy.path;
@@ -115,7 +115,7 @@ const onReportTag = {
115
115
  const _tag = report._tag;
116
116
  const fixable = report.fixable;
117
117
  const instance = fixable.instance;
118
- const actual = instance.rawSpecifier;
118
+ const actual = instance.rawSpecifier.raw;
119
119
  const expected = fixable.raw;
120
120
  const name = instance.name;
121
121
  const path = instance.strategy.path;
@@ -126,7 +126,7 @@ const onReportTag = {
126
126
  const _tag = report._tag;
127
127
  const fixable = report.fixable;
128
128
  const instance = fixable.instance;
129
- const actual = instance.rawSpecifier;
129
+ const actual = instance.rawSpecifier.raw;
130
130
  const expected = fixable.raw;
131
131
  const name = instance.name;
132
132
  const path = instance.strategy.path;
@@ -137,7 +137,7 @@ const onReportTag = {
137
137
  const instance = report.unfixable;
138
138
  const localPath = report.localInstance.packageJsonFile.jsonFile.shortPath;
139
139
  const jsonFile = instance.packageJsonFile.jsonFile;
140
- const actual = instance.rawSpecifier;
140
+ const actual = instance.rawSpecifier.raw;
141
141
  const name = instance.name;
142
142
  const path = instance.strategy.path;
143
143
  const shortPath = jsonFile.shortPath;
@@ -149,7 +149,7 @@ const onReportTag = {
149
149
  MissingSnappedToMismatch(report) {
150
150
  const instance = report.unfixable;
151
151
  const jsonFile = instance.packageJsonFile.jsonFile;
152
- const actual = instance.rawSpecifier;
152
+ const actual = instance.rawSpecifier.raw;
153
153
  const name = instance.name;
154
154
  const path = instance.strategy.path;
155
155
  const shortPath = jsonFile.shortPath;
@@ -162,7 +162,7 @@ const onReportTag = {
162
162
  const _tag = report._tag;
163
163
  const fixable = report.fixable;
164
164
  const instance = fixable.instance;
165
- const actual = instance.rawSpecifier;
165
+ const actual = instance.rawSpecifier.raw;
166
166
  const expected = fixable.raw;
167
167
  const name = instance.name;
168
168
  const path = instance.strategy.path;
@@ -172,7 +172,7 @@ const onReportTag = {
172
172
  SameRangeMismatch(report) {
173
173
  const instance = report.unfixable;
174
174
  const jsonFile = instance.packageJsonFile.jsonFile;
175
- const actual = instance.rawSpecifier;
175
+ const actual = instance.rawSpecifier.raw;
176
176
  const name = instance.name;
177
177
  const path = instance.strategy.path;
178
178
  const shortPath = jsonFile.shortPath;
@@ -186,7 +186,7 @@ const onReportTag = {
186
186
  const _tag = report._tag;
187
187
  const fixable = report.fixable;
188
188
  const instance = fixable.instance;
189
- const actual = instance.rawSpecifier;
189
+ const actual = instance.rawSpecifier.raw;
190
190
  const expected = fixable.raw;
191
191
  const name = instance.name;
192
192
  const path = instance.strategy.path;
@@ -197,7 +197,7 @@ const onReportTag = {
197
197
  const _tag = report._tag;
198
198
  const fixable = report.fixable;
199
199
  const instance = fixable.instance;
200
- const actual = instance.rawSpecifier;
200
+ const actual = instance.rawSpecifier.raw;
201
201
  const expected = fixable.raw;
202
202
  const name = instance.name;
203
203
  const path = instance.strategy.path;
@@ -207,7 +207,7 @@ const onReportTag = {
207
207
  UnsupportedMismatch(report) {
208
208
  const instance = report.unfixable;
209
209
  const jsonFile = instance.packageJsonFile.jsonFile;
210
- const actual = instance.rawSpecifier;
210
+ const actual = instance.rawSpecifier.raw;
211
211
  const name = instance.name;
212
212
  const path = instance.strategy.path;
213
213
  const shortPath = jsonFile.shortPath;
@@ -49,6 +49,7 @@ commander_1.program
49
49
  .option(...option_1.option.source)
50
50
  .option(...option_1.option.filter)
51
51
  .option(...option_1.option.config)
52
+ .option(...option_1.option.specs)
52
53
  .option(...option_1.option.types)
53
54
  .option(...option_1.option.indent)
54
55
  .parse(process.argv);
@@ -58,6 +59,7 @@ effect_1.Effect.runPromise((0, prompt_1.prompt)({
58
59
  configPath: commander_1.program.opts().config,
59
60
  filter: commander_1.program.opts().filter,
60
61
  source: commander_1.program.opts().source,
62
+ specs: commander_1.program.opts().specs,
61
63
  types: commander_1.program.opts().types,
62
64
  indent: commander_1.program.opts().indent,
63
65
  },
@@ -57,6 +57,7 @@ commander_1.program
57
57
  .option(...option_1.option.source)
58
58
  .option(...option_1.option.filter)
59
59
  .option(...option_1.option.config)
60
+ .option(...option_1.option.specs)
60
61
  .option(...option_1.option.types)
61
62
  .option(...option_1.option.indent)
62
63
  .parse(process.argv);
@@ -67,6 +68,7 @@ effect_1.Effect.runPromise((0, set_semver_ranges_1.setSemverRanges)({
67
68
  filter: commander_1.program.opts().filter,
68
69
  indent: commander_1.program.opts().indent,
69
70
  source: commander_1.program.opts().source,
71
+ specs: commander_1.program.opts().specs,
70
72
  types: commander_1.program.opts().types,
71
73
  },
72
74
  }));
@@ -98,9 +98,9 @@ exports.updateEffects = {
98
98
  inFlight.delete(format(instance));
99
99
  const latest = versions?.latest;
100
100
  if (latest) {
101
- if ((0, gtr_1.default)(latest, instance.rawSpecifier, true)) {
101
+ if ((0, gtr_1.default)(latest, String(instance.rawSpecifier.raw), true)) {
102
102
  outdatedCount++;
103
- mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
103
+ mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
104
104
  }
105
105
  else {
106
106
  mostRecent.push((0, chalk_1.default) `{green ${instance.name}}`);
@@ -116,7 +116,7 @@ exports.updateEffects = {
116
116
  /** After checking the registry, store this instance known to have newer versions available */
117
117
  onOutdated(instance, latest) {
118
118
  outdatedCount++;
119
- mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
119
+ mostRecent.push((0, chalk_1.default) `${instance.name} {gray {red ${instance.rawSpecifier.raw}} ${constants_1.ICON.rightArrow}} {green ${latest}}`);
120
120
  return effect_1.Effect.unit;
121
121
  },
122
122
  /** As the last request completes, remove the progress information */
@@ -208,14 +208,14 @@ function promptForReleaseType(releaseType, doState) {
208
208
  choices: releases.map((updateable) => {
209
209
  const spacingValue = 50 -
210
210
  updateable.instance.name.length -
211
- updateable.instance.rawSpecifier.length -
211
+ String(updateable.instance.rawSpecifier).length -
212
212
  updateable.versions.latest.length;
213
213
  const spacing = Array.from({ length: spacingValue }).fill(' ').join('');
214
214
  const repoUrl = updateable.repoUrl
215
215
  ? (0, chalk_1.default) `${spacing} {white - ${updateable.repoUrl}}`
216
216
  : '';
217
217
  return {
218
- title: (0, chalk_1.default) `${updateable.instance.name} {gray ${updateable.instance.rawSpecifier} ${constants_1.ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
218
+ title: (0, chalk_1.default) `${updateable.instance.name} {gray ${updateable.instance.rawSpecifier.raw} ${constants_1.ICON.rightArrow}} {green ${updateable.versions.latest}} ${repoUrl}`,
219
219
  selected: true,
220
220
  value: updateable,
221
221
  };
@@ -235,7 +235,7 @@ function promptForReleaseType(releaseType, doState) {
235
235
  }
236
236
  function groupByReleaseType(releases) {
237
237
  return effect_1.Effect.succeed(releases.reduce((releasesByType, release) => {
238
- const previous = (0, set_semver_range_1.setSemverRange)('', release.instance.rawSpecifier);
238
+ const previous = (0, set_semver_range_1.setSemverRange)('', String(release.instance.rawSpecifier.raw));
239
239
  const latest = release.versions.latest;
240
240
  try {
241
241
  const type = (0, semver_1.diff)(previous, latest);
@@ -47,11 +47,13 @@ commander_1.program
47
47
  .option(...option_1.option.source)
48
48
  .option(...option_1.option.filter)
49
49
  .option(...option_1.option.config)
50
+ .option(...option_1.option.specs)
50
51
  .option(...option_1.option.types)
51
52
  .parse(process.argv);
52
53
  effect_1.Effect.runPromise((0, update_1.update)(io_1.io, {
53
54
  configPath: commander_1.program.opts().config,
54
55
  filter: commander_1.program.opts().filter,
55
56
  source: commander_1.program.opts().source,
57
+ specs: commander_1.program.opts().specs,
56
58
  types: commander_1.program.opts().types,
57
59
  }));
@@ -26,8 +26,8 @@ function update(io, cli, effects = effects_1.updateEffects, errorHandlers = defa
26
26
  if (!isVisitedByName[instance.name] &&
27
27
  (instance.versionGroup._tag === 'SameRange' ||
28
28
  instance.versionGroup._tag === 'Standard')) {
29
- const specifier = specifier_1.Specifier.create(instance, instance.rawSpecifier);
30
- if (specifier._tag === 'RangeSpecifier' || specifier._tag === 'VersionSpecifier') {
29
+ const specifier = specifier_1.Specifier.create(instance, instance.rawSpecifier.raw);
30
+ if (specifier._tag === 'Range' || specifier._tag === 'Exact') {
31
31
  isVisitedByName[instance.name] = true;
32
32
  updateable.push(instance);
33
33
  }
@@ -39,7 +39,7 @@ function update(io, cli, effects = effects_1.updateEffects, errorHandlers = defa
39
39
  onSuccess: ({ versions }) => effects_1.updateEffects.onFetchEnd(instance, versions),
40
40
  }),
41
41
  // move up to date dependencies to error channel
42
- effect_1.Effect.flatMap((updateable) => (0, semver_1.gtr)(updateable.versions.latest, instance.rawSpecifier)
42
+ effect_1.Effect.flatMap((updateable) => (0, semver_1.gtr)(updateable.versions.latest, String(instance.rawSpecifier.raw))
43
43
  ? (0, effect_1.pipe)(effects_1.updateEffects.onOutdated(instance, updateable.versions.latest), effect_1.Effect.map(() => updateable))
44
44
  : (0, effect_1.pipe)(effects_1.updateEffects.onUpToDate(instance), effect_1.Effect.flatMap(() => effect_1.Effect.fail(updateable)))),
45
45
  // log error but don't catch it
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFilter = void 0;
4
4
  const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
5
+ const constants_1 = require("../constants");
5
6
  function getFilter({ cli, rcFile }) {
6
7
  // @TODO Deprecate `filter` in .syncpackrc
7
8
  return (0, is_non_empty_string_1.isNonEmptyString)(cli.filter)
8
9
  ? cli.filter
9
10
  : (0, is_non_empty_string_1.isNonEmptyString)(rcFile.filter)
10
11
  ? rcFile.filter
11
- : '.';
12
+ : constants_1.DEFAULT_CONFIG.filter;
12
13
  }
13
14
  exports.getFilter = getFilter;
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getIndent = void 0;
4
4
  const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
5
+ const constants_1 = require("../constants");
5
6
  function getIndent({ cli, rcFile }) {
6
7
  return (0, is_non_empty_string_1.isNonEmptyString)(cli.indent)
7
8
  ? cli.indent.replaceAll('\\t', '\t')
8
9
  : (0, is_non_empty_string_1.isNonEmptyString)(rcFile.indent)
9
10
  ? rcFile.indent
10
- : ' ';
11
+ : constants_1.DEFAULT_CONFIG.indent;
11
12
  }
12
13
  exports.getIndent = getIndent;
@@ -2,18 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSortAz = void 0;
4
4
  const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
5
+ const is_empty_array_1 = require("tightrope/guard/is-empty-array");
6
+ const constants_1 = require("../constants");
5
7
  function getSortAz({ rcFile }) {
6
- return (0, is_array_of_strings_1.isArrayOfStrings)(rcFile.sortAz)
8
+ return (0, is_array_of_strings_1.isArrayOfStrings)(rcFile.sortAz) || (0, is_empty_array_1.isEmptyArray)(rcFile.sortAz)
7
9
  ? rcFile.sortAz
8
- : [
9
- 'bin',
10
- 'contributors',
11
- 'dependencies',
12
- 'devDependencies',
13
- 'keywords',
14
- 'peerDependencies',
15
- 'resolutions',
16
- 'scripts',
17
- ];
10
+ : constants_1.DEFAULT_CONFIG.sortAz;
18
11
  }
19
12
  exports.getSortAz = getSortAz;
@@ -0,0 +1,2 @@
1
+ import type { Ctx } from '../get-context';
2
+ export declare function getSortExports({ rcFile }: Ctx['config']): string[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSortExports = void 0;
4
+ const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
5
+ const is_empty_array_1 = require("tightrope/guard/is-empty-array");
6
+ const constants_1 = require("../constants");
7
+ function getSortExports({ rcFile }) {
8
+ return (0, is_array_of_strings_1.isArrayOfStrings)(rcFile.sortExports) || (0, is_empty_array_1.isEmptyArray)(rcFile.sortExports)
9
+ ? rcFile.sortExports
10
+ : constants_1.DEFAULT_CONFIG.sortExports;
11
+ }
12
+ exports.getSortExports = getSortExports;
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSortFirst = void 0;
4
4
  const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
5
+ const is_empty_array_1 = require("tightrope/guard/is-empty-array");
6
+ const constants_1 = require("../constants");
5
7
  function getSortFirst({ rcFile }) {
6
- return (0, is_array_of_strings_1.isArrayOfStrings)(rcFile.sortFirst)
8
+ return (0, is_array_of_strings_1.isArrayOfStrings)(rcFile.sortFirst) || (0, is_empty_array_1.isEmptyArray)(rcFile.sortFirst)
7
9
  ? rcFile.sortFirst
8
- : ['name', 'description', 'version', 'author'];
10
+ : constants_1.DEFAULT_CONFIG.sortFirst;
9
11
  }
10
12
  exports.getSortFirst = getSortFirst;