syncpack 9.7.4 → 9.8.6

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/LICENSE +12 -13
  2. package/dist/bin-fix-mismatches/fix-mismatches.js +8 -4
  3. package/dist/bin-format/format.js +5 -4
  4. package/dist/bin-list/list.js +13 -7
  5. package/dist/bin-list-mismatches/list-mismatches.js +16 -11
  6. package/dist/get-context/$R.d.ts +8 -9
  7. package/dist/get-context/$R.js +13 -12
  8. package/dist/get-context/get-config/get-custom-types.js +1 -1
  9. package/dist/get-context/get-config/get-enabled-types.js +3 -3
  10. package/dist/get-context/get-config/index.d.ts +2 -1
  11. package/dist/get-context/get-config/index.js +28 -15
  12. package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.d.ts +2 -3
  13. package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.js +6 -4
  14. package/dist/get-context/get-config/path-strategy/name-and-version-props.js +15 -11
  15. package/dist/get-context/get-config/path-strategy/name-and-version-string.js +17 -12
  16. package/dist/get-context/get-config/path-strategy/types.d.ts +3 -4
  17. package/dist/get-context/get-config/path-strategy/version-string.js +17 -12
  18. package/dist/get-context/get-config/path-strategy/versions-by-name.js +10 -12
  19. package/dist/get-context/get-config/schema/index.d.ts +294 -256
  20. package/dist/get-context/get-config/schema/index.js +7 -7
  21. package/dist/get-context/get-config/schema/lib/non-empty-string.d.ts +2 -0
  22. package/dist/get-context/get-config/schema/lib/non-empty-string.js +5 -0
  23. package/dist/get-context/get-config/schema/semver-group.d.ts +18 -18
  24. package/dist/get-context/get-config/schema/version-group.d.ts +49 -37
  25. package/dist/get-context/get-config/schema/version-group.js +14 -8
  26. package/dist/get-context/get-groups/base-group.js +1 -1
  27. package/dist/get-context/get-groups/index.d.ts +5 -3
  28. package/dist/get-context/get-groups/index.js +14 -2
  29. package/dist/get-context/get-groups/version-group/index.d.ts +6 -4
  30. package/dist/get-context/get-groups/version-group/index.js +18 -14
  31. package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.d.ts +2 -3
  32. package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.js +6 -6
  33. package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.d.ts +2 -0
  34. package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.js +44 -0
  35. package/dist/get-context/get-groups/version-group/instance-group/index.d.ts +15 -6
  36. package/dist/get-context/get-groups/version-group/instance-group/index.js +49 -30
  37. package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.d.ts +3 -1
  38. package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.js +20 -4
  39. package/dist/get-context/get-package-json-files/get-file-paths.d.ts +2 -3
  40. package/dist/get-context/get-package-json-files/get-file-paths.js +14 -24
  41. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -3
  42. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.js +6 -5
  43. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -3
  44. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.js +7 -6
  45. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -3
  46. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.js +7 -6
  47. package/dist/get-context/get-package-json-files/get-patterns/index.d.ts +2 -3
  48. package/dist/get-context/get-package-json-files/get-patterns/index.js +8 -17
  49. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.d.ts +2 -3
  50. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.js +6 -9
  51. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.d.ts +2 -3
  52. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.js +4 -3
  53. package/dist/get-context/get-package-json-files/index.d.ts +2 -1
  54. package/dist/get-context/get-package-json-files/index.js +7 -5
  55. package/dist/get-context/get-package-json-files/package-json-file/index.js +7 -5
  56. package/dist/get-context/get-package-json-files/package-json-file/instance.d.ts +2 -1
  57. package/dist/get-context/get-package-json-files/package-json-file/instance.js +7 -6
  58. package/dist/get-context/index.d.ts +3 -2
  59. package/dist/get-context/index.js +22 -10
  60. package/dist/lib/disk.js +1 -1
  61. package/dist/lib/is-semver.js +1 -1
  62. package/dist/lib/log.js +7 -2
  63. package/dist/types.d.ts +1 -1
  64. package/package.json +17 -18
  65. package/dist/get-context/get-all-instances.d.ts +0 -3
  66. package/dist/get-context/get-all-instances.js +0 -8
  67. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.d.ts +0 -1
  68. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.js +0 -8
  69. package/dist/get-context/get-package-json-files/get-patterns/props.d.ts +0 -6
  70. package/dist/get-context/get-package-json-files/get-patterns/props.js +0 -24
