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,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const glob_sync_1 = require("../io/glob-sync");
|
|
8
|
-
const get_patterns_1 = require("./get-patterns");
|
|
9
|
-
class NoSourcesFoundError extends effect_1.Data.TaggedClass('NoSourcesFoundError') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import { uniq } from 'tightrope/array/uniq.js';
|
|
3
|
+
import { isNonEmptyArray } from 'tightrope/guard/is-non-empty-array.js';
|
|
4
|
+
import { globSync } from '../io/glob-sync.js';
|
|
5
|
+
import { getPatterns } from './get-patterns/index.js';
|
|
6
|
+
export class NoSourcesFoundError extends Data.TaggedClass('NoSourcesFoundError') {
|
|
10
7
|
}
|
|
11
|
-
exports.NoSourcesFoundError = NoSourcesFoundError;
|
|
12
8
|
/**
|
|
13
9
|
* Using --source options and/or config files on disk from
|
|
14
10
|
* npm/pnpm/yarn/lerna, return an array of absolute paths to every package.json
|
|
@@ -16,12 +12,11 @@ exports.NoSourcesFoundError = NoSourcesFoundError;
|
|
|
16
12
|
*
|
|
17
13
|
* @returns Array of absolute file paths to package.json files
|
|
18
14
|
*/
|
|
19
|
-
function getFilePaths(io, config) {
|
|
20
|
-
return
|
|
21
|
-
?
|
|
22
|
-
:
|
|
15
|
+
export function getFilePaths(io, config) {
|
|
16
|
+
return pipe(Effect.Do, Effect.bind('patterns', () => getPatterns(io, config)), Effect.bind('filePaths', ({ patterns }) => globSync(io, patterns)), Effect.bind('flatFilePaths', ({ filePaths }) => Effect.sync(() => uniq(filePaths.flat()))), Effect.flatMap(({ flatFilePaths, patterns }) => isNonEmptyArray(flatFilePaths)
|
|
17
|
+
? Effect.succeed(flatFilePaths)
|
|
18
|
+
: Effect.fail(new NoSourcesFoundError({
|
|
23
19
|
CWD: io.process.cwd(),
|
|
24
20
|
patterns,
|
|
25
21
|
}))));
|
|
26
22
|
}
|
|
27
|
-
exports.getFilePaths = getFilePaths;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Effect, Option as O } from 'effect';
|
|
2
|
-
import type { Io } from '../../io';
|
|
3
|
-
export declare function getLernaPatterns(io: Io): Effect.Effect<
|
|
2
|
+
import type { Io } from '../../io/index.js';
|
|
3
|
+
export declare function getLernaPatterns(io: Io): Effect.Effect<O.Option<string[]>>;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return (0, effect_1.pipe)((0, read_json_file_sync_1.readJsonFileSync)(io, (0, path_1.join)(io.process.cwd(), 'lerna.json')), effect_1.Effect.map((file) => (0, is_array_of_strings_1.isArrayOfStrings)(file.contents.packages) ? effect_1.Option.some(file.contents.packages) : effect_1.Option.none()), effect_1.Effect.catchTags({
|
|
10
|
-
ReadFileError: () => effect_1.Effect.succeed(effect_1.Option.none()),
|
|
11
|
-
JsonParseError: () => effect_1.Effect.succeed(effect_1.Option.none()),
|
|
1
|
+
import { Effect, Option as O, pipe } from 'effect';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
4
|
+
import { readJsonFileSync } from '../../io/read-json-file-sync.js';
|
|
5
|
+
export function getLernaPatterns(io) {
|
|
6
|
+
return pipe(readJsonFileSync(io, join(io.process.cwd(), 'lerna.json')), Effect.map((file) => isArrayOfStrings(file.contents.packages) ? O.some(file.contents.packages) : O.none()), Effect.catchTags({
|
|
7
|
+
ReadFileError: () => Effect.succeed(O.none()),
|
|
8
|
+
JsonParseError: () => Effect.succeed(O.none()),
|
|
12
9
|
}));
|
|
13
10
|
}
|
|
14
|
-
exports.getLernaPatterns = getLernaPatterns;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Effect, Option as O } from 'effect';
|
|
2
|
-
import { type Io } from '../../io';
|
|
3
|
-
export declare function getPnpmPatterns(io: Io): Effect.Effect<
|
|
2
|
+
import { type Io } from '../../io/index.js';
|
|
3
|
+
export declare function getPnpmPatterns(io: Io): Effect.Effect<O.Option<string[]>>;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const read_yaml_file_sync_1 = require("../../io/read-yaml-file-sync");
|
|
8
|
-
function getPnpmPatterns(io) {
|
|
9
|
-
return (0, effect_1.pipe)(
|
|
1
|
+
import { Effect, Option as O, pipe } from 'effect';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
4
|
+
import { readYamlFileSync } from '../../io/read-yaml-file-sync.js';
|
|
5
|
+
export function getPnpmPatterns(io) {
|
|
6
|
+
return pipe(
|
|
10
7
|
// packages:
|
|
11
8
|
// - "packages/**"
|
|
12
9
|
// - "components/**"
|
|
13
10
|
// - "!**/test/**"
|
|
14
|
-
|
|
15
|
-
ReadYamlFileError: () =>
|
|
11
|
+
readYamlFileSync(io, join(io.process.cwd(), 'pnpm-workspace.yaml')), Effect.map((file) => (isArrayOfStrings(file?.packages) ? O.some(file.packages) : O.none())), Effect.catchTags({
|
|
12
|
+
ReadYamlFileError: () => Effect.succeed(O.none()),
|
|
16
13
|
}));
|
|
17
14
|
}
|
|
18
|
-
exports.getPnpmPatterns = getPnpmPatterns;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Effect, Option as O } from 'effect';
|
|
2
|
-
import type { Io } from '../../io';
|
|
3
|
-
export declare function getYarnPatterns(io: Io): Effect.Effect<
|
|
2
|
+
import type { Io } from '../../io/index.js';
|
|
3
|
+
export declare function getYarnPatterns(io: Io): Effect.Effect<O.Option<string[]>>;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
: (
|
|
14
|
-
|
|
15
|
-
: effect_1.Option.none()), effect_1.Effect.catchTags({
|
|
16
|
-
ReadFileError: () => effect_1.Effect.succeed(effect_1.Option.none()),
|
|
17
|
-
JsonParseError: () => effect_1.Effect.succeed(effect_1.Option.none()),
|
|
1
|
+
import { Effect, Option as O, pipe } from 'effect';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
4
|
+
import { isNonEmptyObject } from 'tightrope/guard/is-non-empty-object.js';
|
|
5
|
+
import { readJsonFileSync } from '../../io/read-json-file-sync.js';
|
|
6
|
+
export function getYarnPatterns(io) {
|
|
7
|
+
return pipe(readJsonFileSync(io, join(io.process.cwd(), 'package.json')), Effect.map((file) => isNonEmptyObject(file.contents.workspaces) &&
|
|
8
|
+
isArrayOfStrings(file.contents.workspaces.packages)
|
|
9
|
+
? O.some(file.contents.workspaces.packages)
|
|
10
|
+
: isArrayOfStrings(file.contents.workspaces)
|
|
11
|
+
? O.some(file.contents.workspaces)
|
|
12
|
+
: O.none()), Effect.catchTags({
|
|
13
|
+
ReadFileError: () => Effect.succeed(O.none()),
|
|
14
|
+
JsonParseError: () => Effect.succeed(O.none()),
|
|
18
15
|
}));
|
|
19
16
|
}
|
|
20
|
-
exports.getYarnPatterns = getYarnPatterns;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { Ctx } from '../../get-context';
|
|
3
|
-
import type { Io } from '../../io';
|
|
2
|
+
import type { Ctx } from '../../get-context/index.js';
|
|
3
|
+
import type { Io } from '../../io/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Find every glob pattern which should be used to find package.json files for
|
|
6
6
|
* this monorepo.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getPatterns(io: Io, config: Ctx['config']): Effect.Effect<
|
|
8
|
+
export declare function getPatterns(io: Io, config: Ctx['config']): Effect.Effect<string[]>;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const get_lerna_patterns_1 = require("./get-lerna-patterns");
|
|
9
|
-
const get_pnpm_patterns_1 = require("./get-pnpm-patterns");
|
|
10
|
-
const get_yarn_patterns_1 = require("./get-yarn-patterns");
|
|
1
|
+
import { Effect, Option as O, pipe } from 'effect';
|
|
2
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
3
|
+
import { getSource } from '../../config/get-source.js';
|
|
4
|
+
import { DEFAULT_CONFIG } from '../../constants.js';
|
|
5
|
+
import { getLernaPatterns } from './get-lerna-patterns.js';
|
|
6
|
+
import { getPnpmPatterns } from './get-pnpm-patterns.js';
|
|
7
|
+
import { getYarnPatterns } from './get-yarn-patterns.js';
|
|
11
8
|
/**
|
|
12
9
|
* Find every glob pattern which should be used to find package.json files for
|
|
13
10
|
* this monorepo.
|
|
14
11
|
*/
|
|
15
|
-
function getPatterns(io, config) {
|
|
16
|
-
return
|
|
12
|
+
export function getPatterns(io, config) {
|
|
13
|
+
return pipe(getCliPatterns(), Effect.flatMap((opt) => (O.isSome(opt) ? Effect.succeed(opt) : getWorkspacePatterns())), Effect.map(O.map(limitToPackageJson)), Effect.map(O.getOrElse(() => [...DEFAULT_CONFIG.source])));
|
|
17
14
|
function getCliPatterns() {
|
|
18
|
-
return
|
|
15
|
+
return pipe(O.some(getSource(config)), O.filter(isArrayOfStrings), Effect.succeed);
|
|
19
16
|
}
|
|
20
17
|
function getWorkspacePatterns() {
|
|
21
|
-
return
|
|
18
|
+
return pipe(getYarnPatterns(io), Effect.flatMap((opt) => (O.isSome(opt) ? Effect.succeed(opt) : getPnpmPatterns(io))), Effect.flatMap((opt) => (O.isSome(opt) ? Effect.succeed(opt) : getLernaPatterns(io))), Effect.map(O.map((patterns) => ['package.json', ...patterns])));
|
|
22
19
|
}
|
|
23
20
|
function limitToPackageJson(patterns) {
|
|
24
21
|
return patterns.map((pattern) => pattern.includes('package.json') ? pattern : `${pattern}/package.json`);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
exports.getPatterns = getPatterns;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type { Ctx } from '../get-context';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { ReadFileError } from '../io/read-file-sync';
|
|
6
|
-
import type { JsonParseError } from '../io/read-json-file-sync';
|
|
7
|
-
import type { NoSourcesFoundError } from './get-file-paths';
|
|
8
|
-
import { PackageJsonFile } from './package-json-file';
|
|
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
|
+
import type { ReadFileError } from '../io/read-file-sync.js';
|
|
6
|
+
import type { JsonParseError } from '../io/read-json-file-sync.js';
|
|
7
|
+
import type { NoSourcesFoundError } from './get-file-paths.js';
|
|
8
|
+
import { PackageJsonFile } from './package-json-file.js';
|
|
9
9
|
/** Create an API for every package.json file needed. */
|
|
10
|
-
export declare function getPackageJsonFiles(io: Io, config: Ctx['config']): Effect.Effect<
|
|
10
|
+
export declare function getPackageJsonFiles(io: Io, config: Ctx['config']): Effect.Effect<PackageJsonFile[], NoSourcesFoundError | GlobError | ReadFileError | JsonParseError>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const read_json_file_sync_1 = require("../io/read-json-file-sync");
|
|
6
|
-
const get_file_paths_1 = require("./get-file-paths");
|
|
7
|
-
const package_json_file_1 = require("./package-json-file");
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import { readJsonFileSync } from '../io/read-json-file-sync.js';
|
|
3
|
+
import { getFilePaths } from './get-file-paths.js';
|
|
4
|
+
import { PackageJsonFile } from './package-json-file.js';
|
|
8
5
|
/** Create an API for every package.json file needed. */
|
|
9
|
-
function getPackageJsonFiles(io, config) {
|
|
10
|
-
return
|
|
6
|
+
export function getPackageJsonFiles(io, config) {
|
|
7
|
+
return pipe(getFilePaths(io, config), Effect.flatMap((filePaths) => Effect.all(filePaths.map((filePath) => readJsonFileSync(io, filePath)))), Effect.map((files) => files.map((file) => new PackageJsonFile(file, config))), Effect.tap((files) => Effect.logDebug(`${files.length} package.json files found`)));
|
|
11
8
|
}
|
|
12
|
-
exports.getPackageJsonFiles = getPackageJsonFiles;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import type { JsonFile } from '../io/read-json-file-sync';
|
|
2
|
+
import type { Strategy } from '../config/get-custom-types.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import { Instance } from '../get-instances/instance.js';
|
|
5
|
+
import type { RcFile } from '../index.js';
|
|
6
|
+
import type { JsonFile } from '../io/read-json-file-sync.js';
|
|
7
7
|
export type PackageJson = {
|
|
8
8
|
bugs?: {
|
|
9
9
|
url: string;
|
|
@@ -43,5 +43,5 @@ export declare class PackageJsonFile {
|
|
|
43
43
|
/** the .name property from the package.json file */
|
|
44
44
|
name: string | undefined;
|
|
45
45
|
constructor(jsonFile: JsonFile<PackageJson>, config: Ctx['config']);
|
|
46
|
-
getInstances(enabledTypes: Strategy.Any[]): Effect.Effect<
|
|
46
|
+
getInstances(enabledTypes: Strategy.Any[]): Effect.Effect<Instance[]>;
|
|
47
47
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const instance_1 = require("../get-instances/instance");
|
|
6
|
-
class PackageJsonFile {
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import { Instance } from '../get-instances/instance.js';
|
|
3
|
+
export class PackageJsonFile {
|
|
7
4
|
/** resolved configuration */
|
|
8
5
|
config;
|
|
9
6
|
/** ensure only one set of instances is ever created and shared */
|
|
@@ -20,14 +17,13 @@ class PackageJsonFile {
|
|
|
20
17
|
}
|
|
21
18
|
getInstances(enabledTypes) {
|
|
22
19
|
if (!this._instances) {
|
|
23
|
-
return
|
|
24
|
-
onSuccess: (instances) =>
|
|
25
|
-
onFailure: () =>
|
|
26
|
-
}),
|
|
20
|
+
return pipe(Effect.all(enabledTypes.map((strategy) => pipe(strategy.read(this), Effect.map((entries) => entries.map(([name, rawSpecifier]) => new Instance(name, rawSpecifier, this, strategy)))))), Effect.map((array) => array.flat()), Effect.tapBoth({
|
|
21
|
+
onSuccess: (instances) => Effect.logDebug(`found ${instances.length} instances in <${this.jsonFile.shortPath}>`),
|
|
22
|
+
onFailure: () => Effect.logError(`failed to get instances from <${this.jsonFile.shortPath}>`),
|
|
23
|
+
}), Effect.catchAll(() => Effect.succeed([])), Effect.tap((instances) => Effect.sync(() => {
|
|
27
24
|
this._instances = instances;
|
|
28
25
|
})));
|
|
29
26
|
}
|
|
30
|
-
return
|
|
27
|
+
return Effect.succeed(this._instances);
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
exports.PackageJsonFile = PackageJsonFile;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Ctx } from '../get-context';
|
|
2
|
-
import type { Instance } from '../get-instances/instance';
|
|
3
|
-
import type { SemverGroup } from '../semver-group';
|
|
4
|
-
import type { VersionGroup } from '../version-group';
|
|
1
|
+
import type { Ctx } from '../get-context/index.js';
|
|
2
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
3
|
+
import type { SemverGroup } from '../semver-group/index.js';
|
|
4
|
+
import type { VersionGroup } from '../version-group/index.js';
|
|
5
5
|
export declare function canAddToGroup(packageJsonFilesByName: Ctx['packageJsonFilesByName'], group: SemverGroup.Any | VersionGroup.Any, instance: Instance): boolean;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const minimatch_1 = require("minimatch");
|
|
5
|
-
const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
|
|
6
|
-
function canAddToGroup(packageJsonFilesByName, group, instance) {
|
|
1
|
+
import { minimatch } from 'minimatch';
|
|
2
|
+
import { isNonEmptyArray } from 'tightrope/guard/is-non-empty-array.js';
|
|
3
|
+
export function canAddToGroup(packageJsonFilesByName, group, instance) {
|
|
7
4
|
const { dependencies, dependencyTypes, packages, specifierTypes } = group.config;
|
|
8
5
|
return (group.canAdd(instance) &&
|
|
9
6
|
matchesDependencyTypes(dependencyTypes, instance) &&
|
|
@@ -11,22 +8,21 @@ function canAddToGroup(packageJsonFilesByName, group, instance) {
|
|
|
11
8
|
matchesDependencies(packageJsonFilesByName, group, dependencies, instance) &&
|
|
12
9
|
matchesSpecifierTypes(specifierTypes, instance));
|
|
13
10
|
}
|
|
14
|
-
exports.canAddToGroup = canAddToGroup;
|
|
15
11
|
function matchesDependencies(packageJsonFilesByName, group, dependencies, instance) {
|
|
16
12
|
// matches if not defined
|
|
17
|
-
if (!
|
|
13
|
+
if (!isNonEmptyArray(dependencies))
|
|
18
14
|
return true;
|
|
19
15
|
return dependencies.some((pattern) => (pattern === '$LOCAL' &&
|
|
20
16
|
instance.name in packageJsonFilesByName &&
|
|
21
17
|
((group.groupType === 'versionGroup' && instance.versionGroup === null) ||
|
|
22
18
|
(group.groupType === 'semverGroup' && instance.semverGroup === null))) ||
|
|
23
|
-
|
|
19
|
+
minimatch(instance.name, pattern));
|
|
24
20
|
}
|
|
25
21
|
function matchesPackages(packages, instance) {
|
|
26
22
|
// matches if not defined
|
|
27
|
-
if (!
|
|
23
|
+
if (!isNonEmptyArray(packages))
|
|
28
24
|
return true;
|
|
29
|
-
return packages.some((pattern) =>
|
|
25
|
+
return packages.some((pattern) => minimatch(instance.pkgName, pattern));
|
|
30
26
|
}
|
|
31
27
|
function matchesDependencyTypes(dependencyTypes, instance) {
|
|
32
28
|
return matchesKnownList(dependencyTypes, instance.strategy.name);
|
|
@@ -36,7 +32,7 @@ function matchesSpecifierTypes(specifierTypes, instance) {
|
|
|
36
32
|
}
|
|
37
33
|
function matchesKnownList(values, value) {
|
|
38
34
|
// matches if not defined
|
|
39
|
-
if (!
|
|
35
|
+
if (!isNonEmptyArray(values))
|
|
40
36
|
return true;
|
|
41
37
|
if (values.join('') === '**')
|
|
42
38
|
return true;
|
|
@@ -50,7 +46,7 @@ function matchesKnownList(values, value) {
|
|
|
50
46
|
positive.push(name);
|
|
51
47
|
}
|
|
52
48
|
});
|
|
53
|
-
if (
|
|
49
|
+
if (isNonEmptyArray(negative) && !negative.includes(value))
|
|
54
50
|
return true;
|
|
55
|
-
return
|
|
51
|
+
return isNonEmptyArray(positive) && positive.includes(value);
|
|
56
52
|
}
|
package/dist/guards/is-semver.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSemver = void 0;
|
|
4
|
-
const is_string_1 = require("tightrope/guard/is-string");
|
|
1
|
+
import { isString } from 'tightrope/guard/is-string.js';
|
|
5
2
|
/** @deprecated migrate to make better use of npm-package-arg */
|
|
6
|
-
function isSemver(version) {
|
|
3
|
+
export function isSemver(version) {
|
|
7
4
|
const range = '(~|\\^|>=|>|<=|<)?';
|
|
8
5
|
const ints = '[0-9]+';
|
|
9
6
|
const intsOrX = '([0-9]+|x)';
|
|
@@ -11,7 +8,6 @@ function isSemver(version) {
|
|
|
11
8
|
const major = new RegExp(`^${range}${ints}$`);
|
|
12
9
|
const minor = new RegExp(`^${range}${ints}${dot}${intsOrX}$`);
|
|
13
10
|
const patch = new RegExp(`^${range}${ints}${dot}${intsOrX}${dot}${intsOrX}$`);
|
|
14
|
-
return (
|
|
11
|
+
return (isString(version) &&
|
|
15
12
|
(version.search(major) !== -1 || version.search(minor) !== -1 || version.search(patch) !== -1));
|
|
16
13
|
}
|
|
17
|
-
exports.isSemver = isSemver;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidSemverRange = void 0;
|
|
4
|
-
const constants_1 = require("../constants");
|
|
1
|
+
import { RANGE } from '../constants.js';
|
|
5
2
|
/** @deprecated migrate to make better use of npm-package-arg */
|
|
6
|
-
function isValidSemverRange(value) {
|
|
7
|
-
return (value ===
|
|
8
|
-
value ===
|
|
9
|
-
value ===
|
|
10
|
-
value ===
|
|
11
|
-
value ===
|
|
12
|
-
value ===
|
|
13
|
-
value ===
|
|
14
|
-
value ===
|
|
15
|
-
value ===
|
|
16
|
-
value ===
|
|
3
|
+
export function isValidSemverRange(value) {
|
|
4
|
+
return (value === RANGE.ANY ||
|
|
5
|
+
value === RANGE.EXACT ||
|
|
6
|
+
value === RANGE.GT ||
|
|
7
|
+
value === RANGE.GTE ||
|
|
8
|
+
value === RANGE.LOOSE ||
|
|
9
|
+
value === RANGE.LT ||
|
|
10
|
+
value === RANGE.LTE ||
|
|
11
|
+
value === RANGE.MINOR ||
|
|
12
|
+
value === RANGE.PATCH ||
|
|
13
|
+
value === RANGE.WORKSPACE);
|
|
17
14
|
}
|
|
18
|
-
exports.isValidSemverRange = isValidSemverRange;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { RcConfig } from './config/types';
|
|
1
|
+
import type { RcConfig } from './config/types.js';
|
|
2
2
|
export type RcFile = Partial<RcConfig>;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Io } from '.';
|
|
3
|
-
declare const AskForChoiceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Io } from './index.js';
|
|
3
|
+
declare const AskForChoiceError_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> & {
|
|
4
4
|
readonly _tag: "AskForChoiceError";
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
declare class AskForChoiceError extends AskForChoiceError_base<{
|
|
7
7
|
readonly error: string;
|
|
8
8
|
}> {
|
|
@@ -10,5 +10,5 @@ declare class AskForChoiceError extends AskForChoiceError_base<{
|
|
|
10
10
|
export declare function askForChoice(opts: {
|
|
11
11
|
message: string;
|
|
12
12
|
choices: string[];
|
|
13
|
-
}): Effect.Effect<
|
|
13
|
+
}): Effect.Effect<string, AskForChoiceError, Io>;
|
|
14
14
|
export {};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
class AskForChoiceError extends effect_1.Data.TaggedClass('AskForChoiceError') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import { IoTag } from './index.js';
|
|
3
|
+
class AskForChoiceError extends Data.TaggedClass('AskForChoiceError') {
|
|
7
4
|
}
|
|
8
|
-
function askForChoice(opts) {
|
|
9
|
-
return
|
|
5
|
+
export function askForChoice(opts) {
|
|
6
|
+
return pipe(IoTag, Effect.flatMap((io) => Effect.tryPromise({
|
|
10
7
|
try: () => io.enquirer
|
|
11
8
|
.prompt({
|
|
12
9
|
type: 'select',
|
|
@@ -18,4 +15,3 @@ function askForChoice(opts) {
|
|
|
18
15
|
catch: (err) => new AskForChoiceError({ error: String(err) }),
|
|
19
16
|
})));
|
|
20
17
|
}
|
|
21
|
-
exports.askForChoice = askForChoice;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Io } from '.';
|
|
3
|
-
declare const AskForInputError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Io } from './index.js';
|
|
3
|
+
declare const AskForInputError_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> & {
|
|
4
4
|
readonly _tag: "AskForInputError";
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
declare class AskForInputError extends AskForInputError_base<{
|
|
7
7
|
readonly error: string;
|
|
8
8
|
}> {
|
|
9
9
|
}
|
|
10
10
|
export declare function askForInput(opts: {
|
|
11
11
|
message: string;
|
|
12
|
-
}): Effect.Effect<
|
|
12
|
+
}): Effect.Effect<string, AskForInputError, Io>;
|
|
13
13
|
export {};
|
package/dist/io/ask-for-input.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
class AskForInputError extends effect_1.Data.TaggedClass('AskForInputError') {
|
|
1
|
+
import { Data, Effect, pipe } from 'effect';
|
|
2
|
+
import { IoTag } from './index.js';
|
|
3
|
+
class AskForInputError extends Data.TaggedClass('AskForInputError') {
|
|
7
4
|
}
|
|
8
|
-
function askForInput(opts) {
|
|
9
|
-
return
|
|
5
|
+
export function askForInput(opts) {
|
|
6
|
+
return pipe(IoTag, Effect.flatMap((io) => Effect.tryPromise({
|
|
10
7
|
try: () => io.enquirer.prompt({
|
|
11
8
|
name: 'version',
|
|
12
9
|
type: 'input',
|
|
@@ -15,4 +12,3 @@ function askForInput(opts) {
|
|
|
15
12
|
catch: (err) => new AskForInputError({ error: String(err) }),
|
|
16
13
|
})));
|
|
17
14
|
}
|
|
18
|
-
exports.askForInput = askForInput;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
export declare function exitIfInvalid(ctx: Ctx): Effect.Effect<
|
|
2
|
+
import type { Ctx } from '../get-context/index.js';
|
|
3
|
+
import { type Io } from './index.js';
|
|
4
|
+
export declare function exitIfInvalid(ctx: Ctx): Effect.Effect<Ctx, never, Io>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
function exitIfInvalid(ctx) {
|
|
7
|
-
return (0, effect_1.pipe)(_1.IoTag, effect_1.Effect.tap((io) => effect_1.Effect.sync(() => {
|
|
1
|
+
import { Effect, pipe } from 'effect';
|
|
2
|
+
import { IoTag } from './index.js';
|
|
3
|
+
export function exitIfInvalid(ctx) {
|
|
4
|
+
return pipe(IoTag, Effect.tap((io) => Effect.sync(() => {
|
|
8
5
|
if (ctx.isInvalid) {
|
|
9
6
|
io.process.exit(1);
|
|
10
7
|
}
|
|
11
|
-
})),
|
|
8
|
+
})), Effect.map(() => ctx));
|
|
12
9
|
}
|
|
13
|
-
exports.exitIfInvalid = exitIfInvalid;
|
package/dist/io/glob-sync.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Io } from '.';
|
|
3
|
-
declare const GlobError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Io } from './index.js';
|
|
3
|
+
declare const GlobError_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> & {
|
|
4
4
|
readonly _tag: "GlobError";
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
6
|
export declare class GlobError extends GlobError_base<{
|
|
7
7
|
readonly error: string;
|
|
8
8
|
}> {
|
|
9
9
|
}
|
|
10
|
-
export declare function globSync(io: Io, patterns: string[]): Effect.Effect<
|
|
10
|
+
export declare function globSync(io: Io, patterns: string[]): Effect.Effect<string[], GlobError>;
|
|
11
11
|
export {};
|
package/dist/io/glob-sync.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.globSync = exports.GlobError = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
class GlobError extends effect_1.Data.TaggedClass('GlobError') {
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
export class GlobError extends Data.TaggedClass('GlobError') {
|
|
6
3
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return effect_1.Effect.try({
|
|
4
|
+
export function globSync(io, patterns) {
|
|
5
|
+
return Effect.try({
|
|
10
6
|
try: () => io.globby.sync(patterns, {
|
|
11
7
|
absolute: true,
|
|
12
8
|
cwd: io.process.cwd(),
|
|
@@ -16,4 +12,3 @@ function globSync(io, patterns) {
|
|
|
16
12
|
catch: (err) => new GlobError({ error: String(err) }),
|
|
17
13
|
});
|
|
18
14
|
}
|
|
19
|
-
exports.globSync = globSync;
|