syncpack 12.2.0 → 12.3.1
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.
- package/README.md +5 -5
- package/dist/bin-fix-mismatches/fix-mismatches.d.ts +9 -9
- package/dist/bin-fix-mismatches/fix-mismatches.js +43 -54
- package/dist/bin-fix-mismatches/index.js +26 -31
- package/dist/bin-format/format.d.ts +6 -4
- package/dist/bin-format/format.js +78 -53
- package/dist/bin-format/index.js +20 -25
- package/dist/bin-lint/index.js +15 -20
- package/dist/bin-lint/lint.d.ts +4 -4
- package/dist/bin-lint/lint.js +51 -19
- package/dist/bin-lint-semver-ranges/index.js +24 -29
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.d.ts +8 -8
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +34 -44
- package/dist/bin-list/index.js +24 -29
- package/dist/bin-list/list.d.ts +7 -7
- package/dist/bin-list/list.js +55 -64
- package/dist/bin-list-mismatches/index.js +24 -29
- package/dist/bin-list-mismatches/list-mismatches.d.ts +10 -10
- package/dist/bin-list-mismatches/list-mismatches.js +62 -70
- package/dist/bin-prompt/index.js +26 -31
- package/dist/bin-prompt/prompt.d.ts +4 -4
- package/dist/bin-prompt/prompt.js +41 -48
- package/dist/bin-set-semver-ranges/index.js +26 -31
- package/dist/bin-set-semver-ranges/set-semver-ranges.d.ts +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +26 -30
- package/dist/bin-update/effects.d.ts +18 -18
- package/dist/bin-update/effects.js +77 -106
- package/dist/bin-update/index.js +23 -28
- package/dist/bin-update/update.d.ts +5 -5
- package/dist/bin-update/update.js +37 -45
- package/dist/bin.js +8 -5
- package/dist/config/get-custom-types.d.ts +9 -9
- package/dist/config/get-custom-types.js +22 -27
- package/dist/config/get-enabled-types.d.ts +8 -8
- package/dist/config/get-enabled-types.js +42 -48
- package/dist/config/get-filter.d.ts +1 -1
- package/dist/config/get-filter.js +6 -9
- package/dist/config/get-indent.d.ts +1 -1
- package/dist/config/get-indent.js +6 -9
- package/dist/config/get-sort-az.d.ts +1 -1
- package/dist/config/get-sort-az.js +6 -17
- package/dist/config/get-sort-exports.d.ts +2 -0
- package/dist/config/get-sort-exports.js +8 -0
- package/dist/config/get-sort-first.d.ts +1 -1
- package/dist/config/get-sort-first.js +6 -8
- package/dist/config/get-source.d.ts +1 -1
- package/dist/config/get-source.js +4 -8
- package/dist/config/tag.d.ts +1 -1
- package/dist/config/tag.js +2 -5
- package/dist/config/types.d.ts +16 -5
- package/dist/config/types.js +1 -2
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +25 -10
- package/dist/error-handlers/default-error-handlers.d.ts +10 -10
- package/dist/error-handlers/default-error-handlers.js +55 -61
- package/dist/get-context/index.d.ts +5 -5
- package/dist/get-context/index.js +13 -17
- package/dist/get-context/lib/key-by.js +1 -5
- package/dist/get-instances/index.d.ts +7 -7
- package/dist/get-instances/index.js +19 -23
- package/dist/get-instances/instance.d.ts +7 -7
- package/dist/get-instances/instance.js +4 -8
- package/dist/get-package-json-files/get-file-paths.d.ts +7 -7
- package/dist/get-package-json-files/get-file-paths.js +10 -15
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-lerna-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-pnpm-patterns.js +8 -12
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.d.ts +2 -2
- package/dist/get-package-json-files/get-patterns/get-yarn-patterns.js +14 -18
- package/dist/get-package-json-files/get-patterns/index.d.ts +3 -3
- package/dist/get-package-json-files/get-patterns/index.js +11 -15
- package/dist/get-package-json-files/index.d.ts +8 -8
- package/dist/get-package-json-files/index.js +6 -10
- package/dist/get-package-json-files/package-json-file.d.ts +6 -6
- package/dist/get-package-json-files/package-json-file.js +8 -12
- package/dist/guards/can-add-to-group.d.ts +4 -4
- package/dist/guards/can-add-to-group.js +10 -14
- package/dist/guards/is-semver.js +3 -7
- package/dist/guards/is-valid-semver-range.d.ts +1 -1
- package/dist/guards/is-valid-semver-range.js +12 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/io/ask-for-choice.d.ts +5 -5
- package/dist/io/ask-for-choice.js +5 -9
- package/dist/io/ask-for-input.d.ts +5 -5
- package/dist/io/ask-for-input.js +5 -9
- package/dist/io/exit-if-invalid.d.ts +3 -3
- package/dist/io/exit-if-invalid.js +5 -9
- package/dist/io/glob-sync.d.ts +5 -5
- package/dist/io/glob-sync.js +4 -9
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +12 -38
- package/dist/io/read-config-file.d.ts +7 -0
- package/dist/io/read-config-file.js +22 -0
- package/dist/io/read-file-sync.d.ts +5 -5
- package/dist/io/read-file-sync.js +4 -9
- package/dist/io/read-json-file-sync.d.ts +8 -8
- package/dist/io/read-json-file-sync.js +10 -16
- package/dist/io/read-yaml-file-sync.d.ts +5 -5
- package/dist/io/read-yaml-file-sync.js +4 -8
- package/dist/io/to-json.d.ts +9 -0
- package/dist/io/to-json.js +29 -0
- package/dist/io/write-file-sync.d.ts +5 -5
- package/dist/io/write-file-sync.js +5 -10
- package/dist/io/write-if-changed.d.ts +4 -10
- package/dist/io/write-if-changed.js +9 -44
- package/dist/lib/format-repository-url.js +1 -5
- package/dist/lib/get-group-header.d.ts +2 -2
- package/dist/lib/get-group-header.js +4 -12
- package/dist/lib/get.d.ts +10 -10
- package/dist/lib/get.js +15 -19
- package/dist/lib/pad-start.js +1 -5
- package/dist/lib/ring-buffer.js +1 -5
- package/dist/lib/set-semver-range.d.ts +1 -1
- package/dist/lib/set-semver-range.js +8 -12
- package/dist/lib/show-help-on-error.js +3 -10
- package/dist/lib/sort-by-name.js +1 -5
- package/dist/lib/with-logger.d.ts +1 -1
- package/dist/lib/with-logger.js +17 -24
- package/dist/option.d.ts +1 -1
- package/dist/option.js +8 -14
- package/dist/report.d.ts +2 -2
- package/dist/report.js +2 -5
- package/dist/schema.json +24 -0
- package/dist/semver-group/create-semver-groups.d.ts +3 -3
- package/dist/semver-group/create-semver-groups.js +28 -32
- package/dist/semver-group/disabled.d.ts +11 -11
- package/dist/semver-group/disabled.js +6 -10
- package/dist/semver-group/filtered-out.d.ts +12 -12
- package/dist/semver-group/filtered-out.js +8 -12
- package/dist/semver-group/ignored.d.ts +11 -11
- package/dist/semver-group/ignored.js +6 -10
- package/dist/semver-group/index.d.ts +6 -7
- package/dist/semver-group/index.js +4 -7
- package/dist/semver-group/with-range.d.ts +11 -11
- package/dist/semver-group/with-range.js +13 -17
- package/dist/specifier/alias.d.ts +5 -5
- package/dist/specifier/alias.js +9 -13
- package/dist/specifier/base.d.ts +7 -7
- package/dist/specifier/base.js +9 -13
- package/dist/specifier/delete.d.ts +5 -5
- package/dist/specifier/delete.js +5 -9
- package/dist/specifier/exact.d.ts +6 -6
- package/dist/specifier/exact.js +7 -11
- package/dist/specifier/file.d.ts +1 -1
- package/dist/specifier/file.js +2 -6
- package/dist/specifier/hosted-git.d.ts +5 -5
- package/dist/specifier/hosted-git.js +9 -13
- package/dist/specifier/index.d.ts +13 -13
- package/dist/specifier/index.js +28 -31
- package/dist/specifier/latest.d.ts +6 -6
- package/dist/specifier/latest.js +7 -11
- package/dist/specifier/lib/non-semver-error.d.ts +5 -5
- package/dist/specifier/lib/non-semver-error.js +3 -7
- package/dist/specifier/lib/parse-specifier.d.ts +1 -1
- package/dist/specifier/lib/parse-specifier.js +4 -11
- package/dist/specifier/lib/specific-registry-result.js +1 -2
- package/dist/specifier/range.d.ts +6 -6
- package/dist/specifier/range.js +7 -11
- package/dist/specifier/tag.d.ts +2 -2
- package/dist/specifier/tag.js +2 -6
- package/dist/specifier/unsupported.d.ts +1 -1
- package/dist/specifier/unsupported.js +2 -6
- package/dist/specifier/url.d.ts +1 -1
- package/dist/specifier/url.js +2 -6
- package/dist/specifier/workspace-protocol.d.ts +7 -7
- package/dist/specifier/workspace-protocol.js +9 -13
- package/dist/strategy/lib/get-non-empty-string-prop.d.ts +2 -2
- package/dist/strategy/lib/get-non-empty-string-prop.js +6 -10
- package/dist/strategy/name-and-version-props.d.ts +4 -4
- package/dist/strategy/name-and-version-props.js +19 -23
- package/dist/strategy/named-version-string.d.ts +4 -4
- package/dist/strategy/named-version-string.js +20 -24
- package/dist/strategy/unnamed-version-string.d.ts +4 -4
- package/dist/strategy/unnamed-version-string.js +17 -21
- package/dist/strategy/versions-by-name.d.ts +4 -4
- package/dist/strategy/versions-by-name.js +11 -15
- package/dist/version-group/banned.d.ts +7 -7
- package/dist/version-group/banned.js +8 -12
- package/dist/version-group/create-version-groups.d.ts +3 -3
- package/dist/version-group/create-version-groups.js +34 -38
- package/dist/version-group/filtered-out.d.ts +8 -8
- package/dist/version-group/filtered-out.js +8 -12
- package/dist/version-group/ignored.d.ts +7 -7
- package/dist/version-group/ignored.js +6 -10
- package/dist/version-group/index.d.ts +9 -10
- package/dist/version-group/index.js +4 -7
- package/dist/version-group/lib/clean.js +4 -11
- package/dist/version-group/lib/delete.js +1 -4
- package/dist/version-group/lib/get-highest-version.d.ts +2 -2
- package/dist/version-group/lib/get-highest-version.js +3 -7
- package/dist/version-group/lib/get-lowest-version.d.ts +2 -2
- package/dist/version-group/lib/get-lowest-version.js +3 -7
- package/dist/version-group/lib/get-preferred-version.d.ts +4 -4
- package/dist/version-group/lib/get-preferred-version.js +17 -24
- package/dist/version-group/lib/get-range-score.js +13 -17
- package/dist/version-group/lib/group-by.js +1 -5
- package/dist/version-group/pinned.d.ts +7 -7
- package/dist/version-group/pinned.js +8 -12
- package/dist/version-group/same-range.d.ts +8 -8
- package/dist/version-group/same-range.js +23 -30
- package/dist/version-group/snapped-to.d.ts +7 -7
- package/dist/version-group/snapped-to.js +20 -24
- package/dist/version-group/standard.d.ts +7 -7
- package/dist/version-group/standard.js +29 -33
- package/package.json +30 -37
- package/dist/io/read-config-file-sync.d.ts +0 -7
- package/dist/io/read-config-file-sync.js +0 -26
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Ctx } from '../get-context';
|
|
1
|
+
import type { Ctx } from '../get-context/index.js';
|
|
2
2
|
export declare function getSource({ cli, rcFile }: Ctx['config']): string[];
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings");
|
|
5
|
-
function getSource({ cli, rcFile }) {
|
|
6
|
-
return (0, is_array_of_strings_1.isArrayOfStrings)(cli.source)
|
|
1
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
2
|
+
export function getSource({ cli, rcFile }) {
|
|
3
|
+
return isArrayOfStrings(cli.source)
|
|
7
4
|
? cli.source
|
|
8
|
-
:
|
|
5
|
+
: isArrayOfStrings(rcFile.source)
|
|
9
6
|
? rcFile.source
|
|
10
7
|
: [];
|
|
11
8
|
}
|
|
12
|
-
exports.getSource = getSource;
|
package/dist/config/tag.d.ts
CHANGED
package/dist/config/tag.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CliConfigTag = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
exports.CliConfigTag = effect_1.Context.Tag();
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
export const CliConfigTag = Context.GenericTag('@services/CliConfigTag');
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CUSTOM_TYPES } from '../constants';
|
|
2
|
-
import type { Specifier } from '../specifier';
|
|
1
|
+
import type { CUSTOM_TYPES } from '../constants.js';
|
|
2
|
+
import type { Specifier } from '../specifier/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Aliases for semver range formats supported by syncpack
|
|
5
5
|
*
|
|
@@ -58,9 +58,6 @@ export declare namespace VersionGroupConfig {
|
|
|
58
58
|
interface SameRange extends GroupConfig {
|
|
59
59
|
policy: 'sameRange';
|
|
60
60
|
}
|
|
61
|
-
interface SnappedTo extends GroupConfig {
|
|
62
|
-
snapTo: string[];
|
|
63
|
-
}
|
|
64
61
|
interface Standard extends GroupConfig {
|
|
65
62
|
preferVersion?: 'highestSemver' | 'lowestSemver';
|
|
66
63
|
}
|
|
@@ -101,14 +98,28 @@ export interface RcConfig {
|
|
|
101
98
|
dependencyTypes: DependencyType[];
|
|
102
99
|
/** @see https://jamiemason.github.io/syncpack/config/filter */
|
|
103
100
|
filter: string;
|
|
101
|
+
/** @see https://jamiemason.github.io/syncpack/config/format-bugs */
|
|
102
|
+
formatBugs: boolean;
|
|
103
|
+
/** @see https://jamiemason.github.io/syncpack/config/format-repository */
|
|
104
|
+
formatRepository: boolean;
|
|
104
105
|
/** @see https://jamiemason.github.io/syncpack/config/indent */
|
|
105
106
|
indent: string;
|
|
107
|
+
/** @see https://jamiemason.github.io/syncpack/config/lint-formatting */
|
|
108
|
+
lintFormatting: boolean;
|
|
109
|
+
/** @see https://jamiemason.github.io/syncpack/config/lint-semver-ranges */
|
|
110
|
+
lintSemverRanges: boolean;
|
|
111
|
+
/** @see https://jamiemason.github.io/syncpack/config/lint-versions */
|
|
112
|
+
lintVersions: boolean;
|
|
106
113
|
/** @see https://jamiemason.github.io/syncpack/config/semver-groups */
|
|
107
114
|
semverGroups: SemverGroupConfig.Any[];
|
|
108
115
|
/** @see https://jamiemason.github.io/syncpack/config/sort-az */
|
|
109
116
|
sortAz: string[];
|
|
117
|
+
/** @see https://jamiemason.github.io/syncpack/config/sort-exports */
|
|
118
|
+
sortExports: string[];
|
|
110
119
|
/** @see https://jamiemason.github.io/syncpack/config/sort-first */
|
|
111
120
|
sortFirst: string[];
|
|
121
|
+
/** @see https://jamiemason.github.io/syncpack/config/sort-packages */
|
|
122
|
+
sortPackages: boolean;
|
|
112
123
|
/** @see https://jamiemason.github.io/syncpack/config/source */
|
|
113
124
|
source: string[];
|
|
114
125
|
/** @see https://jamiemason.github.io/syncpack/config/specifier-types */
|
package/dist/config/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/constants.d.ts
CHANGED
|
@@ -89,10 +89,17 @@ export declare const DEFAULT_CONFIG: {
|
|
|
89
89
|
};
|
|
90
90
|
dependencyTypes: "**"[];
|
|
91
91
|
filter: string;
|
|
92
|
+
formatBugs: true;
|
|
93
|
+
formatRepository: true;
|
|
92
94
|
indent: string;
|
|
95
|
+
lintFormatting: true;
|
|
96
|
+
lintSemverRanges: true;
|
|
97
|
+
lintVersions: true;
|
|
93
98
|
semverGroups: never[];
|
|
94
99
|
sortAz: string[];
|
|
100
|
+
sortExports: string[];
|
|
95
101
|
sortFirst: string[];
|
|
102
|
+
sortPackages: true;
|
|
96
103
|
source: string[];
|
|
97
104
|
specifierTypes: "**"[];
|
|
98
105
|
versionGroups: never[];
|
package/dist/constants.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.CUSTOM_TYPES = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
4
1
|
/** Single source of truth, intended to aid testing or to override */
|
|
5
|
-
|
|
2
|
+
export const CWD = process.env.MOCK_CWD || process.cwd();
|
|
6
3
|
/** Single source of truth for icons used in output */
|
|
7
|
-
|
|
4
|
+
export const ICON = {
|
|
8
5
|
banned: '⦸',
|
|
9
6
|
cross: '✘',
|
|
10
7
|
debug: '?',
|
|
@@ -14,7 +11,7 @@ exports.ICON = {
|
|
|
14
11
|
skip: '-',
|
|
15
12
|
tick: '✓',
|
|
16
13
|
};
|
|
17
|
-
|
|
14
|
+
export const RANGE = {
|
|
18
15
|
ANY: '*',
|
|
19
16
|
EXACT: '',
|
|
20
17
|
GT: '>',
|
|
@@ -26,7 +23,7 @@ exports.RANGE = {
|
|
|
26
23
|
PATCH: '~',
|
|
27
24
|
WORKSPACE: 'workspace:',
|
|
28
25
|
};
|
|
29
|
-
|
|
26
|
+
export const INTERNAL_TYPES = [
|
|
30
27
|
'dev',
|
|
31
28
|
'local',
|
|
32
29
|
'overrides',
|
|
@@ -35,7 +32,7 @@ exports.INTERNAL_TYPES = [
|
|
|
35
32
|
'prod',
|
|
36
33
|
'resolutions',
|
|
37
34
|
];
|
|
38
|
-
|
|
35
|
+
export const CUSTOM_TYPES = {
|
|
39
36
|
dev: {
|
|
40
37
|
strategy: 'versionsByName',
|
|
41
38
|
path: 'devDependencies',
|
|
@@ -66,13 +63,19 @@ exports.CUSTOM_TYPES = {
|
|
|
66
63
|
path: 'resolutions',
|
|
67
64
|
},
|
|
68
65
|
};
|
|
69
|
-
|
|
70
|
-
customTypes:
|
|
66
|
+
export const DEFAULT_CONFIG = {
|
|
67
|
+
customTypes: CUSTOM_TYPES,
|
|
71
68
|
dependencyTypes: ['**'],
|
|
72
69
|
filter: '.',
|
|
70
|
+
formatBugs: true,
|
|
71
|
+
formatRepository: true,
|
|
73
72
|
indent: ' ',
|
|
73
|
+
lintFormatting: true,
|
|
74
|
+
lintSemverRanges: true,
|
|
75
|
+
lintVersions: true,
|
|
74
76
|
semverGroups: [],
|
|
75
77
|
sortAz: [
|
|
78
|
+
'bin',
|
|
76
79
|
'contributors',
|
|
77
80
|
'dependencies',
|
|
78
81
|
'devDependencies',
|
|
@@ -81,7 +84,19 @@ exports.DEFAULT_CONFIG = {
|
|
|
81
84
|
'resolutions',
|
|
82
85
|
'scripts',
|
|
83
86
|
],
|
|
87
|
+
sortExports: [
|
|
88
|
+
'types',
|
|
89
|
+
'node-addons',
|
|
90
|
+
'node',
|
|
91
|
+
'browser',
|
|
92
|
+
'import',
|
|
93
|
+
'require',
|
|
94
|
+
'development',
|
|
95
|
+
'production',
|
|
96
|
+
'default',
|
|
97
|
+
],
|
|
84
98
|
sortFirst: ['name', 'description', 'version', 'author'],
|
|
99
|
+
sortPackages: true,
|
|
85
100
|
source: ['package.json', 'packages/*/package.json'],
|
|
86
101
|
specifierTypes: ['**'],
|
|
87
102
|
versionGroups: [],
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { InvalidCustomTypeError } from '../config/get-custom-types';
|
|
3
|
-
import type { DeprecatedTypesError, RenamedWorkspaceTypeError } from '../config/get-enabled-types';
|
|
4
|
-
import type { NoSourcesFoundError } from '../get-package-json-files/get-file-paths';
|
|
5
|
-
import type { GlobError } from '../io/glob-sync';
|
|
6
|
-
import type { ReadFileError } from '../io/read-file-sync';
|
|
7
|
-
import type { JsonParseError } from '../io/read-json-file-sync';
|
|
8
|
-
import type { WriteFileError } from '../io/write-file-sync';
|
|
9
|
-
import type { SemverGroup } from '../semver-group';
|
|
10
|
-
import type { VersionGroup } from '../version-group';
|
|
11
|
-
type R = Effect.Effect<
|
|
2
|
+
import type { InvalidCustomTypeError } from '../config/get-custom-types.js';
|
|
3
|
+
import type { DeprecatedTypesError, RenamedWorkspaceTypeError } from '../config/get-enabled-types.js';
|
|
4
|
+
import type { NoSourcesFoundError } from '../get-package-json-files/get-file-paths.js';
|
|
5
|
+
import type { GlobError } from '../io/glob-sync.js';
|
|
6
|
+
import type { ReadFileError } from '../io/read-file-sync.js';
|
|
7
|
+
import type { JsonParseError } from '../io/read-json-file-sync.js';
|
|
8
|
+
import type { WriteFileError } from '../io/write-file-sync.js';
|
|
9
|
+
import type { SemverGroup } from '../semver-group/index.js';
|
|
10
|
+
import type { VersionGroup } from '../version-group/index.js';
|
|
11
|
+
type R = Effect.Effect<void>;
|
|
12
12
|
export interface ErrorHandlers {
|
|
13
13
|
DeprecatedTypesError(err: DeprecatedTypesError): R;
|
|
14
14
|
InvalidCustomTypeError(err: InvalidCustomTypeError): R;
|
|
@@ -1,86 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defaultErrorHandlers = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const effect_1 = require("effect");
|
|
9
|
-
const os_1 = require("os");
|
|
10
|
-
exports.defaultErrorHandlers = {
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { EOL } from 'os';
|
|
4
|
+
export const defaultErrorHandlers = {
|
|
11
5
|
// getContext
|
|
12
6
|
GlobError(err) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
].join(
|
|
7
|
+
return Effect.logError([
|
|
8
|
+
chalk.red('An error was found when processing your source globs'),
|
|
9
|
+
chalk.red(' Error:', err.error),
|
|
10
|
+
].join(EOL));
|
|
17
11
|
},
|
|
18
12
|
JsonParseError(err) {
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
].join(
|
|
13
|
+
return Effect.logError([
|
|
14
|
+
chalk.red('An error was found when parsing a JSON file'),
|
|
15
|
+
chalk.red(' File:', err.filePath),
|
|
16
|
+
chalk.red(' Error:', err.error),
|
|
17
|
+
].join(EOL));
|
|
24
18
|
},
|
|
25
19
|
NoSourcesFoundError(err) {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
].join(
|
|
20
|
+
return Effect.logError([
|
|
21
|
+
chalk.red('No package.json files were found'),
|
|
22
|
+
chalk.red(' CWD:', err.CWD),
|
|
23
|
+
chalk.red(' Sources:', err.patterns),
|
|
24
|
+
].join(EOL));
|
|
31
25
|
},
|
|
32
26
|
ReadFileError(err) {
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
].join(
|
|
27
|
+
return Effect.logError([
|
|
28
|
+
chalk.red('An error was found when reading a file'),
|
|
29
|
+
chalk.red(' File:', err.filePath),
|
|
30
|
+
chalk.red(' Error:', err.error),
|
|
31
|
+
].join(EOL));
|
|
38
32
|
},
|
|
39
33
|
// Others
|
|
40
34
|
DeprecatedTypesError(err) {
|
|
41
35
|
const url = 'https://github.com/JamieMason/syncpack/releases/tag/9.0.0';
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
].join(
|
|
36
|
+
return Effect.logError([
|
|
37
|
+
chalk.red(`Your syncpack config file contains values deprecated in ${url}`),
|
|
38
|
+
chalk.red(' Dependency Types:', err.types),
|
|
39
|
+
chalk.red(' Docs: https://jamiemason.github.io/syncpack/config/dependency-types'),
|
|
40
|
+
].join(EOL));
|
|
47
41
|
},
|
|
48
42
|
InvalidCustomTypeError(err) {
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
].join(
|
|
43
|
+
return Effect.logError([
|
|
44
|
+
chalk.red('Your syncpack config file contains an invalid custom type'),
|
|
45
|
+
chalk.red(' Error:', err.reason),
|
|
46
|
+
chalk.red(' Config:', err.config),
|
|
47
|
+
chalk.red(' Docs: https://jamiemason.github.io/syncpack/config/custom-types'),
|
|
48
|
+
].join(EOL));
|
|
55
49
|
},
|
|
56
50
|
RenamedWorkspaceTypeError() {
|
|
57
51
|
const url = 'https://github.com/JamieMason/syncpack/releases/tag/11.2.1';
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
].join(
|
|
52
|
+
return Effect.logError([
|
|
53
|
+
chalk.red(`The "workspace" dependency type was renamed to "local" in ${url}`),
|
|
54
|
+
chalk.red(' Docs: https://jamiemason.github.io/syncpack/config/dependency-types'),
|
|
55
|
+
].join(EOL));
|
|
62
56
|
},
|
|
63
57
|
SemverGroupConfigError(err) {
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
].join(
|
|
58
|
+
return Effect.logError([
|
|
59
|
+
chalk.red('Your semver group config contains an error'),
|
|
60
|
+
chalk.red(' Error:', err.error),
|
|
61
|
+
chalk.red(' Config:', err.config),
|
|
62
|
+
chalk.red(' Docs: https://jamiemason.github.io/syncpack/config/semver-groups'),
|
|
63
|
+
].join(EOL));
|
|
70
64
|
},
|
|
71
65
|
VersionGroupConfigError(err) {
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
].join(
|
|
66
|
+
return Effect.logError([
|
|
67
|
+
chalk.red('Your version group config contains an error'),
|
|
68
|
+
chalk.red(' Error:', err.error),
|
|
69
|
+
chalk.red(' Config:', err.config),
|
|
70
|
+
chalk.red(' Docs: https://jamiemason.github.io/syncpack/config/version-groups'),
|
|
71
|
+
].join(EOL));
|
|
78
72
|
},
|
|
79
73
|
WriteFileError(err) {
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
].join(
|
|
74
|
+
return Effect.logError([
|
|
75
|
+
chalk.red('An error was found when writing to a file'),
|
|
76
|
+
chalk.red(' File:', err.filePath),
|
|
77
|
+
chalk.red(' Error:', err.error),
|
|
78
|
+
].join(EOL));
|
|
85
79
|
},
|
|
86
80
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import type { O } from 'ts-toolbelt';
|
|
3
|
-
import { type CliConfig, type RcConfig } from '../config/types';
|
|
4
|
-
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
5
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file';
|
|
6
|
-
import type { Io } from '../io';
|
|
3
|
+
import { type CliConfig, type RcConfig } from '../config/types.js';
|
|
4
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
5
|
+
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
6
|
+
import type { Io } from '../io/index.js';
|
|
7
7
|
export interface Ctx {
|
|
8
8
|
readonly config: {
|
|
9
9
|
readonly cli: Partial<CliConfig>;
|
|
@@ -19,5 +19,5 @@ interface Input {
|
|
|
19
19
|
cli: Partial<CliConfig>;
|
|
20
20
|
errorHandlers: ErrorHandlers;
|
|
21
21
|
}
|
|
22
|
-
export declare function getContext({ io, cli, errorHandlers }: Input): Effect.Effect<
|
|
22
|
+
export declare function getContext({ io, cli, errorHandlers }: Input): Effect.Effect<Ctx>;
|
|
23
23
|
export {};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function getContext({ io, cli, errorHandlers }) {
|
|
9
|
-
const exitOnError = effect_1.Effect.flatMap(() => effect_1.Effect.failSync(() => io.process.exit(1)));
|
|
10
|
-
return (0, effect_1.pipe)(effect_1.Effect.Do, effect_1.Effect.bind('rcFile', () => (0, read_config_file_sync_1.readConfigFileSync)(io, cli.configPath)), effect_1.Effect.bind('packageJsonFiles', ({ rcFile }) => (0, get_package_json_files_1.getPackageJsonFiles)(io, { cli, rcFile })), effect_1.Effect.map(({ rcFile, packageJsonFiles }) => ({
|
|
1
|
+
import { Effect, flow, pipe } from 'effect';
|
|
2
|
+
import { getPackageJsonFiles } from '../get-package-json-files/index.js';
|
|
3
|
+
import { readConfigFile } from '../io/read-config-file.js';
|
|
4
|
+
import { keyBy } from './lib/key-by.js';
|
|
5
|
+
export function getContext({ io, cli, errorHandlers }) {
|
|
6
|
+
const exitOnError = Effect.flatMap(() => Effect.failSync(() => io.process.exit(1)));
|
|
7
|
+
return pipe(Effect.Do, Effect.bind('rcFile', () => readConfigFile(io, cli.configPath)), Effect.bind('packageJsonFiles', ({ rcFile }) => getPackageJsonFiles(io, { cli, rcFile })), Effect.map(({ rcFile, packageJsonFiles }) => ({
|
|
11
8
|
config: { cli, rcFile },
|
|
12
9
|
isInvalid: false,
|
|
13
10
|
packageJsonFiles,
|
|
14
|
-
packageJsonFilesByName:
|
|
15
|
-
})),
|
|
16
|
-
GlobError:
|
|
17
|
-
JsonParseError:
|
|
18
|
-
NoSourcesFoundError:
|
|
19
|
-
ReadFileError:
|
|
11
|
+
packageJsonFilesByName: keyBy('name', packageJsonFiles),
|
|
12
|
+
})), Effect.catchTags({
|
|
13
|
+
GlobError: flow(errorHandlers.GlobError, exitOnError),
|
|
14
|
+
JsonParseError: flow(errorHandlers.JsonParseError, exitOnError),
|
|
15
|
+
NoSourcesFoundError: flow(errorHandlers.NoSourcesFoundError, exitOnError),
|
|
16
|
+
ReadFileError: flow(errorHandlers.ReadFileError, exitOnError),
|
|
20
17
|
}));
|
|
21
18
|
}
|
|
22
|
-
exports.getContext = getContext;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Convert an array of objects to an object, where each member of the array has
|
|
4
3
|
* a unique value for the given key. The new object keys each object by its
|
|
5
4
|
* value for the given key.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
exports.keyBy = void 0;
|
|
9
|
-
function keyBy(key, array) {
|
|
6
|
+
export function keyBy(key, array) {
|
|
10
7
|
return array.reduce((objectsByKeyValue, obj) => {
|
|
11
8
|
const value = obj[key];
|
|
12
9
|
objectsByKeyValue[value] = obj;
|
|
13
10
|
return objectsByKeyValue;
|
|
14
11
|
}, {});
|
|
15
12
|
}
|
|
16
|
-
exports.keyBy = keyBy;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { ErrorHandlers } from '../error-handlers/default-error-handlers';
|
|
3
|
-
import type { Ctx } from '../get-context';
|
|
4
|
-
import type { Io } from '../io';
|
|
5
|
-
import type { SemverGroup } from '../semver-group';
|
|
6
|
-
import type { VersionGroup } from '../version-group';
|
|
7
|
-
import type { Instance } from './instance';
|
|
2
|
+
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import type { Io } from '../io/index.js';
|
|
5
|
+
import type { SemverGroup } from '../semver-group/index.js';
|
|
6
|
+
import type { VersionGroup } from '../version-group/index.js';
|
|
7
|
+
import type { Instance } from './instance.js';
|
|
8
8
|
interface Instances {
|
|
9
9
|
all: Instance[];
|
|
10
10
|
semverGroups: SemverGroup.Any[];
|
|
11
11
|
versionGroups: VersionGroup.Any[];
|
|
12
12
|
}
|
|
13
|
-
export declare function getInstances(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<
|
|
13
|
+
export declare function getInstances(ctx: Ctx, io: Io, errorHandlers: ErrorHandlers): Effect.Effect<Instances>;
|
|
14
14
|
export {};
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
function getInstances(ctx, io, errorHandlers) {
|
|
11
|
-
const exitOnError = effect_1.Effect.flatMap(() => effect_1.Effect.failSync(() => io.process.exit(1)));
|
|
12
|
-
return (0, effect_1.pipe)(effect_1.Effect.Do, effect_1.Effect.bind('enabledTypes', () => (0, get_enabled_types_1.getEnabledTypes)(ctx.config)), effect_1.Effect.bind('semverGroups', () => (0, create_semver_groups_1.createSemverGroups)(ctx)), effect_1.Effect.bind('versionGroups', () => (0, create_version_groups_1.createVersionGroups)(ctx)), effect_1.Effect.bind('instances', (acc) => (0, effect_1.pipe)(ctx.packageJsonFiles, effect_1.Effect.forEach((file) => file.getInstances(acc.enabledTypes)), effect_1.Effect.map((instancesByFile) => instancesByFile.flat()))), effect_1.Effect.tap(({ instances, semverGroups, versionGroups }) => effect_1.Effect.sync(() => {
|
|
1
|
+
import { Effect, flow, pipe } from 'effect';
|
|
2
|
+
import { getEnabledTypes } from '../config/get-enabled-types.js';
|
|
3
|
+
import { canAddToGroup } from '../guards/can-add-to-group.js';
|
|
4
|
+
import { sortByName } from '../lib/sort-by-name.js';
|
|
5
|
+
import { createSemverGroups } from '../semver-group/create-semver-groups.js';
|
|
6
|
+
import { createVersionGroups } from '../version-group/create-version-groups.js';
|
|
7
|
+
export function getInstances(ctx, io, errorHandlers) {
|
|
8
|
+
const exitOnError = Effect.flatMap(() => Effect.failSync(() => io.process.exit(1)));
|
|
9
|
+
return pipe(Effect.Do, Effect.bind('enabledTypes', () => getEnabledTypes(ctx.config)), Effect.bind('semverGroups', () => createSemverGroups(ctx)), Effect.bind('versionGroups', () => createVersionGroups(ctx)), Effect.bind('instances', (acc) => pipe(ctx.packageJsonFiles, Effect.forEach((file) => file.getInstances(acc.enabledTypes)), Effect.map((instancesByFile) => instancesByFile.flat()))), Effect.tap(({ instances, semverGroups, versionGroups }) => Effect.sync(() => {
|
|
13
10
|
for (const instance of instances) {
|
|
14
11
|
// assign each instance to its semver group, first match wins
|
|
15
12
|
assignToSemverGroup: for (const group of semverGroups) {
|
|
16
|
-
if (
|
|
13
|
+
if (canAddToGroup(ctx.packageJsonFilesByName, group, instance)) {
|
|
17
14
|
instance.semverGroup = group;
|
|
18
15
|
group.instances.push(instance);
|
|
19
16
|
break assignToSemverGroup;
|
|
@@ -21,26 +18,25 @@ function getInstances(ctx, io, errorHandlers) {
|
|
|
21
18
|
}
|
|
22
19
|
// assign each instance to its version group, first match wins
|
|
23
20
|
assignToVersionGroup: for (const group of versionGroups) {
|
|
24
|
-
if (
|
|
21
|
+
if (canAddToGroup(ctx.packageJsonFilesByName, group, instance)) {
|
|
25
22
|
instance.versionGroup = group;
|
|
26
23
|
group.instances.push(instance);
|
|
27
24
|
break assignToVersionGroup;
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
})),
|
|
28
|
+
})), Effect.map(({ instances, semverGroups, versionGroups }) => ({
|
|
32
29
|
all: instances,
|
|
33
30
|
semverGroups: getSortedAndFiltered(semverGroups),
|
|
34
31
|
versionGroups: getSortedAndFiltered(versionGroups),
|
|
35
|
-
})),
|
|
36
|
-
DeprecatedTypesError:
|
|
37
|
-
InvalidCustomTypeError:
|
|
38
|
-
RenamedWorkspaceTypeError:
|
|
39
|
-
SemverGroupConfigError:
|
|
40
|
-
VersionGroupConfigError:
|
|
32
|
+
})), Effect.catchTags({
|
|
33
|
+
DeprecatedTypesError: flow(errorHandlers.DeprecatedTypesError, exitOnError),
|
|
34
|
+
InvalidCustomTypeError: flow(errorHandlers.InvalidCustomTypeError, exitOnError),
|
|
35
|
+
RenamedWorkspaceTypeError: flow(errorHandlers.RenamedWorkspaceTypeError, exitOnError),
|
|
36
|
+
SemverGroupConfigError: flow(errorHandlers.SemverGroupConfigError, exitOnError),
|
|
37
|
+
VersionGroupConfigError: flow(errorHandlers.VersionGroupConfigError, exitOnError),
|
|
41
38
|
}));
|
|
42
39
|
function getSortedAndFiltered(groups) {
|
|
43
|
-
return groups.filter((group) => group.instances.sort(
|
|
40
|
+
return groups.filter((group) => group.instances.sort(sortByName).length > 0);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
|
-
exports.getInstances = getInstances;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Effect } from 'effect';
|
|
2
|
-
import type { Strategy } from '../config/get-custom-types';
|
|
3
|
-
import type { PackageJsonFile } from '../get-package-json-files/package-json-file';
|
|
4
|
-
import type { SemverGroup } from '../semver-group';
|
|
5
|
-
import { Specifier } from '../specifier';
|
|
6
|
-
import type { VersionGroup } from '../version-group';
|
|
7
|
-
import type { Delete } from '../version-group/lib/delete';
|
|
2
|
+
import type { Strategy } from '../config/get-custom-types.js';
|
|
3
|
+
import type { PackageJsonFile } from '../get-package-json-files/package-json-file.js';
|
|
4
|
+
import type { SemverGroup } from '../semver-group/index.js';
|
|
5
|
+
import { Specifier } from '../specifier/index.js';
|
|
6
|
+
import type { VersionGroup } from '../version-group/index.js';
|
|
7
|
+
import type { Delete } from '../version-group/lib/delete.js';
|
|
8
8
|
export declare class Instance {
|
|
9
9
|
/** The name of this dependency */
|
|
10
10
|
name: string;
|
|
@@ -22,5 +22,5 @@ export declare class Instance {
|
|
|
22
22
|
versionGroup: VersionGroup.Any;
|
|
23
23
|
constructor(name: string, rawSpecifier: string, packageJsonFile: PackageJsonFile, strategy: Strategy.Any);
|
|
24
24
|
/** Mutate the package.json file in memory with the latest version specifier */
|
|
25
|
-
write(rawSpecifier: string | Delete): Effect.Effect<
|
|
25
|
+
write(rawSpecifier: string | Delete): Effect.Effect<PackageJsonFile>;
|
|
26
26
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Instance = void 0;
|
|
4
|
-
const specifier_1 = require("../specifier");
|
|
5
|
-
class Instance {
|
|
1
|
+
import { Specifier } from '../specifier/index.js';
|
|
2
|
+
export class Instance {
|
|
6
3
|
/** The name of this dependency */
|
|
7
4
|
name;
|
|
8
5
|
/** The .name property of the package.json file of this instance */
|
|
@@ -24,12 +21,11 @@ class Instance {
|
|
|
24
21
|
this.strategy = strategy;
|
|
25
22
|
this.semverGroup = null;
|
|
26
23
|
this.versionGroup = null;
|
|
27
|
-
this.rawSpecifier =
|
|
24
|
+
this.rawSpecifier = Specifier.create(this, rawSpecifier);
|
|
28
25
|
}
|
|
29
26
|
/** Mutate the package.json file in memory with the latest version specifier */
|
|
30
27
|
write(rawSpecifier) {
|
|
31
|
-
this.rawSpecifier =
|
|
28
|
+
this.rawSpecifier = Specifier.create(this, rawSpecifier);
|
|
32
29
|
return this.strategy.write(this.packageJsonFile, [this.name, this.rawSpecifier.raw]);
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
exports.Instance = Instance;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Ctx } from '../get-context';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
declare const NoSourcesFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Ctx } from '../get-context/index.js';
|
|
3
|
+
import type { GlobError } from '../io/glob-sync.js';
|
|
4
|
+
import type { Io } from '../io/index.js';
|
|
5
|
+
declare const NoSourcesFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Readonly<A> & {
|
|
6
6
|
readonly _tag: "NoSourcesFoundError";
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class NoSourcesFoundError extends NoSourcesFoundError_base<{
|
|
9
9
|
readonly CWD: string;
|
|
10
10
|
readonly patterns: string[];
|
|
@@ -17,5 +17,5 @@ export declare class NoSourcesFoundError extends NoSourcesFoundError_base<{
|
|
|
17
17
|
*
|
|
18
18
|
* @returns Array of absolute file paths to package.json files
|
|
19
19
|
*/
|
|
20
|
-
export declare function getFilePaths(io: Io, config: Ctx['config']): Effect.Effect<
|
|
20
|
+
export declare function getFilePaths(io: Io, config: Ctx['config']): Effect.Effect<string[], GlobError | NoSourcesFoundError>;
|
|
21
21
|
export {};
|