@@ -26,38 +26,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Public = exports.Cli = exports.SyncpackRc = exports.Private = void 0;
27
27
  const zod_1 = require("zod");
28
28
  const constants_1 = require("../../../constants");
29
+ const non_empty_string_1 = require("./lib/non-empty-string");
29
30
  const paths = __importStar(require("./paths"));
30
31
  const semverGroup = __importStar(require("./semver-group"));
31
32
  const semverRange = __importStar(require("./semver-range"));
32
33
  const versionGroup = __importStar(require("./version-group"));
33
- const nonEmptyString = zod_1.z.string().trim().min(1);
34
34
  const cliOnly = {
35
35
  configPath: zod_1.z.string().optional(),
36
36
  types: zod_1.z.string().default(''),
37
37
  };
38
38
  const syncpackRcOnly = {
39
39
  customTypes: paths.pathConfigByName.optional(),
40
- dependencyTypes: zod_1.z.array(nonEmptyString).default([]),
40
+ dependencyTypes: zod_1.z.array(non_empty_string_1.nonEmptyString).default([]),
41
41
  semverGroups: zod_1.z
42
42
  .array(semverGroup.any)
43
43
  .default([...constants_1.DEFAULT_CONFIG.semverGroups]),
44
- sortAz: zod_1.z.array(nonEmptyString).default([...constants_1.DEFAULT_CONFIG.sortAz]),
45
- sortFirst: zod_1.z.array(nonEmptyString).default([...constants_1.DEFAULT_CONFIG.sortFirst]),
44
+ sortAz: zod_1.z.array(non_empty_string_1.nonEmptyString).default([...constants_1.DEFAULT_CONFIG.sortAz]),
45
+ sortFirst: zod_1.z.array(non_empty_string_1.nonEmptyString).default([...constants_1.DEFAULT_CONFIG.sortFirst]),
46
46
  versionGroups: zod_1.z
47
47
  .array(versionGroup.any)
48
48
  .default([...constants_1.DEFAULT_CONFIG.versionGroups]),
49
49
  };
50
50
  const cliAndRcFile = {
51
- filter: nonEmptyString.default(constants_1.DEFAULT_CONFIG.filter),
51
+ filter: non_empty_string_1.nonEmptyString.default(constants_1.DEFAULT_CONFIG.filter),
52
52
  indent: zod_1.z.string().default(constants_1.DEFAULT_CONFIG.indent),
53
53
  semverRange: semverRange.value.default(constants_1.DEFAULT_CONFIG.semverRange),
54
- source: zod_1.z.array(nonEmptyString).default([...constants_1.DEFAULT_CONFIG.source]),
54
+ source: zod_1.z.array(non_empty_string_1.nonEmptyString).default([...constants_1.DEFAULT_CONFIG.source]),
55
55
  };
56
56
  const privateOnly = {
57
57
  allTypes: zod_1.z.array(paths.pathDefinition),
58
58
  enabledTypes: zod_1.z.array(paths.pathDefinition),
59
59
  defaultSemverGroup: semverGroup.base,
60
- defaultVersionGroup: versionGroup.base,
60
+ defaultVersionGroup: versionGroup.defaultGroup,
61
61
  };
