syncpack 9.8.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 (59) hide show
  1. package/LICENSE +12 -13
  2. package/dist/bin-fix-mismatches/fix-mismatches.js +5 -4
  3. package/dist/bin-format/format.js +3 -3
  4. package/dist/bin-list/list.js +5 -3
  5. package/dist/bin-list-mismatches/list-mismatches.js +9 -8
  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 -3
  11. package/dist/get-context/get-config/index.js +21 -14
  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 +272 -272
  20. package/dist/get-context/get-config/schema/semver-group.d.ts +18 -18
  21. package/dist/get-context/get-config/schema/version-group.d.ts +40 -40
  22. package/dist/get-context/get-groups/base-group.js +1 -1
  23. package/dist/get-context/get-groups/index.d.ts +2 -3
  24. package/dist/get-context/get-groups/index.js +4 -2
  25. package/dist/get-context/get-groups/version-group/index.d.ts +3 -3
  26. package/dist/get-context/get-groups/version-group/index.js +11 -7
  27. package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.d.ts +2 -3
  28. package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.js +5 -5
  29. package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.d.ts +2 -3
  30. package/dist/get-context/get-groups/version-group/instance-group/get-lowest-version.js +4 -4
  31. package/dist/get-context/get-groups/version-group/instance-group/index.d.ts +8 -9
  32. package/dist/get-context/get-groups/version-group/instance-group/index.js +30 -15
  33. package/dist/get-context/get-package-json-files/get-file-paths.d.ts +2 -3
  34. package/dist/get-context/get-package-json-files/get-file-paths.js +14 -24
  35. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -3
  36. package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.js +6 -5
  37. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -3
  38. package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.js +7 -6
  39. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -3
  40. package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.js +7 -6
  41. package/dist/get-context/get-package-json-files/get-patterns/index.d.ts +2 -3
  42. package/dist/get-context/get-package-json-files/get-patterns/index.js +8 -17
  43. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.d.ts +2 -3
  44. package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.js +6 -9
  45. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.d.ts +2 -3
  46. package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.js +4 -3
  47. package/dist/get-context/get-package-json-files/index.d.ts +2 -3
  48. package/dist/get-context/get-package-json-files/index.js +7 -5
  49. package/dist/get-context/get-package-json-files/package-json-file/index.js +7 -5
  50. package/dist/get-context/get-package-json-files/package-json-file/instance.js +5 -5
  51. package/dist/get-context/index.js +9 -6
  52. package/dist/lib/disk.js +1 -1
  53. package/dist/lib/is-semver.js +1 -1
  54. package/dist/lib/log.js +1 -1
  55. package/package.json +17 -18
  56. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.d.ts +0 -1
  57. package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.js +0 -8
  58. package/dist/get-context/get-package-json-files/get-patterns/props.d.ts +0 -6
  59. package/dist/get-context/get-package-json-files/get-patterns/props.js +0 -24
package/LICENSE CHANGED
@@ -1,21 +1,20 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Jamie Mason
3
+ Copyright (c) 2017-2023 Jamie Mason
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fixMismatches = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_object_1 = require("expect-more/dist/is-object");
6
- const is_undefined_1 = require("expect-more/dist/is-undefined");
4
+ const pipe_1 = require("tightrope/fn/pipe");
5
+ const is_object_1 = require("tightrope/guard/is-object");
6
+ const is_undefined_1 = require("tightrope/guard/is-undefined");
7
+ const tap_1 = require("tightrope/result/tap");
7
8
  const _R_1 = require("../get-context/$R");
