syncpack 8.4.11 → 9.0.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 (182) hide show
  1. package/README.md +195 -109
  2. package/dist/bin-fix-mismatches/fix-mismatches-cli.d.ts +3 -0
  3. package/dist/bin-fix-mismatches/fix-mismatches-cli.js +10 -0
  4. package/dist/bin-fix-mismatches/fix-mismatches.d.ts +2 -3
  5. package/dist/bin-fix-mismatches/fix-mismatches.js +46 -58
  6. package/dist/bin-fix-mismatches/index.js +12 -22
  7. package/dist/bin-format/format-cli.d.ts +3 -0
  8. package/dist/bin-format/format-cli.js +10 -0
  9. package/dist/bin-format/format.d.ts +2 -3
  10. package/dist/bin-format/format.js +10 -11
  11. package/dist/bin-format/index.js +5 -4
  12. package/dist/bin-lint-semver-ranges/index.js +13 -23
  13. package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.d.ts +3 -0
  14. package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.js +10 -0
  15. package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +2 -3
  16. package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +72 -27
  17. package/dist/bin-list/index.js +12 -22
  18. package/dist/bin-list/list-cli.d.ts +3 -0
  19. package/dist/bin-list/list-cli.js +10 -0
  20. package/dist/bin-list/list.d.ts +2 -3
  21. package/dist/bin-list/list.js +60 -35
  22. package/dist/bin-list-mismatches/index.js +12 -22
  23. package/dist/bin-list-mismatches/list-mismatches-cli.d.ts +3 -0
  24. package/dist/bin-list-mismatches/list-mismatches-cli.js +10 -0
  25. package/dist/bin-list-mismatches/list-mismatches.d.ts +2 -3
  26. package/dist/bin-list-mismatches/list-mismatches.js +75 -73
  27. package/dist/bin-set-semver-ranges/index.js +13 -23
  28. package/dist/bin-set-semver-ranges/set-semver-ranges-cli.d.ts +3 -0
  29. package/dist/bin-set-semver-ranges/set-semver-ranges-cli.js +10 -0
  30. package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +2 -3
  31. package/dist/bin-set-semver-ranges/set-semver-ranges.js +5 -29
  32. package/dist/constants.d.ts +31 -21
  33. package/dist/constants.js +27 -42
  34. package/dist/get-context/$R.d.ts +13 -0
  35. package/dist/get-context/$R.js +56 -0
  36. package/dist/get-context/get-all-instances.d.ts +3 -0
  37. package/dist/get-context/get-all-instances.js +8 -0
  38. package/dist/get-context/get-config/get-core-types.d.ts +36 -0
  39. package/dist/get-context/get-config/get-core-types.js +68 -0
  40. package/dist/get-context/get-config/get-custom-types.d.ts +4 -0
  41. package/dist/get-context/get-config/get-custom-types.js +28 -0
  42. package/dist/get-context/get-config/get-enabled-types.d.ts +4 -0
  43. package/dist/get-context/get-config/get-enabled-types.js +19 -0
  44. package/dist/get-context/get-config/index.d.ts +7 -0
  45. package/dist/get-context/get-config/index.js +115 -0
  46. package/dist/get-context/get-config/path-strategy/index.d.ts +8 -0
  47. package/dist/get-context/get-config/path-strategy/index.js +18 -0
  48. package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.d.ts +4 -0
  49. package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.js +11 -0
  50. package/dist/get-context/get-config/path-strategy/name-and-version-props.d.ts +2 -0
  51. package/dist/get-context/get-config/path-strategy/name-and-version-props.js +66 -0
  52. package/dist/get-context/get-config/path-strategy/name-and-version-string.d.ts +2 -0
  53. package/dist/get-context/get-config/path-strategy/name-and-version-string.js +60 -0
  54. package/dist/get-context/get-config/path-strategy/types.d.ts +15 -0
  55. package/dist/{types/index.js → get-context/get-config/path-strategy/types.js} +0 -0
  56. package/dist/get-context/get-config/path-strategy/version-string.d.ts +2 -0
  57. package/dist/get-context/get-config/path-strategy/version-string.js +60 -0
  58. package/dist/get-context/get-config/path-strategy/versions-by-name.d.ts +2 -0
  59. package/dist/get-context/get-config/path-strategy/versions-by-name.js +39 -0
  60. package/dist/get-context/get-config/schema/base-group.d.ts +6 -0
  61. package/dist/get-context/get-config/schema/base-group.js +9 -0
  62. package/dist/get-context/get-config/schema/index.d.ts +1276 -0
  63. package/dist/get-context/get-config/schema/index.js +104 -0
  64. package/dist/get-context/get-config/schema/paths.d.ts +89 -0
  65. package/dist/get-context/get-config/schema/paths.js +33 -0
  66. package/dist/get-context/get-config/schema/semver-group.d.ts +101 -0
  67. package/dist/get-context/get-config/schema/semver-group.js +50 -0
  68. package/dist/get-context/get-config/schema/semver-range.d.ts +2 -0
  69. package/dist/get-context/get-config/schema/semver-range.js +16 -0
  70. package/dist/get-context/get-config/schema/version-group.d.ts +151 -0
  71. package/dist/get-context/get-config/schema/version-group.js +31 -0
  72. package/dist/get-context/get-groups/get-semver-groups.d.ts +4 -0
  73. package/dist/get-context/get-groups/get-semver-groups.js +46 -0
  74. package/dist/get-context/get-groups/get-version-groups.d.ts +4 -0
  75. package/dist/get-context/get-groups/get-version-groups.js +72 -0
  76. package/dist/get-context/get-groups/semver-group/index.d.ts +29 -0
  77. package/dist/get-context/get-groups/semver-group/index.js +56 -0
  78. package/dist/get-context/get-groups/version-group/index.d.ts +29 -0
  79. package/dist/get-context/get-groups/version-group/index.js +23 -0
  80. package/dist/{bin-fix-mismatches/get-expected-version → get-context/get-groups/version-group/instance-group}/get-highest-version.d.ts +0 -0
  81. package/dist/{bin-fix-mismatches/get-expected-version → get-context/get-groups/version-group/instance-group}/get-highest-version.js +10 -10
  82. package/dist/get-context/get-groups/version-group/instance-group/index.d.ts +34 -0
  83. package/dist/get-context/get-groups/version-group/instance-group/index.js +80 -0
  84. package/dist/{lib/get-input/get-wrappers → get-context/get-package-json-files}/get-file-paths.d.ts +7 -5
  85. package/dist/get-context/get-package-json-files/get-file-paths.js +40 -0
  86. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +4 -0
  87. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.js +19 -0
  88. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +4 -0
  89. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.js +23 -0
  90. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +4 -0
  91. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.js +20 -0
  92. package/dist/get-context/get-package-json-files/get-patterns/index.d.ts +11 -0
  93. package/dist/get-context/get-package-json-files/get-patterns/index.js +70 -0
  94. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.d.ts +1 -0
  95. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.js +10 -0
  96. package/dist/get-context/get-package-json-files/get-patterns/props.d.ts +6 -0
  97. package/dist/get-context/get-package-json-files/get-patterns/props.js +48 -0
  98. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.d.ts +12 -0
  99. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.js +20 -0
  100. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.d.ts +4 -0
  101. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.js +11 -0
  102. package/dist/get-context/get-package-json-files/index.d.ts +5 -0
  103. package/dist/get-context/get-package-json-files/index.js +16 -0
  104. package/dist/get-context/get-package-json-files/package-json-file/index.d.ts +51 -0
  105. package/dist/get-context/get-package-json-files/package-json-file/index.js +85 -0
  106. package/dist/get-context/get-package-json-files/package-json-file/instance.d.ts +25 -0
  107. package/dist/get-context/get-package-json-files/package-json-file/instance.js +62 -0
  108. package/dist/get-context/index.d.ts +21 -0
  109. package/dist/get-context/index.js +38 -0
  110. package/dist/lib/disk.d.ts +11 -11
  111. package/dist/lib/disk.js +0 -1
  112. package/dist/lib/error.d.ts +12 -0
  113. package/dist/lib/error.js +43 -0
  114. package/dist/lib/exit-if-invalid.d.ts +2 -0
  115. package/dist/lib/exit-if-invalid.js +10 -0
  116. package/dist/lib/is-semver.d.ts +2 -2
  117. package/dist/lib/is-semver.js +9 -9
  118. package/dist/lib/log.d.ts +6 -0
  119. package/dist/lib/log.js +40 -1
  120. package/dist/lib/newlines.d.ts +6 -0
  121. package/dist/lib/newlines.js +24 -0
  122. package/dist/lib/set-semver-range.d.ts +2 -2
  123. package/dist/lib/set-semver-range.js +1 -1
  124. package/dist/lib/show-help-on-error.d.ts +2 -0
  125. package/dist/lib/show-help-on-error.js +16 -0
  126. package/dist/lib/write-if-changed.d.ts +2 -0
  127. package/dist/lib/{get-input/get-wrappers/get-patterns/read-yaml-safe.js → write-if-changed.js} +14 -8
  128. package/dist/option.d.ts +6 -11
  129. package/dist/option.js +10 -18
  130. package/dist/types.d.ts +88 -0
  131. package/dist/{types/semver-group.js → types.js} +0 -0
  132. package/package.json +24 -23
  133. package/dist/bin-fix-mismatches/get-expected-version/get-pinned-version.d.ts +0 -2
  134. package/dist/bin-fix-mismatches/get-expected-version/get-pinned-version.js +0 -7
  135. package/dist/bin-fix-mismatches/get-expected-version/get-workspace-version.d.ts +0 -6
  136. package/dist/bin-fix-mismatches/get-expected-version/get-workspace-version.js +0 -17
  137. package/dist/bin-fix-mismatches/get-expected-version/index.d.ts +0 -3
  138. package/dist/bin-fix-mismatches/get-expected-version/index.js +0 -27
  139. package/dist/bin-lint-semver-ranges/list-semver-group-mismatches.d.ts +0 -2
  140. package/dist/bin-lint-semver-ranges/list-semver-group-mismatches.js +0 -12
  141. package/dist/bin-list/list-version-groups.d.ts +0 -10
  142. package/dist/bin-list/list-version-groups.js +0 -52
  143. package/dist/lib/collect.d.ts +0 -1
  144. package/dist/lib/collect.js +0 -7
  145. package/dist/lib/get-input/get-config.d.ts +0 -12
  146. package/dist/lib/get-input/get-config.js +0 -135
  147. package/dist/lib/get-input/get-instances.d.ts +0 -29
  148. package/dist/lib/get-input/get-instances.js +0 -172
  149. package/dist/lib/get-input/get-wrappers/get-file-paths.js +0 -50
  150. package/dist/lib/get-input/get-wrappers/get-patterns/get-lerna-patterns.d.ts +0 -3
  151. package/dist/lib/get-input/get-wrappers/get-patterns/get-lerna-patterns.js +0 -40
  152. package/dist/lib/get-input/get-wrappers/get-patterns/get-pnpm-patterns.d.ts +0 -3
  153. package/dist/lib/get-input/get-wrappers/get-patterns/get-pnpm-patterns.js +0 -45
  154. package/dist/lib/get-input/get-wrappers/get-patterns/get-yarn-patterns.d.ts +0 -3
  155. package/dist/lib/get-input/get-wrappers/get-patterns/get-yarn-patterns.js +0 -46
  156. package/dist/lib/get-input/get-wrappers/get-patterns/index.d.ts +0 -10
  157. package/dist/lib/get-input/get-wrappers/get-patterns/index.js +0 -79
  158. package/dist/lib/get-input/get-wrappers/get-patterns/props.d.ts +0 -7
  159. package/dist/lib/get-input/get-wrappers/get-patterns/props.js +0 -43
  160. package/dist/lib/get-input/get-wrappers/get-patterns/read-json-safe.d.ts +0 -4
  161. package/dist/lib/get-input/get-wrappers/get-patterns/read-json-safe.js +0 -41
  162. package/dist/lib/get-input/get-wrappers/get-patterns/read-yaml-safe.d.ts +0 -3
  163. package/dist/lib/get-input/get-wrappers/index.d.ts +0 -38
  164. package/dist/lib/get-input/get-wrappers/index.js +0 -40
  165. package/dist/lib/get-input/get-wrappers/readonly.d.ts +0 -4
  166. package/dist/lib/get-input/get-wrappers/readonly.js +0 -10
  167. package/dist/lib/get-input/get-wrappers/tap.d.ts +0 -15
  168. package/dist/lib/get-input/get-wrappers/tap.js +0 -56
  169. package/dist/lib/get-input/get-wrappers/try-catch.d.ts +0 -5
  170. package/dist/lib/get-input/get-wrappers/try-catch.js +0 -13
  171. package/dist/lib/get-input/index.d.ts +0 -20
  172. package/dist/lib/get-input/index.js +0 -32
  173. package/dist/lib/group-by.d.ts +0 -1
  174. package/dist/lib/group-by.js +0 -11
  175. package/dist/lib/write-if-changed/index.d.ts +0 -10
  176. package/dist/lib/write-if-changed/index.js +0 -25
  177. package/dist/lib/write-if-changed/set-newlines.d.ts +0 -4
  178. package/dist/lib/write-if-changed/set-newlines.js +0 -24
  179. package/dist/types/index.d.ts +0 -77
  180. package/dist/types/semver-group.d.ts +0 -30
  181. package/dist/types/version-group.d.ts +0 -35
  182. package/dist/types/version-group.js +0 -2
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- exports.__esModule = true;
26
- exports.props = void 0;
27
- var function_1 = require("fp-ts/lib/function");
28
- var O = __importStar(require("fp-ts/lib/Option"));
29
- var C = __importStar(require("fp-ts/lib/ReadonlyRecord"));
30
- var S = __importStar(require("fp-ts/lib/State"));
31
- /**
32
- * Safely read nested properties of any value.
33
- * @param keys 'child.grandChild.greatGrandChild'
34
- * @see https://gist.github.com/JamieMason/c0a3b21184cf8c43f76c77878c7c9198
35
- */
36
- function props(keys) {
37
- return function getNestedProp(obj) {
38
- return (0, function_1.pipe)(keys.split('.'), S.traverseArray(function (key) {
39
- return S.modify(O.chain(C.lookup(key)));
40
- }), S.execute(O.fromNullable(obj)));
41
- };
42
- }
43
- exports.props = props;
@@ -1,4 +0,0 @@
1
- import * as E from 'fp-ts/lib/Either';
2
- import type { SourceWrapper } from '..';
3
- import type { Disk } from '../../../../lib/disk';
4
- export declare function readJsonSafe(disk: Disk): (filePath: string) => E.Either<Error | SyntaxError, SourceWrapper>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- exports.__esModule = true;
26
- exports.readJsonSafe = void 0;
27
- var Json_1 = require("fp-ts/Json");
28
- var E = __importStar(require("fp-ts/lib/Either"));
29
- var function_1 = require("fp-ts/lib/function");
30
- var try_catch_1 = require("../try-catch");
31
- function readJsonSafe(disk) {
32
- return function (filePath) {
33
- return (0, function_1.pipe)(readFileSafe(filePath), E.chain(function (json) {
34
- return (0, function_1.pipe)((0, Json_1.parse)(json), E.mapLeft((0, try_catch_1.getErrorOrElse)("Failed to parse JSON file at ".concat(filePath))), E.map(function (contents) { return ({ contents: contents, filePath: filePath, json: json }); }));
35
- }));
36
- };
37
- function readFileSafe(filePath) {
38
- return E.tryCatch(function () { return disk.readFileSync(filePath); }, (0, try_catch_1.getErrorOrElse)("Failed to read JSON file at ".concat(filePath)));
39
- }
40
- }
41
- exports.readJsonSafe = readJsonSafe;
@@ -1,3 +0,0 @@
1
- import * as E from 'fp-ts/lib/Either';
2
- import type { Disk } from '../../../../lib/disk';
3
- export declare function readYamlSafe<T = unknown>(disk: Disk): (filePath: string) => E.Either<Error, T>;
@@ -1,38 +0,0 @@
1
- import type { SyncpackConfig } from '../../../types';
2
- import type { Disk } from '../../../lib/disk';
3
- export interface Source {
4
- bugs?: {
5
- url: string;
6
- } | string;
7
- dependencies?: Record<string, string>;
8
- description?: string;
9
- devDependencies?: Record<string, string>;
10
- keywords?: string[];
11
- name?: string;
12
- peerDependencies?: Record<string, string>;
13
- pnpm?: {
14
- overrides?: Record<string, string>;
15
- };
16
- repository?: {
17
- directory?: string;
18
- type: string;
19
- url: string;
20
- } | string;
21
- resolutions?: Record<string, string>;
22
- scripts?: Record<string, string>;
23
- version?: string;
24
- workspaces?: Record<string, string[]> | string[];
25
- [otherProps: string]: Record<string, string | string[] | Record<string, string | string[]>> | string | string[] | undefined;
26
- }
27
- export interface SourceWrapper {
28
- /** the absolute path on disk to this package.json file */
29
- readonly filePath: string;
30
- /** the parsed JSON contents of this package.json file */
31
- contents: Source;
32
- /** the raw file contents of this package.json file */
33
- readonly json: string;
34
- }
35
- /**
36
- * Read the file contents and metadata for every package.json file needed.
37
- */
38
- export declare function getWrappers(disk: Disk, program: SyncpackConfig): SourceWrapper[];
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- exports.__esModule = true;
26
- exports.getWrappers = void 0;
27
- var E = __importStar(require("fp-ts/lib/Either"));
28
- var function_1 = require("fp-ts/lib/function");
29
- var O = __importStar(require("fp-ts/lib/Option"));
30
- var get_file_paths_1 = require("./get-file-paths");
31
- var read_json_safe_1 = require("./get-patterns/read-json-safe");
32
- var readonly_1 = require("./readonly");
33
- /**
34
- * Read the file contents and metadata for every package.json file needed.
35
- */
36
- function getWrappers(disk, program) {
37
- var useEmpty = function () { return []; };
38
- return (0, function_1.pipe)((0, get_file_paths_1.getFilePaths)(disk, program), E.chain((0, function_1.flow)(O.getOrElse(useEmpty), E.traverseArray((0, read_json_safe_1.readJsonSafe)(disk)), E.map(readonly_1.removeReadonlyType))), E.fold(useEmpty, function (wrappers) { return wrappers; }));
39
- }
40
- exports.getWrappers = getWrappers;
@@ -1,4 +0,0 @@
1
- /**
2
- * Remove unwanted readonly type added by TaskEither.traverseArray
3
- */
4
- export declare function removeReadonlyType<T>(value: readonly T[]): T[];
@@ -1,10 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.removeReadonlyType = void 0;
4
- /**
5
- * Remove unwanted readonly type added by TaskEither.traverseArray
6
- */
7
- function removeReadonlyType(value) {
8
- return value;
9
- }
10
- exports.removeReadonlyType = removeReadonlyType;
@@ -1,15 +0,0 @@
1
- import * as O from 'fp-ts/lib/Option';
2
- declare type Fn<T> = (ma: O.Option<T>) => O.Option<T>;
3
- /**
4
- * Log a message when a pipeline contains `None` and let it continue unchanged.
5
- */
6
- export declare function tapNone<T>(message: string): Fn<T>;
7
- /**
8
- * Log a message when a pipeline contains `Some` and let it continue unchanged.
9
- */
10
- export declare function tapSome<T>(message: string): Fn<T>;
11
- /**
12
- * Log both possibilities of an `Option` and let it continue unchanged.
13
- */
14
- export declare function tapOption<T>(message: string): Fn<T>;
15
- export {};
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- exports.__esModule = true;
26
- exports.tapOption = exports.tapSome = exports.tapNone = void 0;
27
- var function_1 = require("fp-ts/lib/function");
28
- var O = __importStar(require("fp-ts/lib/Option"));
29
- var log_1 = require("../../log");
30
- /**
31
- * Log a message when a pipeline contains `None` and let it continue unchanged.
32
- */
33
- function tapNone(message) {
34
- return O.fold(function logNoneValue() {
35
- (0, log_1.verbose)(message);
36
- return O.none;
37
- }, O.of);
38
- }
39
- exports.tapNone = tapNone;
40
- /**
41
- * Log a message when a pipeline contains `Some` and let it continue unchanged.
42
- */
43
- function tapSome(message) {
44
- return O.map(function logSomeValue(value) {
45
- (0, log_1.verbose)(message, value);
46
- return value;
47
- });
48
- }
49
- exports.tapSome = tapSome;
50
- /**
51
- * Log both possibilities of an `Option` and let it continue unchanged.
52
- */
53
- function tapOption(message) {
54
- return (0, function_1.flow)(tapSome(message), tapNone("no ".concat(message)));
55
- }
56
- exports.tapOption = tapOption;
@@ -1,5 +0,0 @@
1
- /**
2
- * When using `Either.tryCatch` or `TaskEither.tryCatch`, prefer using the more
3
- * relevant upstream `Error` when available, otherwise create our own.
4
- */
5
- export declare function getErrorOrElse(message: string): (reason: unknown) => Error;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.getErrorOrElse = void 0;
4
- /**
5
- * When using `Either.tryCatch` or `TaskEither.tryCatch`, prefer using the more
6
- * relevant upstream `Error` when available, otherwise create our own.
7
- */
8
- function getErrorOrElse(message) {
9
- return function onThrow(err) {
10
- return err instanceof Error ? err : new Error(message);
11
- };
12
- }
13
- exports.getErrorOrElse = getErrorOrElse;
@@ -1,20 +0,0 @@
1
- import type { SyncpackConfig } from '../../types';
2
- import type { Disk } from '../../lib/disk';
3
- import type { Instances } from './get-instances';
4
- import type { SourceWrapper } from './get-wrappers';
5
- export declare type ProgramInput = SyncpackConfig & {
6
- disk: Disk;
7
- instances: Instances;
8
- wrappers: SourceWrapper[];
9
- };
10
- /**
11
- * Every command in syncpack should accept the return value of this function as
12
- * its input. The aim here is to move all disk activity to a single place, so
13
- * that the majority of syncpack and its tests don't have to deal with the file
14
- * system and can focus solely on transformation logic.
15
- *
16
- * @param program Options received from CLI arguments
17
- */
18
- export declare function getInput(disk: Disk, program: Partial<SyncpackConfig & {
19
- configPath: string | undefined;
20
- }>): ProgramInput;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- exports.__esModule = true;
14
- exports.getInput = void 0;
15
- var get_config_1 = require("./get-config");
16
- var get_instances_1 = require("./get-instances");
17
- var get_wrappers_1 = require("./get-wrappers");
18
- /**
19
- * Every command in syncpack should accept the return value of this function as
20
- * its input. The aim here is to move all disk activity to a single place, so
21
- * that the majority of syncpack and its tests don't have to deal with the file
22
- * system and can focus solely on transformation logic.
23
- *
24
- * @param program Options received from CLI arguments
25
- */
26
- function getInput(disk, program) {
27
- var config = (0, get_config_1.getConfig)(disk, program);
28
- var wrappers = (0, get_wrappers_1.getWrappers)(disk, config);
29
- var instances = (0, get_instances_1.getInstances)(config, wrappers);
30
- return __assign(__assign({}, config), { disk: disk, instances: instances, wrappers: wrappers });
31
- }
32
- exports.getInput = getInput;
@@ -1 +0,0 @@
1
- export declare function groupBy<T>(key: string, array: T[]): Record<string, T[]>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.groupBy = void 0;
4
- function groupBy(key, array) {
5
- return array.reduce(function (memo, obj) {
6
- var value = obj[key];
7
- memo[value] = (memo[value] || []).concat(obj);
8
- return memo;
9
- }, {});
10
- }
11
- exports.groupBy = groupBy;
@@ -1,10 +0,0 @@
1
- import type { Disk } from '../disk';
2
- import type { Source } from '../get-input/get-wrappers';
3
- interface FileData {
4
- contents: Source;
5
- filePath: string;
6
- indent: string;
7
- json: string;
8
- }
9
- export declare function writeIfChanged(disk: Disk, fileData: FileData): void;
10
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- exports.__esModule = true;
6
- exports.writeIfChanged = void 0;
7
- var chalk_1 = __importDefault(require("chalk"));
8
- var path_1 = require("path");
9
- var constants_1 = require("../../constants");
10
- var set_newlines_1 = require("./set-newlines");
11
- function writeIfChanged(disk, fileData) {
12
- var contents = fileData.contents, filePath = fileData.filePath, indent = fileData.indent, json = fileData.json;
13
- var EOL = (0, set_newlines_1.detectNewlines)(json);
14
- var shortPath = (0, path_1.relative)(constants_1.CWD, filePath);
15
- var source = "".concat(JSON.stringify(contents, null, indent)).concat(EOL);
16
- var after = (0, set_newlines_1.setNewlines)(source, EOL);
17
- if (json !== after) {
18
- disk.writeFileSync(filePath, after);
19
- console.log(chalk_1["default"].green(constants_1.ICON.tick), shortPath);
20
- }
21
- else {
22
- console.log(chalk_1["default"].dim(constants_1.ICON.skip), chalk_1["default"].dim(shortPath));
23
- }
24
- }
25
- exports.writeIfChanged = writeIfChanged;
@@ -1,4 +0,0 @@
1
- declare type Ending = '\n' | '\r' | '\r\n' | string;
2
- export declare function setNewlines(source: string, lineEnding: Ending): string;
3
- export declare function detectNewlines(source: string): Ending;
4
- export {};
@@ -1,24 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
3
- exports.detectNewlines = exports.setNewlines = void 0;
4
- var os_1 = require("os");
5
- var LF = '\n';
6
- var CR = '\r';
7
- var CRLF = '\r\n';
8
- function setNewlines(source, lineEnding) {
9
- return source.replace(/\r\n|\n|\r/g, lineEnding);
10
- }
11
- exports.setNewlines = setNewlines;
12
- function detectNewlines(source) {
13
- var cr = source.split(CR).length;
14
- var lf = source.split(LF).length;
15
- var crlf = source.split(CRLF).length;
16
- if (cr + lf === 0)
17
- return os_1.EOL;
18
- if (crlf === cr && crlf === lf)
19
- return CRLF;
20
- if (cr > lf)
21
- return CR;
22
- return LF;
23
- }
24
- exports.detectNewlines = detectNewlines;
@@ -1,77 +0,0 @@
1
- import type { RANGE_ANY, RANGE_EXACT, RANGE_GT, RANGE_GTE, RANGE_LOOSE, RANGE_LT, RANGE_LTE, RANGE_MINOR, RANGE_PATCH } from '../constants';
2
- import type { AnySemverGroup } from './semver-group';
3
- import type { AnyVersionGroup } from './version-group';
4
- export declare type DependencyType = 'dependencies' | 'devDependencies' | 'overrides' | 'peerDependencies' | 'pnpmOverrides' | 'resolutions' | 'workspace';
5
- export declare type DependencyOption = Pick<SyncpackConfig, 'dev' | 'workspace' | 'overrides' | 'peer' | 'prod' | 'resolutions'>;
6
- export declare type ValidRange = typeof RANGE_ANY | typeof RANGE_EXACT | typeof RANGE_GT | typeof RANGE_GTE | typeof RANGE_LOOSE | typeof RANGE_LT | typeof RANGE_LTE | typeof RANGE_MINOR | typeof RANGE_PATCH;
7
- export interface SyncpackConfig {
8
- /**
9
- * which dependency properties to search within
10
- */
11
- dependencyTypes: DependencyType[];
12
- /**
13
- * whether to search within devDependencies
14
- */
15
- dev: boolean;
16
- /**
17
- * a string which will be passed to `new RegExp()` to match against package
18
- * names that should be included
19
- */
20
- filter: string;
21
- /**
22
- * the character(s) to be used to indent your package.json files when writing
23
- * to disk
24
- */
25
- indent: string;
26
- /**
27
- * whether to search within npm overrides
28
- */
29
- overrides: boolean;
30
- /**
31
- * whether to search within peerDependencies
32
- */
33
- peer: boolean;
34
- /**
35
- * whether to search within pnpm overrides
36
- */
37
- pnpmOverrides: boolean;
38
- /**
39
- * whether to search within dependencies
40
- */
41
- prod: boolean;
42
- /**
43
- * whether to search within yarn resolutions
44
- */
45
- resolutions: boolean;
46
- /**
47
- *
48
- */
49
- semverGroups: AnySemverGroup[];
50
- /**
51
- * defaults to `""` to ensure that exact dependency versions are used instead
52
- * of loose ranges
53
- */
54
- semverRange: ValidRange;
55
- /**
56
- * which fields within package.json files should be sorted alphabetically
57
- */
58
- sortAz: string[];
59
- /**
60
- * which fields within package.json files should appear at the top, and in
61
- * what order
62
- */
63
- sortFirst: string[];
64
- /**
65
- * glob patterns for package.json file locations
66
- */
67
- source: string[];
68
- /**
69
- *
70
- */
71
- versionGroups: AnyVersionGroup[];
72
- /**
73
- * whether to include the versions of the `--source` packages developed in
74
- * your workspace/monorepo as part of the search for versions to sync
75
- */
76
- workspace: boolean;
77
- }
@@ -1,30 +0,0 @@
1
- import type { ValidRange, DependencyType } from '.';
2
- export declare type AnySemverGroup = IgnoredSemverGroup | SemverGroup;
3
- export interface IgnoredSemverGroup extends Base {
4
- /**
5
- * optionally force syncpack to ignore all dependencies in this group
6
- */
7
- isIgnored: true;
8
- }
9
- export interface SemverGroup extends Base {
10
- /**
11
- * the semver range which dependencies in this group should use
12
- */
13
- range: ValidRange;
14
- }
15
- interface Base {
16
- /**
17
- * the names of packages in your monorepo which belong to this group, taken
18
- * from the "name" field in package.json, not the package directory name
19
- */
20
- packages: string[];
21
- /**
22
- * the names of the dependencies (eg. "lodash") which belong to this group
23
- */
24
- dependencies: string[];
25
- /**
26
- * optionally only apply this group to dependencies of the provided types
27
- */
28
- dependencyTypes?: DependencyType[];
29
- }
30
- export {};
@@ -1,35 +0,0 @@
1
- import type { DependencyType } from '.';
2
- export declare type AnyVersionGroup = VersionGroup | BannedVersionGroup | IgnoredVersionGroup | PinnedVersionGroup;
3
- export interface VersionGroup {
4
- /**
5
- * the names of packages in your monorepo which belong to this group, taken
6
- * from the "name" field in package.json, not the package directory name
7
- */
8
- packages: string[];
9
- /**
10
- * the names of the dependencies (eg. "lodash") which belong to this group
11
- */
12
- dependencies: string[];
13
- /**
14
- * optionally only apply this group to dependencies of the provided types
15
- */
16
- dependencyTypes?: DependencyType[];
17
- }
18
- export interface BannedVersionGroup extends VersionGroup {
19
- /**
20
- * optionally force all dependencies in this group to be removed
21
- */
22
- isBanned: true;
23
- }
24
- export interface IgnoredVersionGroup extends VersionGroup {
25
- /**
26
- * optionally force syncpack to ignore all dependencies in this group
27
- */
28
- isIgnored?: true;
29
- }
30
- export interface PinnedVersionGroup extends VersionGroup {
31
- /**
32
- * optionally force all dependencies in this group to have this version
33
- */
34
- pinVersion?: string;
35
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;