62
62
  exports.Private = zod_1.z.object({
63
63
  ...privateOnly,
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const nonEmptyString: z.ZodString;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nonEmptyString = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.nonEmptyString = zod_1.z.string().trim().min(1);
@@ -6,17 +6,17 @@ export declare const ignored: z.ZodObject<{
6
6
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
7
7
  packages: z.ZodArray<z.ZodString, "many">;
8
8
  }, "strict", z.ZodTypeAny, {
9
- dependencyTypes?: string[] | undefined;
10
- label?: string | undefined;
11
9
  dependencies: string[];
12
10
  packages: string[];
13
11
  isIgnored: true;
14
- }, {
15
12
  dependencyTypes?: string[] | undefined;
16
13
  label?: string | undefined;
14
+ }, {
17
15
  dependencies: string[];
18
16
  packages: string[];
19
17
  isIgnored: true;
18
+ dependencyTypes?: string[] | undefined;
19
+ label?: string | undefined;
20
20
  }>;
21
21
  export declare const withRange: z.ZodObject<{
22
22
  range: z.ZodEnum<["*", "", ">", ">=", ".x", "<", "<=", "^", "~"]>;
@@ -25,17 +25,17 @@ export declare const withRange: z.ZodObject<{
25
25
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
26
26
  packages: z.ZodArray<z.ZodString, "many">;
27
27
  }, "strict", z.ZodTypeAny, {
28
- dependencyTypes?: string[] | undefined;
29
- label?: string | undefined;
30
28
  dependencies: string[];
31
29
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
32
30
  packages: string[];
33
- }, {
34
31
  dependencyTypes?: string[] | undefined;
35
32
  label?: string | undefined;
33
+ }, {
36
34
  dependencies: string[];
37
35
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
38
36
  packages: string[];
37
+ dependencyTypes?: string[] | undefined;
38
+ label?: string | undefined;
39
39
  }>;
40
40
  export declare const base: z.ZodObject<{
41
41
  range: z.ZodEnum<["*", "", ">", ">=", ".x", "<", "<=", "^", "~"]>;
@@ -45,19 +45,19 @@ export declare const base: z.ZodObject<{
45
45
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
46
46
  packages: z.ZodArray<z.ZodString, "many">;
47
47
  }, "strict", z.ZodTypeAny, {
48
- dependencyTypes?: string[] | undefined;
49
- label?: string | undefined;
50
48
  isDefault: true;
51
49
  dependencies: string[];
52
50
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
53
51
  packages: string[];
54
- }, {
55
52
  dependencyTypes?: string[] | undefined;
56
53
  label?: string | undefined;
54
+ }, {
57
55
  isDefault: true;
58
56
  dependencies: string[];
59
57
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
60
58
  packages: string[];
59
+ dependencyTypes?: string[] | undefined;
60
+ label?: string | undefined;
61
61
  }>;
62
62
  export declare const any: z.ZodUnion<[z.ZodObject<{
63
63
  isIgnored: z.ZodLiteral<true>;
@@ -66,17 +66,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
66
66
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
67
67
  packages: z.ZodArray<z.ZodString, "many">;
68
68
  }, "strict", z.ZodTypeAny, {
69
- dependencyTypes?: string[] | undefined;
70
- label?: string | undefined;
71
69
  dependencies: string[];
72
70
  packages: string[];
73
71
  isIgnored: true;
74
- }, {
75
72
  dependencyTypes?: string[] | undefined;
76
73
  label?: string | undefined;
74
+ }, {
77
75
  dependencies: string[];
78
76
  packages: string[];
79
77
  isIgnored: true;
78
+ dependencyTypes?: string[] | undefined;
79
+ label?: string | undefined;
80
80
  }>, z.ZodObject<{
81
81
  range: z.ZodEnum<["*", "", ">", ">=", ".x", "<", "<=", "^", "~"]>;
82
82
  dependencies: z.ZodArray<z.ZodString, "many">;
@@ -84,17 +84,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
84
84
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
85
85
  packages: z.ZodArray<z.ZodString, "many">;
86
86
  }, "strict", z.ZodTypeAny, {
87
- dependencyTypes?: string[] | undefined;
88
- label?: string | undefined;
89
87
  dependencies: string[];
90
88
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
91
89
  packages: string[];
92
- }, {
93
90
  dependencyTypes?: string[] | undefined;
94
91
  label?: string | undefined;
92
+ }, {
95
93
  dependencies: string[];
96
94
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
97
95
  packages: string[];
96
+ dependencyTypes?: string[] | undefined;
97
+ label?: string | undefined;
98
98
  }>, z.ZodObject<{
99
99
  range: z.ZodEnum<["*", "", ">", ">=", ".x", "<", "<=", "^", "~"]>;
100
100
  isDefault: z.ZodLiteral<true>;
@@ -103,17 +103,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
103
103
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
104
104
  packages: z.ZodArray<z.ZodString, "many">;
105
105
  }, "strict", z.ZodTypeAny, {
106
- dependencyTypes?: string[] | undefined;
107
- label?: string | undefined;
108
106
  isDefault: true;
109
107
  dependencies: string[];
110
108
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
111
109
  packages: string[];
112
- }, {
113
110
  dependencyTypes?: string[] | undefined;
114
111
  label?: string | undefined;
112
+ }, {
115
113
  isDefault: true;
116
114
  dependencies: string[];
117
115
  range: "" | "*" | ">" | ">=" | ".x" | "<" | "<=" | "^" | "~";
118
116
  packages: string[];
117
+ dependencyTypes?: string[] | undefined;
118
+ label?: string | undefined;
119
119
  }>]>;
@@ -1,19 +1,22 @@
1
1
  import { z } from 'zod';
2
2
  export declare const standard: z.ZodObject<{
3
+ preferVersion: z.ZodDefault<z.ZodOptional<z.ZodEnum<["highestSemver", "lowestSemver"]>>>;
3
4
  dependencies: z.ZodArray<z.ZodString, "many">;
4
5
  dependencyTypes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
5
6
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
6
7
  packages: z.ZodArray<z.ZodString, "many">;
7
8
  }, "strict", z.ZodTypeAny, {
8
- dependencyTypes?: string[] | undefined;
9
- label?: string | undefined;
10
9
  dependencies: string[];
11
10
  packages: string[];
12
- }, {
11
+ preferVersion: "highestSemver" | "lowestSemver";
13
12
  dependencyTypes?: string[] | undefined;
14
13
  label?: string | undefined;
14
+ }, {
15
15
  dependencies: string[];
16
16
  packages: string[];
17
+ preferVersion?: "highestSemver" | "lowestSemver" | undefined;
18
+ dependencyTypes?: string[] | undefined;
19
+ label?: string | undefined;
17
20
  }>;
18
21
  export declare const banned: z.ZodObject<{
19
22
  isBanned: z.ZodLiteral<true>;
@@ -22,17 +25,17 @@ export declare const banned: z.ZodObject<{
22
25
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
23
26
  packages: z.ZodArray<z.ZodString, "many">;
24
27
  }, "strict", z.ZodTypeAny, {
25
- dependencyTypes?: string[] | undefined;
26
- label?: string | undefined;
27
28
  dependencies: string[];
28
29
  packages: string[];
29
30
  isBanned: true;
30
- }, {
31
31
  dependencyTypes?: string[] | undefined;
32
32
  label?: string | undefined;
33
+ }, {
33
34
  dependencies: string[];
34
35
  packages: string[];
35
36
  isBanned: true;
37
+ dependencyTypes?: string[] | undefined;
38
+ label?: string | undefined;
36
39
  }>;
37
40
  export declare const ignored: z.ZodObject<{
38
41
  isIgnored: z.ZodLiteral<true>;
@@ -41,17 +44,17 @@ export declare const ignored: z.ZodObject<{
41
44
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
42
45
  packages: z.ZodArray<z.ZodString, "many">;
43
46
  }, "strict", z.ZodTypeAny, {
44
- dependencyTypes?: string[] | undefined;
45
- label?: string | undefined;
46
47
  dependencies: string[];
47
48
  packages: string[];
48
49
  isIgnored: true;
49
- }, {
50
50
  dependencyTypes?: string[] | undefined;
51
51
  label?: string | undefined;
52
+ }, {
52
53
  dependencies: string[];
53
54
  packages: string[];
54
55
  isIgnored: true;
56
+ dependencyTypes?: string[] | undefined;
57
+ label?: string | undefined;
55
58
  }>;
56
59
  export declare const pinned: z.ZodObject<{
57
60
  pinVersion: z.ZodString;
@@ -60,17 +63,17 @@ export declare const pinned: z.ZodObject<{
60
63
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
61
64
  packages: z.ZodArray<z.ZodString, "many">;
62
65
  }, "strict", z.ZodTypeAny, {
63
- dependencyTypes?: string[] | undefined;
64
- label?: string | undefined;
65
66
  dependencies: string[];
66
67
  packages: string[];
67
68
  pinVersion: string;
68
- }, {
69
69
  dependencyTypes?: string[] | undefined;
70
70
  label?: string | undefined;
71
+ }, {
71
72
  dependencies: string[];
72
73
  packages: string[];
73
74
  pinVersion: string;
75
+ dependencyTypes?: string[] | undefined;
76
+ label?: string | undefined;
74
77
  }>;
75
78
  export declare const snappedTo: z.ZodObject<{
76
79
  snapTo: z.ZodArray<z.ZodString, "many">;
@@ -79,52 +82,58 @@ export declare const snappedTo: z.ZodObject<{
79
82
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
80
83
  packages: z.ZodArray<z.ZodString, "many">;
81
84
  }, "strict", z.ZodTypeAny, {
82
- dependencyTypes?: string[] | undefined;
83
- label?: string | undefined;
84
85
  dependencies: string[];
85
86
  packages: string[];
86
87
  snapTo: string[];
87
- }, {
88
88
  dependencyTypes?: string[] | undefined;
89
89
  label?: string | undefined;
90
+ }, {
90
91
  dependencies: string[];
91
92
  packages: string[];
92
93
  snapTo: string[];
94
+ dependencyTypes?: string[] | undefined;
95
+ label?: string | undefined;
93
96
  }>;
94
- export declare const base: z.ZodObject<{
97
+ export declare const defaultGroup: z.ZodObject<{
95
98
  isDefault: z.ZodLiteral<true>;
99
+ preferVersion: z.ZodDefault<z.ZodOptional<z.ZodEnum<["highestSemver", "lowestSemver"]>>>;
96
100
  dependencies: z.ZodArray<z.ZodString, "many">;
97
101
  dependencyTypes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
98
102
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
99
103
  packages: z.ZodArray<z.ZodString, "many">;
100
104
  }, "strict", z.ZodTypeAny, {
101
- dependencyTypes?: string[] | undefined;
102
- label?: string | undefined;
103
105
  isDefault: true;
104
106
  dependencies: string[];
105
107
  packages: string[];
106
- }, {
108
+ preferVersion: "highestSemver" | "lowestSemver";
107
109
  dependencyTypes?: string[] | undefined;
108
110
  label?: string | undefined;
111
+ }, {
109
112
  isDefault: true;
110
113
  dependencies: string[];
111
114
  packages: string[];
115
+ preferVersion?: "highestSemver" | "lowestSemver" | undefined;
116
+ dependencyTypes?: string[] | undefined;
117
+ label?: string | undefined;
112
118
  }>;
113
119
  export declare const any: z.ZodUnion<[z.ZodObject<{
120
+ preferVersion: z.ZodDefault<z.ZodOptional<z.ZodEnum<["highestSemver", "lowestSemver"]>>>;
114
121
  dependencies: z.ZodArray<z.ZodString, "many">;
115
122
  dependencyTypes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
116
123
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
117
124
  packages: z.ZodArray<z.ZodString, "many">;
118
125
  }, "strict", z.ZodTypeAny, {
119
- dependencyTypes?: string[] | undefined;
120
- label?: string | undefined;
121
126
  dependencies: string[];
122
127
  packages: string[];
123
- }, {
128
+ preferVersion: "highestSemver" | "lowestSemver";
124
129
  dependencyTypes?: string[] | undefined;
125
130
  label?: string | undefined;
131
+ }, {
126
132
  dependencies: string[];
127
133
  packages: string[];
134
+ preferVersion?: "highestSemver" | "lowestSemver" | undefined;
135
+ dependencyTypes?: string[] | undefined;
136
+ label?: string | undefined;
128
137
  }>, z.ZodObject<{
129
138
  isBanned: z.ZodLiteral<true>;
130
139
  dependencies: z.ZodArray<z.ZodString, "many">;
@@ -132,17 +141,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
132
141
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
133
142
  packages: z.ZodArray<z.ZodString, "many">;
134
143
  }, "strict", z.ZodTypeAny, {
135
- dependencyTypes?: string[] | undefined;
136
- label?: string | undefined;
137
144
  dependencies: string[];
138
145
  packages: string[];
139
146
  isBanned: true;
140
- }, {
141
147
  dependencyTypes?: string[] | undefined;
142
148
  label?: string | undefined;
149
+ }, {
143
150
  dependencies: string[];
144
151
  packages: string[];
145
152
  isBanned: true;
153
+ dependencyTypes?: string[] | undefined;
154
+ label?: string | undefined;
146
155
  }>, z.ZodObject<{
147
156
  isIgnored: z.ZodLiteral<true>;
148
157
  dependencies: z.ZodArray<z.ZodString, "many">;
@@ -150,17 +159,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
150
159
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
151
160
  packages: z.ZodArray<z.ZodString, "many">;
152
161
  }, "strict", z.ZodTypeAny, {
153
- dependencyTypes?: string[] | undefined;
154
- label?: string | undefined;
155
162
  dependencies: string[];
156
163
  packages: string[];
157
164
  isIgnored: true;
158
- }, {
159
165
  dependencyTypes?: string[] | undefined;
160
166
  label?: string | undefined;
167
+ }, {
161
168
  dependencies: string[];
162
169
  packages: string[];
163
170
  isIgnored: true;
171
+ dependencyTypes?: string[] | undefined;
172
+ label?: string | undefined;
164
173
  }>, z.ZodObject<{
165
174
  pinVersion: z.ZodString;
166
175
  dependencies: z.ZodArray<z.ZodString, "many">;
@@ -168,17 +177,17 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
168
177
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
169
178
  packages: z.ZodArray<z.ZodString, "many">;
170
179
  }, "strict", z.ZodTypeAny, {
171
- dependencyTypes?: string[] | undefined;
172
- label?: string | undefined;
173
180
  dependencies: string[];
174
181
  packages: string[];
175
182
  pinVersion: string;
176
- }, {
177
183
  dependencyTypes?: string[] | undefined;
178
184
  label?: string | undefined;
185
+ }, {
179
186
  dependencies: string[];
180
187
  packages: string[];
181
188
  pinVersion: string;
189
+ dependencyTypes?: string[] | undefined;
190
+ label?: string | undefined;
182
191
  }>, z.ZodObject<{
183
192
  snapTo: z.ZodArray<z.ZodString, "many">;
184
193
  dependencies: z.ZodArray<z.ZodString, "many">;
@@ -186,33 +195,36 @@ export declare const any: z.ZodUnion<[z.ZodObject<{
186
195
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
187
196
  packages: z.ZodArray<z.ZodString, "many">;
188
197
  }, "strict", z.ZodTypeAny, {
189
- dependencyTypes?: string[] | undefined;
190
- label?: string | undefined;
191
198
  dependencies: string[];
192
199
  packages: string[];
193
200
  snapTo: string[];
194
- }, {
195
201
  dependencyTypes?: string[] | undefined;
196
202
  label?: string | undefined;
203
+ }, {
197
204
  dependencies: string[];
198
205
  packages: string[];
199
206
  snapTo: string[];
207
+ dependencyTypes?: string[] | undefined;
208
+ label?: string | undefined;
200
209
  }>, z.ZodObject<{
201
210
  isDefault: z.ZodLiteral<true>;
211
+ preferVersion: z.ZodDefault<z.ZodOptional<z.ZodEnum<["highestSemver", "lowestSemver"]>>>;
202
212
  dependencies: z.ZodArray<z.ZodString, "many">;
203
213
  dependencyTypes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
204
214
  label: z.ZodOptional<z.ZodDefault<z.ZodString>>;
205
215
  packages: z.ZodArray<z.ZodString, "many">;
206
216
  }, "strict", z.ZodTypeAny, {
207
- dependencyTypes?: string[] | undefined;
208
- label?: string | undefined;
209
217
  isDefault: true;
210
218
  dependencies: string[];
211
219
  packages: string[];
212
- }, {
220
+ preferVersion: "highestSemver" | "lowestSemver";
213
221
  dependencyTypes?: string[] | undefined;
214
222
  label?: string | undefined;
223
+ }, {
215
224
  isDefault: true;
216
225
  dependencies: string[];
217
226
  packages: string[];
227
+ preferVersion?: "highestSemver" | "lowestSemver" | undefined;
228
+ dependencyTypes?: string[] | undefined;
229
+ label?: string | undefined;
218
230
  }>]>;
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.any = exports.base = exports.snappedTo = exports.pinned = exports.ignored = exports.banned = exports.standard = void 0;
3
+ exports.any = exports.defaultGroup = exports.snappedTo = exports.pinned = exports.ignored = exports.banned = exports.standard = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const base_group_1 = require("./base-group");
6
- const nonEmptyString = zod_1.z.string().trim().min(1);
7
- exports.standard = zod_1.z.object(base_group_1.baseGroupFields).strict();
6
+ const non_empty_string_1 = require("./lib/non-empty-string");
7
+ const preferVersion = zod_1.z
8
+ .enum(['highestSemver', 'lowestSemver'])
9
+ .optional()
10
+ .default('highestSemver');
11
+ exports.standard = zod_1.z
12
+ .object({ ...base_group_1.baseGroupFields, preferVersion })
13
+ .strict();
8
14
  exports.banned = zod_1.z
9
15
  .object({ ...base_group_1.baseGroupFields, isBanned: zod_1.z.literal(true) })
10
16
  .strict();
@@ -12,13 +18,13 @@ exports.ignored = zod_1.z
12
18
  .object({ ...base_group_1.baseGroupFields, isIgnored: zod_1.z.literal(true) })
13
19
  .strict();
14
20
  exports.pinned = zod_1.z
15
- .object({ ...base_group_1.baseGroupFields, pinVersion: nonEmptyString })
21
+ .object({ ...base_group_1.baseGroupFields, pinVersion: non_empty_string_1.nonEmptyString })
16
22
  .strict();
17
23
  exports.snappedTo = zod_1.z
18
- .object({ ...base_group_1.baseGroupFields, snapTo: zod_1.z.array(nonEmptyString) })
24
+ .object({ ...base_group_1.baseGroupFields, snapTo: zod_1.z.array(non_empty_string_1.nonEmptyString) })
19
25
  .strict();
20
- exports.base = zod_1.z
21
- .object({ ...base_group_1.baseGroupFields, isDefault: zod_1.z.literal(true) })
26
+ exports.defaultGroup = zod_1.z
27
+ .object({ ...base_group_1.baseGroupFields, isDefault: zod_1.z.literal(true), preferVersion })
22
28
  .strict();
23
29
  exports.any = zod_1.z.union([
24
30
  exports.standard,
@@ -26,5 +32,5 @@ exports.any = zod_1.z.union([
26
32
  exports.ignored,
27
33
  exports.pinned,
28
34
  exports.snappedTo,
29
- exports.base,
35
+ exports.defaultGroup,
30
36
  ]);
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BaseGroup = void 0;
7
- const is_non_empty_array_1 = require("expect-more/dist/is-non-empty-array");
8
7
  const minimatch_1 = __importDefault(require("minimatch"));
8
+ const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
9
9
  class BaseGroup {
10
10
  constructor(config, group, packageJsonFiles) {
11
11
  this.groupConfig = group;
@@ -1,9 +1,11 @@
1
+ import type { Result } from 'tightrope/result';
1
2
  import type { Syncpack } from '../../types';
2
3
  import type { PackageJsonFile } from '../get-package-json-files/package-json-file';
3
- import type { Instance } from '../get-package-json-files/package-json-file/instance';
4
4
  import { SemverGroup } from './semver-group';
5
5
  import { VersionGroup } from './version-group';
6
- export declare function getGroups(config: Syncpack.Config.Private, instances: Instance[], packageJsonFiles: PackageJsonFile[]): {
6
+ interface GroupsByPropName {
7
7
  semverGroups: SemverGroup[];
8
8
  versionGroups: VersionGroup[];
9
- };
9
+ }
10
+ export declare function getGroups(config: Syncpack.Config.Private, packageJsonFiles: PackageJsonFile[]): Result<GroupsByPropName>;
11
+ export {};
@@ -1,15 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGroups = void 0;
4
+ const pipe_1 = require("tightrope/fn/pipe");
5
+ const from_try_1 = require("tightrope/result/from-try");
6
+ const map_err_1 = require("tightrope/result/map-err");
7
+ const error_1 = require("../../lib/error");
4
8
  const log_1 = require("../../lib/log");
9
+ const sort_by_name_1 = require("../../lib/sort-by-name");
5
10
  const semver_group_1 = require("./semver-group");
6
11
  const version_group_1 = require("./version-group");
7
- function getGroups(config, instances, packageJsonFiles) {
12
+ function getGroups(config, packageJsonFiles) {
13
+ const ERR_CREATING_GROUPS = 'Error creating semver and version groups';
14
+ return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => unsafeGetGroups(config, packageJsonFiles)), (0, map_err_1.mapErr)(error_1.BaseError.map(ERR_CREATING_GROUPS)));
15
+ }
16
+ exports.getGroups = getGroups;
17
+ function unsafeGetGroups(config, packageJsonFiles) {
8
18
  const groupsByName = {
9
19
  semverGroups: config.semverGroups.map((group) => new semver_group_1.SemverGroup(config, group, packageJsonFiles)),
10
20
  versionGroups: config.versionGroups.map((group) => new version_group_1.VersionGroup(config, group, packageJsonFiles)),
11
21
  };
12
22
  const groupNames = Object.keys(groupsByName);
23
+ const instances = packageJsonFiles
24
+ .flatMap((pkg) => pkg.getInstances())
25
+ .sort(sort_by_name_1.sortByName);
13
26
  instances.forEach((instance) => {
14
27
  const { name, pkgName } = instance;
15
28
  groupNames.forEach((key) => {
@@ -38,4 +51,3 @@ function getGroups(config, instances, packageJsonFiles) {
38
51
  }
39
52
  return groupsByName;
40
53
  }
41
- exports.getGroups = getGroups;
@@ -1,13 +1,15 @@
1
+ import type { Option } from 'tightrope/option';
1
2
  import type { Syncpack } from '../../../types';
2
3
  import { BaseGroup } from '../base-group';
3
4
  import { InstanceGroup } from './instance-group';
4
5
  export declare class VersionGroup extends BaseGroup<Syncpack.Config.VersionGroup.Any> {
5
- getAllInstanceGroups(): InstanceGroup[];
6
- getInvalidInstanceGroups(): InstanceGroup[];
7
6
  isBanned(): boolean;
8
7
  isIgnored(): boolean;
9
8
  hasSnappedToPackages(): boolean;
10
- getSnappedToPackages(): string[];
11
- getPinnedVersion(): string;
9
+ getSnappedToPackages(): Option<string[]>;
10
+ getAllInstanceGroups(): InstanceGroup[];
11
+ getInvalidInstanceGroups(): InstanceGroup[];
12
+ getPinnedVersion(): Option<string>;
13
+ /** Is `pinVersion` defined and this group does not match that version? */
12
14
  isUnpinned(): boolean;
13
15
  }
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VersionGroup = void 0;
4
- const expect_more_1 = require("expect-more");
5
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
4
+ const pipe_1 = require("tightrope/fn/pipe");
5
+ const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
6
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
+ const from_guard_1 = require("tightrope/option/from-guard");
8
+ const is_some_1 = require("tightrope/option/is-some");
9
+ const map_1 = require("tightrope/option/map");
10
+ const unwrap_or_1 = require("tightrope/option/unwrap-or");
6
11
  const base_group_1 = require("../base-group");
7
12
  const instance_group_1 = require("./instance-group");
8
13
  class VersionGroup extends base_group_1.BaseGroup {
9
- getAllInstanceGroups() {
10
- return Object.entries(this.instancesByName).map(([name, instances]) => new instance_group_1.InstanceGroup(this, name, instances));
11
- }
12
- getInvalidInstanceGroups() {
13
- return this.getAllInstanceGroups().filter((group) => group.isInvalid());
14
- }
15
14
  isBanned() {
16
15
  return this.groupConfig.isBanned === true;
17
16
  }
@@ -19,18 +18,23 @@ class VersionGroup extends base_group_1.BaseGroup {
19
18
  return this.groupConfig.isIgnored === true;
20
19
  }
21
20
  hasSnappedToPackages() {
22
- return (0, expect_more_1.isArrayOfStrings)(this.groupConfig.snapTo);
21
+ return (0, is_some_1.isSome)(this.getSnappedToPackages());
23
22
  }
24
23
  getSnappedToPackages() {
25
- return this.groupConfig.snapTo;
24
+ return (0, from_guard_1.fromGuard)(is_array_of_strings_1.isArrayOfStrings, this.groupConfig.snapTo);
25
+ }
26
+ getAllInstanceGroups() {
27
+ return Object.entries(this.instancesByName).map(([name, instances]) => new instance_group_1.InstanceGroup(this, name, instances));
28
+ }
29
+ getInvalidInstanceGroups() {
30
+ return this.getAllInstanceGroups().filter((group) => group.isInvalid());
26
31
  }
27
32
  getPinnedVersion() {
28
- return this.groupConfig.pinVersion;
33
+ return (0, from_guard_1.fromGuard)(is_non_empty_string_1.isNonEmptyString, this.groupConfig.pinVersion);
29
34
  }
35
+ /** Is `pinVersion` defined and this group does not match that version? */
30
36
  isUnpinned() {
31
- const { pinVersion } = this.groupConfig;
32
- return ((0, is_non_empty_string_1.isNonEmptyString)(pinVersion) &&
33
- this.instances.some(({ version }) => version !== pinVersion));
37
+ return (0, pipe_1.pipe)(this.getPinnedVersion(), (0, map_1.map)((pinVersion) => this.instances.some((o) => o.version !== pinVersion)), (0, unwrap_or_1.unwrapOr)(false));
34
38
  }
35
39
  }
36
40
  exports.VersionGroup = VersionGroup;
@@ -1,3 +1,2 @@
1
- import { R } from '@mobily/ts-belt';
2
- import { BaseError } from '../../../../lib/error';
3
- export declare function getHighestVersion(versions: string[]): R.Result<string, BaseError>;
1
+ import type { Result } from 'tightrope/result';
2
+ export declare function getHighestVersion(versions: string[]): Result<string>;