8
9
  function fixMismatches(ctx) {
9
10
  ctx.versionGroups.forEach((versionGroup) => {
@@ -14,7 +15,7 @@ function fixMismatches(ctx) {
14
15
  // Set the correct version on each instance.
15
16
  invalidGroups.forEach((instanceGroup) => {
16
17
  if (!instanceGroup.hasUnsupportedVersion()) {
17
- (0, ts_belt_1.pipe)(instanceGroup.getExpectedVersion(), ts_belt_1.R.tap((nextVersion) => {
18
+ (0, pipe_1.pipe)(instanceGroup.getExpectedVersion(), (0, tap_1.tap)((nextVersion) => {
18
19
  instanceGroup.instances.forEach((instance) => instance.setVersion(nextVersion));
19
20
  }), _R_1.$R.tapErrVerbose);
20
21
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.format = void 0;
4
- const is_array_1 = require("expect-more/dist/is-array");
5
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
6
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const is_array_1 = require("tightrope/guard/is-array");
5
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
6
+ const is_object_1 = require("tightrope/guard/is-object");
7
7
  function format(ctx) {
8
8
  const { packageJsonFiles } = ctx;
9
9
  const { sortAz, sortFirst } = ctx.config;
@@ -27,8 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.list = void 0;
30
- const ts_belt_1 = require("@mobily/ts-belt");
31
30
  const chalk_1 = __importDefault(require("chalk"));
31
+ const pipe_1 = require("tightrope/fn/pipe");
32
+ const unwrap_1 = require("tightrope/option/unwrap");
33
+ const tap_1 = require("tightrope/result/tap");
32
34
  const constants_1 = require("../constants");
33
35
  const _R_1 = require("../get-context/$R");
34
36
  const log = __importStar(require("../lib/log"));
@@ -65,7 +67,7 @@ function list(ctx) {
65
67
  console.log((0, chalk_1.default) `{dim -} {white ${instanceGroup.name}} {dim ${instanceGroup.getUniqueVersions()}}`);
66
68
  }
67
69
  function logVersionMismatch(instanceGroup) {
68
- (0, ts_belt_1.pipe)(instanceGroup.getExpectedVersion(), ts_belt_1.R.tap((expectedVersion) => {
70
+ (0, pipe_1.pipe)(instanceGroup.getExpectedVersion(), (0, tap_1.tap)((expectedVersion) => {
69
71
  const uniqueVersions = instanceGroup.getUniqueVersions();
70
72
  console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} ${uniqueVersions
71
73
  .map((version) => version === expectedVersion
@@ -81,7 +83,7 @@ function list(ctx) {
81
83
  console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is banned in this version group}`);
82
84
  }
83
85
  function logUnpinned(instanceGroup) {
84
- const pinVersion = ts_belt_1.O.getExn(instanceGroup.versionGroup.getPinnedVersion());
86
+ const pinVersion = (0, unwrap_1.unwrap)(instanceGroup.versionGroup.getPinnedVersion());
85
87
  console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross} ${instanceGroup.name}} {dim.red is pinned to ${pinVersion} in this version group}`);
86
88
  }
87
89
  function logUnsupportedMismatches(instanceGroup) {
@@ -27,8 +27,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.listMismatches = void 0;
30
- const ts_belt_1 = require("@mobily/ts-belt");
31
30
  const chalk_1 = __importDefault(require("chalk"));
31
+ const unwrap_1 = require("tightrope/option/unwrap");
32
+ const unwrap_2 = require("tightrope/result/unwrap");
32
33
  const log = __importStar(require("../lib/log"));
33
34
  function listMismatches(ctx) {
34
35
  const hasUserGroups = ctx.versionGroups.length > 1;
@@ -77,7 +78,7 @@ function listMismatches(ctx) {
77
78
  }
78
79
  function logUnpinned(instanceGroup) {
79
80
  const name = instanceGroup.name;
80
- const pinVersion = ts_belt_1.O.getExn(instanceGroup.versionGroup.getPinnedVersion());
81
+ const pinVersion = (0, unwrap_1.unwrap)(instanceGroup.versionGroup.getPinnedVersion());
81
82
  log.invalid(name, (0, chalk_1.default) `is pinned in this version group at {reset.green ${pinVersion}}`);
82
83
  // Log each of the dependencies mismatches
83
84
  instanceGroup.instances.forEach((instance) => {
@@ -89,9 +90,9 @@ function listMismatches(ctx) {
89
90
  function logSnappedTo(instanceGroup) {
90
91
  const name = instanceGroup.name;
91
92
  const versionGroup = instanceGroup.versionGroup;
92
- const snappedVersion = ts_belt_1.R.getExn(instanceGroup.getSnappedVersion());
93
- const snappedToPackages = ts_belt_1.O.getExn(versionGroup.getSnappedToPackages()).join(' || ');
94
- const version = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
93
+ const snappedVersion = (0, unwrap_2.unwrap)(instanceGroup.getSnappedVersion());
94
+ const snappedToPackages = (0, unwrap_1.unwrap)(versionGroup.getSnappedToPackages()).join(' || ');
95
+ const version = (0, unwrap_2.unwrap)(instanceGroup.getExpectedVersion());
95
96
  log.invalid(name, (0, chalk_1.default) `should snap to {reset.green ${version}}, used by ${snappedToPackages}`);
96
97
  // Log each of the dependencies mismatches
97
98
  instanceGroup.instances.forEach((instance) => {
@@ -102,9 +103,9 @@ function listMismatches(ctx) {
102
103
  }
103
104
  function logWorkspaceMismatch(instanceGroup) {
104
105
  const name = instanceGroup.name;
105
- const workspaceInstance = ts_belt_1.O.getExn(instanceGroup.getWorkspaceInstance());
106
+ const workspaceInstance = (0, unwrap_2.unwrap)(instanceGroup.getWorkspaceInstance());
106
107
  const shortPath = workspaceInstance?.packageJsonFile.shortPath;
107
- const expected = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
108
+ const expected = (0, unwrap_2.unwrap)(instanceGroup.getExpectedVersion());
108
109
  log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is developed in this repo at ${shortPath}}`);
109
110
  // Log each of the dependencies mismatches
110
111
  instanceGroup.instances.forEach((instance) => {
@@ -118,7 +119,7 @@ function listMismatches(ctx) {
118
119
  const preference = instanceGroup.versionGroup
119
120
  .groupConfig.preferVersion;
120
121
  const direction = preference === 'highestSemver' ? 'highest' : 'lowest';
121
- const expected = ts_belt_1.R.getExn(instanceGroup.getExpectedVersion());
122
+ const expected = (0, unwrap_2.unwrap)(instanceGroup.getExpectedVersion());
122
123
  log.invalid(name, (0, chalk_1.default) `{reset.green ${expected}} {dim is the ${direction} valid semver version in use}`);
123
124
  // Log each of the dependencies mismatches
124
125
  instanceGroup.instances.forEach((instance) => {
@@ -1,13 +1,12 @@
1
- import { R } from '@mobily/ts-belt';
2
- import { BaseError } from '../lib/error';
3
- /** Additional helpers for https://mobily.github.io/ts-belt/api/result */
1
+ import type { AnyResult } from 'tightrope/fn/types';
2
+ import type { Result } from 'tightrope/result';
4
3
  export declare const $R: {
5
4
  /**
6
- * Return a single `R.Ok<output[]>` containing an array of the output of every
7
- * `R.Result` returned by `getResult(input)` which succeeded, or a single
8
- * `R.Error<BaseError>` if none succeeded.
5
+ * Return a single `Ok<output[]>` containing an array of the output of every
6
+ * `Result` returned by `getResult(input)` which succeeded, or a single
7
+ * `Err<BaseError>` if none succeeded.
9
8
  */
10
- onlyOk<Input, Output = Input>(getResult: (value: Input) => R.Result<Output, BaseError>): (inputs: Input[]) => R.Result<Output[], BaseError>;
11
- /** Log verbose only when R.Result is an R.Err */
12
- tapErrVerbose<T extends R.Result<unknown, BaseError>>(result: T): T;
9
+ onlyOk<Input, Output = Input>(getResult: (value: Input) => Result<Output, unknown>): (inputs: Input[]) => Result<Output[], unknown>;
10
+ /** Log verbose only when Result is an Err */
11
+ tapErrVerbose<T extends AnyResult>(result: T): T;
13
12
  };
@@ -1,34 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.$R = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
4
+ const result_1 = require("tightrope/result");
5
+ const is_err_1 = require("tightrope/result/is-err");
6
+ const unwrap_1 = require("tightrope/result/unwrap");
5
7
  const error_1 = require("../lib/error");
6
8
  const log_1 = require("../lib/log");
7
- /** Additional helpers for https://mobily.github.io/ts-belt/api/result */
8
9
  exports.$R = {
9
10
  /**
10
- * Return a single `R.Ok<output[]>` containing an array of the output of every
11
- * `R.Result` returned by `getResult(input)` which succeeded, or a single
12
- * `R.Error<BaseError>` if none succeeded.
11
+ * Return a single `Ok<output[]>` containing an array of the output of every
12
+ * `Result` returned by `getResult(input)` which succeeded, or a single
13
+ * `Err<BaseError>` if none succeeded.
13
14
  */
14
15
  onlyOk(getResult) {
15
16
  return (inputs) => {
16
17
  const outputs = [];
17
18
  for (const value of inputs) {
18
19
  const result = getResult(value);
19
- if (ts_belt_1.R.isError(result))
20
+ if ((0, is_err_1.isErr)(result))
20
21
  continue;
21
- outputs.push(ts_belt_1.R.getExn(result));
22
+ outputs.push((0, unwrap_1.unwrap)(result));
22
23
  }
23
24
  return outputs.length > 0
24
- ? ts_belt_1.R.Ok(outputs)
25
- : ts_belt_1.R.Error(new error_1.BaseError('No R.Ok() returned by $R.onlyOk'));
25
+ ? new result_1.Ok(outputs)
26
+ : new result_1.Err(new error_1.BaseError('No Ok() returned by $R.onlyOk'));
26
27
  };
27
28
  },
28
- /** Log verbose only when R.Result is an R.Err */
29
+ /** Log verbose only when Result is an Err */
29
30
  tapErrVerbose(result) {
30
- if (ts_belt_1.R.isError(result))
31
- (0, log_1.verbose)(result._0.message);
31
+ if ((0, is_err_1.isErr)(result))
32
+ (0, log_1.verbose)(result.value);
32
33
  return result;
33
34
  },
34
35
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCustomTypes = void 0;
4
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const is_object_1 = require("tightrope/guard/is-object");
5
5
  function getCustomTypes({ customTypes, }) {
6
6
  return customTypes
7
7
  ? Object.keys(customTypes)
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEnabledTypes = void 0;
4
- const is_array_of_strings_1 = require("expect-more/dist/is-array-of-strings");
5
- const is_non_empty_array_1 = require("expect-more/dist/is-non-empty-array");
6
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
4
+ const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
5
+ const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
6
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
7
  function getEnabledTypes(allTypes, { dependencyTypes, types }) {
8
8
  const enabledNames = (0, is_non_empty_string_1.isNonEmptyString)(types)
9
9
  ? types.split(',')
@@ -1,9 +1,8 @@
1
- import { R } from '@mobily/ts-belt';
1
+ import type { Result } from 'tightrope/result';
2
2
  import type { Disk } from '../../lib/disk';
3
- import { BaseError } from '../../lib/error';
4
3
  import type { Syncpack } from '../../types';
5
4
  /**
6
5
  * Take all configuration from the command line and config file, combine it, and
7
6
  * set defaults for anything which hasn't been defined.
8
7
  */
9
- export declare function getConfig(disk: Disk, fromCli: Partial<Syncpack.Config.Cli>): R.Result<Syncpack.Config.Private, BaseError>;
8
+ export declare function getConfig(disk: Disk, fromCli: Partial<Syncpack.Config.Cli>): Result<Syncpack.Config.Private>;
@@ -24,7 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getConfig = void 0;
27
- const ts_belt_1 = require("@mobily/ts-belt");
27
+ const pipe_1 = require("tightrope/fn/pipe");
28
+ const is_array_of_objects_1 = require("tightrope/guard/is-array-of-objects");
29
+ const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
30
+ const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
31
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
32
+ const is_string_1 = require("tightrope/guard/is-string");
33
+ const from_try_1 = require("tightrope/result/from-try");
34
+ const map_err_1 = require("tightrope/result/map-err");
28
35
  const error_1 = require("../../lib/error");
29
36
  const log_1 = require("../../lib/log");
30
37
  const get_core_types_1 = require("./get-core-types");
@@ -37,7 +44,7 @@ const ConfigSchema = __importStar(require("./schema"));
37
44
  */
38
45
  function getConfig(disk, fromCli) {
39
46
  const ERR_READING_CONFIG = 'Error reading config';
40
- return (0, ts_belt_1.pipe)(ts_belt_1.R.fromExecution(() => unSafeGetConfig(disk, fromCli)), ts_belt_1.R.mapError(error_1.BaseError.map(ERR_READING_CONFIG)));
47
+ return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => unSafeGetConfig(disk, fromCli)), (0, map_err_1.mapErr)(error_1.BaseError.map(ERR_READING_CONFIG)));
41
48
  }
42
49
  exports.getConfig = getConfig;
43
50
  function unSafeGetConfig(disk, fromCli) {
@@ -45,17 +52,17 @@ function unSafeGetConfig(disk, fromCli) {
45
52
  const fromRcFile = disk.readConfigFileSync(fromCli.configPath);
46
53
  (0, log_1.verbose)('rcfile contents:', fromRcFile);
47
54
  const fromPublic = ConfigSchema.Public.parse({
48
- customTypes: getConfigByName('customTypes'),
55
+ customTypes: getConfigByName('customTypes', is_non_empty_object_1.isNonEmptyObject),
49
56
  dependencyTypes: fromRcFile?.dependencyTypes,
50
- filter: getConfigByName('filter'),
51
- indent: getConfigByName('indent'),
52
- semverGroups: getConfigByName('semverGroups'),
53
- semverRange: getConfigByName('semverRange'),
54
- sortAz: getConfigByName('sortAz'),
55
- sortFirst: getConfigByName('sortFirst'),
56
- source: getConfigByName('source'),
57
+ filter: getConfigByName('filter', is_non_empty_string_1.isNonEmptyString),
58
+ indent: getConfigByName('indent', is_string_1.isString),
59
+ semverGroups: getConfigByName('semverGroups', is_array_of_objects_1.isArrayOfObjects),
60
+ semverRange: getConfigByName('semverRange', is_string_1.isString),
61
+ sortAz: getConfigByName('sortAz', is_array_of_strings_1.isArrayOfStrings),
62
+ sortFirst: getConfigByName('sortFirst', is_array_of_strings_1.isArrayOfStrings),
63
+ source: getConfigByName('source', is_array_of_strings_1.isArrayOfStrings),
57
64
  types: fromCli?.types,
58
- versionGroups: getConfigByName('versionGroups'),
65
+ versionGroups: getConfigByName('versionGroups', is_array_of_objects_1.isArrayOfObjects),
59
66
  });
60
67
  (0, log_1.verbose)('user config:', fromPublic);
61
68
  const coreTypes = (0, get_core_types_1.getCoreTypes)();
@@ -82,10 +89,10 @@ function unSafeGetConfig(disk, fromCli) {
82
89
  allConfig.versionGroups.push(allConfig.defaultVersionGroup);
83
90
  (0, log_1.verbose)('final config:', allConfig);
84
91
  return allConfig;
85
- function getConfigByName(name) {
86
- if (typeof fromCli[name] !== 'undefined')
92
+ function getConfigByName(name, isValid) {
93
+ if (isValid(fromCli[name]))
87
94
  return fromCli[name];
88
- if (typeof fromRcFile[name] !== 'undefined')
95
+ if (isValid(fromRcFile[name]))
89
96
  return fromRcFile[name];
90
97
  }
91
98
  }
@@ -1,4 +1,3 @@
1
- import type { R } from '@mobily/ts-belt';
2
- import { BaseError } from '../../../../lib/error';
1
+ import type { Result } from 'tightrope/result';
3
2
  import type { PackageJsonFile } from '../../../get-package-json-files/package-json-file';
4
- export declare function getNonEmptyStringProp(propPath: string, file: PackageJsonFile): R.Result<string, BaseError>;
3
+ export declare function getNonEmptyStringProp(propPath: string, file: PackageJsonFile): Result<string>;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNonEmptyStringProp = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
4
+ const get_1 = require("tightrope/fn/get");
5
+ const pipe_1 = require("tightrope/fn/pipe");
6
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
+ const filter_1 = require("tightrope/result/filter");
8
+ const map_err_1 = require("tightrope/result/map-err");
6
9
  const error_1 = require("../../../../lib/error");
7
- const props_1 = require("../../../get-package-json-files/get-patterns/props");
8
10
  function getNonEmptyStringProp(propPath, file) {
9
- return (0, ts_belt_1.pipe)(file.contents, (0, props_1.props)(propPath, is_non_empty_string_1.isNonEmptyString), ts_belt_1.O.toResult(new error_1.BaseError(`Failed to get ${propPath} in ${file.shortPath}`)));
11
+ return (0, pipe_1.pipe)((0, get_1.get)(file.contents, ...propPath.split('.')), (0, filter_1.filter)(is_non_empty_string_1.isNonEmptyString, ''), (0, map_err_1.mapErr)(() => new error_1.BaseError(`Failed to get ${propPath} in ${file.shortPath}`)));
10
12
  }
11
13
  exports.getNonEmptyStringProp = getNonEmptyStringProp;
@@ -1,20 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nameAndVersionProps = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const get_1 = require("tightrope/fn/get");
5
+ const pipe_1 = require("tightrope/fn/pipe");
6
+ const and_then_1 = require("tightrope/result/and-then");
7
+ const from_try_1 = require("tightrope/result/from-try");
8
+ const map_1 = require("tightrope/result/map");
9
+ const map_err_1 = require("tightrope/result/map-err");
10
+ const tap_1 = require("tightrope/result/tap");
6
11
  const error_1 = require("../../../lib/error");
7
- const props_1 = require("../../get-package-json-files/get-patterns/props");
8
12
  const get_non_empty_string_prop_1 = require("./lib/get-non-empty-string-prop");
9
13
  exports.nameAndVersionProps = {
10
14
  read(file, pathDef) {
11
- return (0, ts_belt_1.pipe)(
15
+ return (0, pipe_1.pipe)(
12
16
  // get name prop
13
- (0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.namePath, file), ts_belt_1.R.mapError(() => new error_1.BaseError(`Strategy<name~version> failed to get ${pathDef.namePath} in ${file.shortPath}`)),
17
+ (0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.namePath, file), (0, map_err_1.mapErr)(() => new error_1.BaseError(`Strategy<name~version> failed to get ${pathDef.namePath} in ${file.shortPath}`)),
14
18
  // add the version prop
15
- ts_belt_1.R.flatMap((name) => (0, ts_belt_1.pipe)((0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.path, file), ts_belt_1.R.map((version) => ({ name, version })), ts_belt_1.R.mapError(() => new error_1.BaseError(`Strategy<name~version> failed to get ${pathDef.path} in ${file.shortPath}`)))),
19
+ (0, and_then_1.andThen)((name) => (0, pipe_1.pipe)((0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.path, file), (0, map_1.map)((version) => ({ name, version })), (0, map_err_1.mapErr)(() => new error_1.BaseError(`Strategy<name~version> failed to get ${pathDef.path} in ${file.shortPath}`)))),
16
20
  // if both are non empty strings, we can return them
17
- ts_belt_1.R.map(({ name, version }) => [[name, version]]));
21
+ (0, map_1.map)(({ name, version }) => [[name, version]]));
18
22
  },
19
23
  write(file, pathDef, [, version]) {
20
24
  const { contents, shortPath } = file;
@@ -23,14 +27,14 @@ exports.nameAndVersionProps = {
23
27
  const fullPath = pathDef.path.split('.');
24
28
  const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
25
29
  const key = fullPath.slice(-1).join('');
26
- return (0, ts_belt_1.pipe)(contents, (0, props_1.props)(pathToParent, is_object_1.isObject), ts_belt_1.O.toResult(onError()), ts_belt_1.R.tap((parent) => {
30
+ return (0, pipe_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
27
31
  parent[key] = version;
28
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
32
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
29
33
  }
30
34
  else {
31
- return (0, ts_belt_1.pipe)(ts_belt_1.R.fromExecution(() => {
35
+ return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => {
32
36
  contents[pathDef.path] = version;
33
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
37
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
34
38
  }
35
39
  function onError() {
36
40
  const msg = `Strategy<name~version> failed to set ${pathDef.path} in ${shortPath}`;
@@ -1,23 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nameAndVersionString = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
6
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const get_1 = require("tightrope/fn/get");
5
+ const pipe_1 = require("tightrope/fn/pipe");
6
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
+ const result_1 = require("tightrope/result");
8
+ const and_then_1 = require("tightrope/result/and-then");
9
+ const from_try_1 = require("tightrope/result/from-try");
10
+ const map_1 = require("tightrope/result/map");
11
+ const map_err_1 = require("tightrope/result/map-err");
12
+ const tap_1 = require("tightrope/result/tap");
7
13
  const error_1 = require("../../../lib/error");
8
- const props_1 = require("../../get-package-json-files/get-patterns/props");
9
14
  const get_non_empty_string_prop_1 = require("./lib/get-non-empty-string-prop");
10
15
  exports.nameAndVersionString = {
11
16
  read(file, pathDef) {
12
- return (0, ts_belt_1.pipe)(
17
+ return (0, pipe_1.pipe)(
13
18
  // get version prop
14
19
  (0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.path, file),
15
20
  // if it is a non empty string, we can read it
16
- ts_belt_1.R.flatMap((value) => {
21
+ (0, and_then_1.andThen)((value) => {
17
22
  const [name, version] = value.split('@');
18
23
  return (0, is_non_empty_string_1.isNonEmptyString)(name) && (0, is_non_empty_string_1.isNonEmptyString)(version)
19
- ? ts_belt_1.R.Ok([[name, version]])
20
- : ts_belt_1.R.Error(new error_1.BaseError(`Strategy<name@version> failed to get ${pathDef.path} in ${file.shortPath}`));
24
+ ? new result_1.Ok([[name, version]])
25
+ : new result_1.Err(new error_1.BaseError(`Strategy<name@version> failed to get ${pathDef.path} in ${file.shortPath}`));
21
26
  }));
22
27
  },
23
28
  write(file, pathDef, [name, version]) {
@@ -27,14 +32,14 @@ exports.nameAndVersionString = {
27
32
  const fullPath = pathDef.path.split('.');
28
33
  const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
29
34
  const key = fullPath.slice(-1).join('');
30
- return (0, ts_belt_1.pipe)(contents, (0, props_1.props)(pathToParent, is_object_1.isObject), ts_belt_1.O.toResult(onError()), ts_belt_1.R.tap((parent) => {
35
+ return (0, pipe_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
31
36
  parent[key] = `${name}@${version}`;
32
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
37
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
33
38
  }
34
39
  else {
35
- return (0, ts_belt_1.pipe)(ts_belt_1.R.fromExecution(() => {
40
+ return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => {
36
41
  contents[pathDef.path] = `${name}@${version}`;
37
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
42
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
38
43
  }
39
44
  function onError() {
40
45
  const msg = `Strategy<name@version> failed to set ${pathDef.path} in ${shortPath}`;
@@ -1,5 +1,4 @@
1
- import type { R } from '@mobily/ts-belt';
2
- import type { BaseError } from '../../../lib/error';
1
+ import type { Result } from 'tightrope/result';
3
2
  import type { Syncpack } from '../../../types';
4
3
  import type { PackageJsonFile } from '../../get-package-json-files/package-json-file';
5
4
  export type PathDef<T extends Syncpack.PathDefinition['strategy']> = Syncpack.PathDefinition & {
@@ -9,7 +8,7 @@ export type PathDef<T extends Syncpack.PathDefinition['strategy']> = Syncpack.Pa
9
8
  export type Entry = [string, string];
10
9
  export interface Strategy<T extends Syncpack.PathDefinition['strategy']> {
11
10
  /** Read from in-memory package.json file */
12
- read(file: PackageJsonFile, pathDef: PathDef<T>): R.Result<Entry[], BaseError>;
11
+ read(file: PackageJsonFile, pathDef: PathDef<T>): Result<Entry[]>;
13
12
  /** Mutate in-memory package.json file */
14
- write(file: PackageJsonFile, pathDef: PathDef<T>, entry: [string, string | undefined]): R.Result<PackageJsonFile, BaseError>;
13
+ write(file: PackageJsonFile, pathDef: PathDef<T>, entry: [string, string | undefined]): Result<PackageJsonFile>;
15
14
  }
@@ -1,23 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.versionString = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_non_empty_string_1 = require("expect-more/dist/is-non-empty-string");
6
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const get_1 = require("tightrope/fn/get");
5
+ const pipe_1 = require("tightrope/fn/pipe");
6
+ const is_non_empty_string_1 = require("tightrope/guard/is-non-empty-string");
7
+ const result_1 = require("tightrope/result");
8
+ const and_then_1 = require("tightrope/result/and-then");
9
+ const from_try_1 = require("tightrope/result/from-try");
10
+ const map_1 = require("tightrope/result/map");
11
+ const map_err_1 = require("tightrope/result/map-err");
12
+ const tap_1 = require("tightrope/result/tap");
7
13
  const error_1 = require("../../../lib/error");
8
- const props_1 = require("../../get-package-json-files/get-patterns/props");
9
14
  const get_non_empty_string_prop_1 = require("./lib/get-non-empty-string-prop");
10
15
  exports.versionString = {
11
16
  read(file, pathDef) {
12
- return (0, ts_belt_1.pipe)(
17
+ return (0, pipe_1.pipe)(
13
18
  // get version prop
14
19
  (0, get_non_empty_string_prop_1.getNonEmptyStringProp)(pathDef.path, file),
15
20
  // if it is a non empty string, we can read it
16
- ts_belt_1.R.flatMap((version) => {
21
+ (0, and_then_1.andThen)((version) => {
17
22
  const name = pathDef.path.split('.').slice(-1).join('');
18
23
  return (0, is_non_empty_string_1.isNonEmptyString)(version)
19
- ? ts_belt_1.R.Ok([[name, version]])
20
- : ts_belt_1.R.Error(new error_1.BaseError(`Strategy<version> failed to get ${pathDef.path} in ${file.shortPath}`));
24
+ ? new result_1.Ok([[name, version]])
25
+ : new result_1.Err(new error_1.BaseError(`Strategy<version> failed to get ${pathDef.path} in ${file.shortPath}`));
21
26
  }));
22
27
  },
23
28
  write(file, pathDef, [, version]) {
@@ -27,14 +32,14 @@ exports.versionString = {
27
32
  const fullPath = pathDef.path.split('.');
28
33
  const pathToParent = fullPath.slice(0, fullPath.length - 1).join('.');
29
34
  const key = fullPath.slice(-1).join('');
30
- return (0, ts_belt_1.pipe)(contents, (0, props_1.props)(pathToParent, is_object_1.isObject), ts_belt_1.O.toResult(onError()), ts_belt_1.R.tap((parent) => {
35
+ return (0, pipe_1.pipe)((0, get_1.get)(contents, ...pathToParent.split('.')), (0, tap_1.tap)((parent) => {
31
36
  parent[key] = version;
32
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
37
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
33
38
  }
34
39
  else {
35
- return (0, ts_belt_1.pipe)(ts_belt_1.R.fromExecution(() => {
40
+ return (0, pipe_1.pipe)((0, from_try_1.fromTry)(() => {
36
41
  contents[pathDef.path] = version;
37
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
42
+ }), (0, map_err_1.mapErr)(onError), (0, map_1.map)(() => file));
38
43
  }
39
44
  function onError() {
40
45
  const msg = `Strategy<version> failed to set ${pathDef.path} in ${shortPath}`;
@@ -1,23 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.versionsByName = void 0;
4
- const ts_belt_1 = require("@mobily/ts-belt");
5
- const is_non_empty_object_1 = require("expect-more/dist/is-non-empty-object");
6
- const is_object_1 = require("expect-more/dist/is-object");
4
+ const get_1 = require("tightrope/fn/get");
5
+ const pipe_1 = require("tightrope/fn/pipe");
6
+ const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
7
+ const filter_1 = require("tightrope/result/filter");
8
+ const map_1 = require("tightrope/result/map");
9
+ const map_err_1 = require("tightrope/result/map-err");
10
+ const tap_1 = require("tightrope/result/tap");
7
11
  const error_1 = require("../../../lib/error");
8
- const props_1 = require("../../get-package-json-files/get-patterns/props");
9
12
  exports.versionsByName = {
10
13
  read(file, pathDef) {
11
- return (0, ts_belt_1.pipe)(file.contents, (0, props_1.props)(pathDef.path, is_non_empty_object_1.isNonEmptyObject), ts_belt_1.O.map(Object.entries), ts_belt_1.O.toResult(new error_1.BaseError(`Strategy<versionsByName> failed to get ${pathDef.path} in ${file.shortPath}`)));
14
+ return (0, pipe_1.pipe)((0, get_1.get)(file.contents, ...pathDef.path.split('.')), (0, filter_1.filter)((is_non_empty_object_1.isNonEmptyObject), ''), (0, map_1.map)((Object.entries)), (0, map_err_1.mapErr)(() => new error_1.BaseError(`Strategy<versionsByName> failed to get ${pathDef.path} in ${file.shortPath}`)));
12
15
  },
13
16
  write(file, pathDef, [name, version]) {
14
- const { contents, shortPath } = file;
15
- return (0, ts_belt_1.pipe)(contents, (0, props_1.props)(pathDef.path, is_object_1.isObject), ts_belt_1.O.toResult(onError()), ts_belt_1.R.tap((parent) => {
17
+ return (0, pipe_1.pipe)((0, get_1.get)(file.contents, ...pathDef.path.split('.')), (0, tap_1.tap)((parent) => {
16
18
  parent[name] = version;
17
- }), ts_belt_1.R.mapError(onError), ts_belt_1.R.map(() => file));
18
- function onError() {
19
- const msg = `Strategy<versionsByName> failed to set ${pathDef.path} in ${shortPath}`;
20
- return new error_1.BaseError(msg);
21
- }
19
+ }), (0, map_err_1.mapErr)(() => new error_1.BaseError(`Strategy<versionsByName> failed to set ${pathDef.path} in ${file.shortPath}`)), (0, map_1.map)(() => file));
22
20
  },
23
21
  };