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
package/dist/lib/ring-buffer.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RingBuffer = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* An Array with a maximum size which, once reached, will replace the oldest
|
|
6
3
|
* item when a new one is added.
|
|
7
4
|
*/
|
|
8
|
-
class RingBuffer extends Array {
|
|
5
|
+
export class RingBuffer extends Array {
|
|
9
6
|
cursor;
|
|
10
7
|
fixedLength;
|
|
11
8
|
constructor(fixedLength) {
|
|
@@ -21,4 +18,3 @@ class RingBuffer extends Array {
|
|
|
21
18
|
return this.length;
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
|
-
exports.RingBuffer = RingBuffer;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const is_semver_1 = require("../guards/is-semver");
|
|
7
|
-
const is_valid_semver_range_1 = require("../guards/is-valid-semver-range");
|
|
1
|
+
import { isString } from 'tightrope/guard/is-string.js';
|
|
2
|
+
import { RANGE } from '../constants.js';
|
|
3
|
+
import { isSemver } from '../guards/is-semver.js';
|
|
4
|
+
import { isValidSemverRange } from '../guards/is-valid-semver-range.js';
|
|
8
5
|
/** @deprecated migrate to make better use of npm-package-arg */
|
|
9
|
-
function setSemverRange(semverRange, version) {
|
|
10
|
-
if (!
|
|
6
|
+
export function setSemverRange(semverRange, version) {
|
|
7
|
+
if (!isSemver(version) || !isValidSemverRange(semverRange))
|
|
11
8
|
return version;
|
|
12
9
|
if (semverRange === '*')
|
|
13
10
|
return semverRange;
|
|
14
11
|
const nextVersion = isLooseSemver(version) ? version.replace(/\.x/g, '.0') : version;
|
|
15
12
|
const from1stNumber = nextVersion.search(/[0-9]/);
|
|
16
13
|
const from1stDot = nextVersion.indexOf('.');
|
|
17
|
-
return semverRange ===
|
|
14
|
+
return semverRange === RANGE.LOOSE
|
|
18
15
|
? `${nextVersion.slice(from1stNumber, from1stDot)}.x.x`
|
|
19
16
|
: `${semverRange}${nextVersion.slice(from1stNumber)}`;
|
|
20
17
|
}
|
|
21
|
-
exports.setSemverRange = setSemverRange;
|
|
22
18
|
function isLooseSemver(version) {
|
|
23
|
-
return
|
|
19
|
+
return isString(version) && isSemver(version) && version.search(/\.x(\.|$)/) !== -1;
|
|
24
20
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.showHelpOnError = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
function showHelpOnError(program) {
|
|
9
|
-
program.showHelpAfterError((0, chalk_1.default) `
|
|
1
|
+
import chalk from 'chalk-template';
|
|
2
|
+
export function showHelpOnError(program) {
|
|
3
|
+
program.showHelpAfterError(chalk `
|
|
10
4
|
1. The following options were replaced in syncpack@9.0.0:
|
|
11
5
|
{red
|
|
12
6
|
-p, --prod include dependencies
|
|
@@ -36,4 +30,3 @@ function showHelpOnError(program) {
|
|
|
36
30
|
"dependencyTypes": ["dev", "prod", "peer"]
|
|
37
31
|
}`);
|
|
38
32
|
}
|
|
39
|
-
exports.showHelpOnError = showHelpOnError;
|
package/dist/lib/sort-by-name.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortByName = void 0;
|
|
4
|
-
function sortByName(a, b) {
|
|
1
|
+
export function sortByName(a, b) {
|
|
5
2
|
if (a.name < b.name) {
|
|
6
3
|
return -1;
|
|
7
4
|
}
|
|
@@ -10,4 +7,3 @@ function sortByName(a, b) {
|
|
|
10
7
|
}
|
|
11
8
|
return 0;
|
|
12
9
|
}
|
|
13
|
-
exports.sortByName = sortByName;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
export declare function withLogger(program: Effect.Effect<
|
|
2
|
+
export declare function withLogger(program: Effect.Effect<unknown>): Effect.Effect<unknown, never, never>;
|
package/dist/lib/with-logger.js
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
exports.withLogger = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const effect_1 = require("effect");
|
|
9
|
-
function withLogger(program) {
|
|
10
|
-
const logger = effect_1.Logger.make(({ logLevel, message }) => {
|
|
11
|
-
if (logLevel === effect_1.LogLevel.Info) {
|
|
1
|
+
import chalk from 'chalk-template';
|
|
2
|
+
import { Effect, Logger, LogLevel } from 'effect';
|
|
3
|
+
export function withLogger(program) {
|
|
4
|
+
const logger = Logger.make(({ logLevel, message }) => {
|
|
5
|
+
if (logLevel === LogLevel.Info) {
|
|
12
6
|
globalThis.console.info(message);
|
|
13
7
|
}
|
|
14
|
-
else if (logLevel ===
|
|
15
|
-
globalThis.console.info(
|
|
8
|
+
else if (logLevel === LogLevel.Debug) {
|
|
9
|
+
globalThis.console.info(chalk `{magenta ? %s}`, message);
|
|
16
10
|
}
|
|
17
|
-
else if (logLevel ===
|
|
18
|
-
globalThis.console.error(
|
|
11
|
+
else if (logLevel === LogLevel.Error) {
|
|
12
|
+
globalThis.console.error(chalk `{red ! %s}`, message);
|
|
19
13
|
}
|
|
20
|
-
else if (logLevel ===
|
|
21
|
-
globalThis.console.warn(
|
|
14
|
+
else if (logLevel === LogLevel.Warning) {
|
|
15
|
+
globalThis.console.warn(chalk `{yellow ! %s}`, message);
|
|
22
16
|
}
|
|
23
17
|
else {
|
|
24
|
-
globalThis.console.log(
|
|
18
|
+
globalThis.console.log(chalk `{cyan [%s] %s}`, logLevel, message);
|
|
25
19
|
}
|
|
26
20
|
});
|
|
27
|
-
const layer =
|
|
21
|
+
const layer = Logger.replace(Logger.defaultLogger, logger);
|
|
28
22
|
const logLevel = process.env.SYNCPACK_VERBOSE === 'true'
|
|
29
|
-
?
|
|
23
|
+
? LogLevel.Debug
|
|
30
24
|
: process.env.NODE_ENV === 'test'
|
|
31
|
-
?
|
|
32
|
-
:
|
|
33
|
-
return
|
|
25
|
+
? LogLevel.None
|
|
26
|
+
: LogLevel.Info;
|
|
27
|
+
return Effect.provide(Logger.withMinimumLogLevel(program, logLevel), layer);
|
|
34
28
|
}
|
|
35
|
-
exports.withLogger = withLogger;
|
package/dist/option.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const option: {
|
|
|
3
3
|
readonly filter: readonly ["-f, --filter [pattern]", string];
|
|
4
4
|
readonly indent: readonly ["-i, --indent [value]", `override indentation. defaults to "${string}"`];
|
|
5
5
|
readonly source: readonly ["-s, --source [pattern]", "glob pattern for package.json files to read from", typeof collect, string[]];
|
|
6
|
-
readonly specs: readonly ["-
|
|
6
|
+
readonly specs: readonly ["-S, --specs <names>", string];
|
|
7
7
|
readonly types: readonly ["-t, --types <names>", string];
|
|
8
8
|
};
|
|
9
9
|
declare function collect(value: string, previous: string[]): string[];
|
package/dist/option.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.option = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const constants_1 = require("./constants");
|
|
9
|
-
exports.option = {
|
|
1
|
+
import chalk from 'chalk-template';
|
|
2
|
+
import { DEFAULT_CONFIG } from './constants.js';
|
|
3
|
+
export const option = {
|
|
10
4
|
config: ['-c, --config <path>', 'path to a syncpack config file'],
|
|
11
5
|
filter: [
|
|
12
6
|
'-f, --filter [pattern]',
|
|
13
|
-
|
|
7
|
+
chalk `only include dependencies whose {yellow name} matches this regex`,
|
|
14
8
|
],
|
|
15
|
-
indent: ['-i, --indent [value]', `override indentation. defaults to "${
|
|
9
|
+
indent: ['-i, --indent [value]', `override indentation. defaults to "${DEFAULT_CONFIG.indent}"`],
|
|
16
10
|
source: [
|
|
17
11
|
'-s, --source [pattern]',
|
|
18
12
|
'glob pattern for package.json files to read from',
|
|
@@ -20,12 +14,12 @@ exports.option = {
|
|
|
20
14
|
[],
|
|
21
15
|
],
|
|
22
16
|
specs: [
|
|
23
|
-
'-
|
|
24
|
-
|
|
17
|
+
'-S, --specs <names>',
|
|
18
|
+
chalk `only include dependencies whose version specifier match these types (eg. {yellow specs=latest,range,workspace-protocol})`,
|
|
25
19
|
],
|
|
26
20
|
types: [
|
|
27
21
|
'-t, --types <names>',
|
|
28
|
-
|
|
22
|
+
chalk `only include dependencies matching these types (eg. {yellow types=dev,prod,myCustomType})`,
|
|
29
23
|
],
|
|
30
24
|
};
|
|
31
25
|
function collect(value, previous) {
|
package/dist/report.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Instance } from './get-instances/instance';
|
|
2
|
-
import type { Specifier } from './specifier';
|
|
1
|
+
import type { Instance } from './get-instances/instance.js';
|
|
2
|
+
import type { Specifier } from './specifier/index.js';
|
|
3
3
|
export declare namespace Report {
|
|
4
4
|
export type Any = Semver.Any | Version.Any;
|
|
5
5
|
export namespace Semver {
|
package/dist/report.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Report = void 0;
|
|
4
|
-
var Report;
|
|
1
|
+
export var Report;
|
|
5
2
|
(function (Report) {
|
|
6
3
|
class Excluded {
|
|
7
4
|
_tagGroup = 'Excluded';
|
|
@@ -129,4 +126,4 @@ var Report;
|
|
|
129
126
|
_tag = 'UnsupportedMismatch';
|
|
130
127
|
}
|
|
131
128
|
Report.UnsupportedMismatch = UnsupportedMismatch;
|
|
132
|
-
})(Report || (
|
|
129
|
+
})(Report || (Report = {}));
|
package/dist/schema.json
CHANGED
|
@@ -472,9 +472,24 @@
|
|
|
472
472
|
"filter": {
|
|
473
473
|
"type": "string"
|
|
474
474
|
},
|
|
475
|
+
"formatBugs": {
|
|
476
|
+
"type": "boolean"
|
|
477
|
+
},
|
|
478
|
+
"formatRepository": {
|
|
479
|
+
"type": "boolean"
|
|
480
|
+
},
|
|
475
481
|
"indent": {
|
|
476
482
|
"type": "string"
|
|
477
483
|
},
|
|
484
|
+
"lintFormatting": {
|
|
485
|
+
"type": "boolean"
|
|
486
|
+
},
|
|
487
|
+
"lintSemverRanges": {
|
|
488
|
+
"type": "boolean"
|
|
489
|
+
},
|
|
490
|
+
"lintVersions": {
|
|
491
|
+
"type": "boolean"
|
|
492
|
+
},
|
|
478
493
|
"semverGroups": {
|
|
479
494
|
"items": {
|
|
480
495
|
"$ref": "#/definitions/SemverGroupConfig.Any"
|
|
@@ -487,12 +502,21 @@
|
|
|
487
502
|
},
|
|
488
503
|
"type": "array"
|
|
489
504
|
},
|
|
505
|
+
"sortExports": {
|
|
506
|
+
"items": {
|
|
507
|
+
"type": "string"
|
|
508
|
+
},
|
|
509
|
+
"type": "array"
|
|
510
|
+
},
|
|
490
511
|
"sortFirst": {
|
|
491
512
|
"items": {
|
|
492
513
|
"type": "string"
|
|
493
514
|
},
|
|
494
515
|
"type": "array"
|
|
495
516
|
},
|
|
517
|
+
"sortPackages": {
|
|
518
|
+
"type": "boolean"
|
|
519
|
+
},
|
|
496
520
|
"source": {
|
|
497
521
|
"items": {
|
|
498
522
|
"type": "string"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
export declare function createSemverGroups(ctx: Ctx): Effect.Effect<
|
|
2
|
+
import type { Ctx } from '../get-context/index.js';
|
|
3
|
+
import { SemverGroup } from './index.js';
|
|
4
|
+
export declare function createSemverGroups(ctx: Ctx): Effect.Effect<SemverGroup.Any[], SemverGroup.ConfigError>;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const ignored_1 = require("./ignored");
|
|
14
|
-
const with_range_1 = require("./with-range");
|
|
15
|
-
function createSemverGroups(ctx) {
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import { isArrayOfStrings } from 'tightrope/guard/is-array-of-strings.js';
|
|
3
|
+
import { isNonEmptyArray } from 'tightrope/guard/is-non-empty-array.js';
|
|
4
|
+
import { isNonEmptyString } from 'tightrope/guard/is-non-empty-string.js';
|
|
5
|
+
import { isObject } from 'tightrope/guard/is-object.js';
|
|
6
|
+
import { isValidSemverRange } from '../guards/is-valid-semver-range.js';
|
|
7
|
+
import { DisabledSemverGroup } from './disabled.js';
|
|
8
|
+
import { FilteredOutSemverGroup } from './filtered-out.js';
|
|
9
|
+
import { IgnoredSemverGroup } from './ignored.js';
|
|
10
|
+
import { SemverGroup } from './index.js';
|
|
11
|
+
import { WithRangeSemverGroup } from './with-range.js';
|
|
12
|
+
export function createSemverGroups(ctx) {
|
|
16
13
|
const { rcFile } = ctx.config;
|
|
17
14
|
const semverGroups = [
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
Effect.succeed(new FilteredOutSemverGroup(ctx)),
|
|
16
|
+
Effect.succeed(new WithRangeSemverGroup(false, {
|
|
20
17
|
dependencies: ['**'],
|
|
21
18
|
dependencyTypes: ['local'],
|
|
22
19
|
label: 'the version property of package.json files must always be exact',
|
|
@@ -24,32 +21,32 @@ function createSemverGroups(ctx) {
|
|
|
24
21
|
range: '',
|
|
25
22
|
})),
|
|
26
23
|
];
|
|
27
|
-
if (
|
|
24
|
+
if (isNonEmptyArray(rcFile.semverGroups)) {
|
|
28
25
|
rcFile.semverGroups.forEach((config) => {
|
|
29
|
-
if (!
|
|
30
|
-
return semverGroups.push(
|
|
26
|
+
if (!isObject(config)) {
|
|
27
|
+
return semverGroups.push(Effect.fail(new SemverGroup.ConfigError({
|
|
31
28
|
config,
|
|
32
29
|
error: 'config is not an object',
|
|
33
30
|
})));
|
|
34
31
|
}
|
|
35
32
|
const mutuallyExclusiveProps = ['isIgnored', 'range'].filter((prop) => Boolean(config[prop]));
|
|
36
33
|
if (mutuallyExclusiveProps.length > 1) {
|
|
37
|
-
return semverGroups.push(
|
|
34
|
+
return semverGroups.push(Effect.fail(new SemverGroup.ConfigError({
|
|
38
35
|
config,
|
|
39
36
|
error: `it's unclear what kind of semver group you want, as it contains both ${mutuallyExclusiveProps.join(' and ')}`,
|
|
40
37
|
})));
|
|
41
38
|
}
|
|
42
|
-
const label =
|
|
43
|
-
const dependencyTypes =
|
|
39
|
+
const label = isNonEmptyString(config.label) ? config.label : '';
|
|
40
|
+
const dependencyTypes = isArrayOfStrings(config.dependencyTypes)
|
|
44
41
|
? config.dependencyTypes
|
|
45
42
|
: ['**'];
|
|
46
|
-
const dependencies =
|
|
47
|
-
const packages =
|
|
48
|
-
const specifierTypes =
|
|
43
|
+
const dependencies = isArrayOfStrings(config.dependencies) ? config.dependencies : ['**'];
|
|
44
|
+
const packages = isArrayOfStrings(config.packages) ? config.packages : ['**'];
|
|
45
|
+
const specifierTypes = isArrayOfStrings(config.specifierTypes)
|
|
49
46
|
? config.specifierTypes
|
|
50
47
|
: ['**'];
|
|
51
48
|
if (config.isIgnored === true) {
|
|
52
|
-
semverGroups.push(
|
|
49
|
+
semverGroups.push(Effect.succeed(new IgnoredSemverGroup({
|
|
53
50
|
dependencies,
|
|
54
51
|
dependencyTypes,
|
|
55
52
|
specifierTypes,
|
|
@@ -58,8 +55,8 @@ function createSemverGroups(ctx) {
|
|
|
58
55
|
packages,
|
|
59
56
|
})));
|
|
60
57
|
}
|
|
61
|
-
else if (
|
|
62
|
-
semverGroups.push(
|
|
58
|
+
else if (isValidSemverRange(config.range)) {
|
|
59
|
+
semverGroups.push(Effect.succeed(new WithRangeSemverGroup(false, {
|
|
63
60
|
dependencies,
|
|
64
61
|
dependencyTypes,
|
|
65
62
|
specifierTypes,
|
|
@@ -70,7 +67,7 @@ function createSemverGroups(ctx) {
|
|
|
70
67
|
}
|
|
71
68
|
});
|
|
72
69
|
}
|
|
73
|
-
semverGroups.push(
|
|
70
|
+
semverGroups.push(Effect.succeed(new DisabledSemverGroup(true, {
|
|
74
71
|
dependencies: ['**'],
|
|
75
72
|
dependencyTypes: ['**'],
|
|
76
73
|
specifierTypes: ['**'],
|
|
@@ -78,6 +75,5 @@ function createSemverGroups(ctx) {
|
|
|
78
75
|
packages: ['**'],
|
|
79
76
|
isDisabled: true,
|
|
80
77
|
})));
|
|
81
|
-
return
|
|
78
|
+
return Effect.all(semverGroups);
|
|
82
79
|
}
|
|
83
|
-
exports.createSemverGroups = createSemverGroups;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SemverGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
import type { Specifier } from '../specifier';
|
|
6
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error';
|
|
7
|
-
declare const DisabledSemverGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { SemverGroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
4
|
+
import { Report } from '../report.js';
|
|
5
|
+
import type { Specifier } from '../specifier/index.js';
|
|
6
|
+
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
7
|
+
declare const DisabledSemverGroup_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> & {
|
|
8
8
|
readonly _tag: "Disabled";
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
/**
|
|
11
11
|
* Semver groups are disabled by default and, when that's the case, every
|
|
12
12
|
* instance is assigned to this group. This group will allow anything.
|
|
@@ -19,8 +19,8 @@ export declare class DisabledSemverGroup extends DisabledSemverGroup_base<{
|
|
|
19
19
|
groupType: string;
|
|
20
20
|
constructor(isCatchAll: boolean, config: SemverGroupConfig.Disabled);
|
|
21
21
|
canAdd(_: Instance): boolean;
|
|
22
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<
|
|
23
|
-
inspectAll(): Effect.Effect<
|
|
24
|
-
inspect(instance: Instance): Effect.Effect<
|
|
22
|
+
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
23
|
+
inspectAll(): Effect.Effect<Report.Disabled[], never, never>;
|
|
24
|
+
inspect(instance: Instance): Effect.Effect<Report.Disabled>;
|
|
25
25
|
}
|
|
26
26
|
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.DisabledSemverGroup = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const report_1 = require("../report");
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
6
3
|
/**
|
|
7
4
|
* Semver groups are disabled by default and, when that's the case, every
|
|
8
5
|
* instance is assigned to this group. This group will allow anything.
|
|
9
6
|
*/
|
|
10
|
-
class DisabledSemverGroup extends
|
|
7
|
+
export class DisabledSemverGroup extends Data.TaggedClass('Disabled') {
|
|
11
8
|
groupType = 'semverGroup';
|
|
12
9
|
constructor(isCatchAll, config) {
|
|
13
10
|
super({
|
|
@@ -20,13 +17,12 @@ class DisabledSemverGroup extends effect_1.Data.TaggedClass('Disabled') {
|
|
|
20
17
|
return true;
|
|
21
18
|
}
|
|
22
19
|
getFixed(specifier) {
|
|
23
|
-
return
|
|
20
|
+
return Effect.succeed(specifier);
|
|
24
21
|
}
|
|
25
22
|
inspectAll() {
|
|
26
|
-
return
|
|
23
|
+
return Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
27
24
|
}
|
|
28
25
|
inspect(instance) {
|
|
29
|
-
return
|
|
26
|
+
return Effect.succeed(new Report.Disabled(instance));
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.DisabledSemverGroup = DisabledSemverGroup;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { GroupConfig } from '../config/types';
|
|
3
|
-
import type { Ctx } from '../get-context';
|
|
4
|
-
import type { Instance } from '../get-instances/instance';
|
|
5
|
-
import { Report } from '../report';
|
|
6
|
-
import type { Specifier } from '../specifier';
|
|
7
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error';
|
|
8
|
-
declare const FilteredOutSemverGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { GroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Ctx } from '../get-context/index.js';
|
|
4
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
5
|
+
import { Report } from '../report.js';
|
|
6
|
+
import type { Specifier } from '../specifier/index.js';
|
|
7
|
+
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
8
|
+
declare const FilteredOutSemverGroup_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> & {
|
|
9
9
|
readonly _tag: "FilteredOut";
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
/**
|
|
12
12
|
* Instances which do not match a given `--filter` option are assigned to this
|
|
13
13
|
* group and nothing will be changed.
|
|
@@ -20,8 +20,8 @@ export declare class FilteredOutSemverGroup extends FilteredOutSemverGroup_base<
|
|
|
20
20
|
groupType: string;
|
|
21
21
|
constructor(ctx: Ctx);
|
|
22
22
|
canAdd(instance: Instance): boolean;
|
|
23
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<
|
|
24
|
-
inspectAll(): Effect.Effect<
|
|
25
|
-
inspect(instance: Instance): Effect.Effect<
|
|
23
|
+
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
24
|
+
inspectAll(): Effect.Effect<Report.FilteredOut[], never, never>;
|
|
25
|
+
inspect(instance: Instance): Effect.Effect<Report.FilteredOut>;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const get_filter_1 = require("../config/get-filter");
|
|
6
|
-
const report_1 = require("../report");
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { getFilter } from '../config/get-filter.js';
|
|
3
|
+
import { Report } from '../report.js';
|
|
7
4
|
/**
|
|
8
5
|
* Instances which do not match a given `--filter` option are assigned to this
|
|
9
6
|
* group and nothing will be changed.
|
|
10
7
|
*/
|
|
11
|
-
class FilteredOutSemverGroup extends
|
|
8
|
+
export class FilteredOutSemverGroup extends Data.TaggedClass('FilteredOut') {
|
|
12
9
|
groupType = 'semverGroup';
|
|
13
10
|
constructor(ctx) {
|
|
14
11
|
super({
|
|
@@ -18,7 +15,7 @@ class FilteredOutSemverGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
18
15
|
label: 'Filtered out',
|
|
19
16
|
packages: ['**'],
|
|
20
17
|
},
|
|
21
|
-
filter:
|
|
18
|
+
filter: getFilter(ctx.config),
|
|
22
19
|
instances: [],
|
|
23
20
|
});
|
|
24
21
|
}
|
|
@@ -26,13 +23,12 @@ class FilteredOutSemverGroup extends effect_1.Data.TaggedClass('FilteredOut') {
|
|
|
26
23
|
return instance.name.search(new RegExp(this.filter)) === -1;
|
|
27
24
|
}
|
|
28
25
|
getFixed(specifier) {
|
|
29
|
-
return
|
|
26
|
+
return Effect.succeed(specifier);
|
|
30
27
|
}
|
|
31
28
|
inspectAll() {
|
|
32
|
-
return
|
|
29
|
+
return Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
33
30
|
}
|
|
34
31
|
inspect(instance) {
|
|
35
|
-
return
|
|
32
|
+
return Effect.succeed(new Report.FilteredOut(instance));
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.FilteredOutSemverGroup = FilteredOutSemverGroup;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SemverGroupConfig } from '../config/types';
|
|
3
|
-
import type { Instance } from '../get-instances/instance';
|
|
4
|
-
import { Report } from '../report';
|
|
5
|
-
import type { Specifier } from '../specifier';
|
|
6
|
-
import type { NonSemverError } from '../specifier/lib/non-semver-error';
|
|
7
|
-
declare const IgnoredSemverGroup_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { SemverGroupConfig } from '../config/types.js';
|
|
3
|
+
import type { Instance } from '../get-instances/instance.js';
|
|
4
|
+
import { Report } from '../report.js';
|
|
5
|
+
import type { Specifier } from '../specifier/index.js';
|
|
6
|
+
import type { NonSemverError } from '../specifier/lib/non-semver-error.js';
|
|
7
|
+
declare const IgnoredSemverGroup_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> & {
|
|
8
8
|
readonly _tag: "Ignored";
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
/** Every instance in this group is ignored and nothing will be changed */
|
|
11
11
|
export declare class IgnoredSemverGroup extends IgnoredSemverGroup_base<{
|
|
12
12
|
config: SemverGroupConfig.Ignored;
|
|
@@ -15,8 +15,8 @@ export declare class IgnoredSemverGroup extends IgnoredSemverGroup_base<{
|
|
|
15
15
|
groupType: string;
|
|
16
16
|
constructor(config: SemverGroupConfig.Ignored);
|
|
17
17
|
canAdd(_: Instance): boolean;
|
|
18
|
-
getFixed(specifier: Specifier.Any): Effect.Effect<
|
|
19
|
-
inspectAll(): Effect.Effect<
|
|
20
|
-
inspect(instance: Instance): Effect.Effect<
|
|
18
|
+
getFixed(specifier: Specifier.Any): Effect.Effect<Specifier.Any, NonSemverError>;
|
|
19
|
+
inspectAll(): Effect.Effect<Report.Ignored[], never, never>;
|
|
20
|
+
inspect(instance: Instance): Effect.Effect<Report.Ignored>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.IgnoredSemverGroup = void 0;
|
|
4
|
-
const effect_1 = require("effect");
|
|
5
|
-
const report_1 = require("../report");
|
|
1
|
+
import { Data, Effect } from 'effect';
|
|
2
|
+
import { Report } from '../report.js';
|
|
6
3
|
/** Every instance in this group is ignored and nothing will be changed */
|
|
7
|
-
class IgnoredSemverGroup extends
|
|
4
|
+
export class IgnoredSemverGroup extends Data.TaggedClass('Ignored') {
|
|
8
5
|
groupType = 'semverGroup';
|
|
9
6
|
constructor(config) {
|
|
10
7
|
super({
|
|
@@ -16,13 +13,12 @@ class IgnoredSemverGroup extends effect_1.Data.TaggedClass('Ignored') {
|
|
|
16
13
|
return true;
|
|
17
14
|
}
|
|
18
15
|
getFixed(specifier) {
|
|
19
|
-
return
|
|
16
|
+
return Effect.succeed(specifier);
|
|
20
17
|
}
|
|
21
18
|
inspectAll() {
|
|
22
|
-
return
|
|
19
|
+
return Effect.all(this.instances.map((instance) => this.inspect(instance)));
|
|
23
20
|
}
|
|
24
21
|
inspect(instance) {
|
|
25
|
-
return
|
|
22
|
+
return Effect.succeed(new Report.Ignored(instance));
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
|
-
exports.IgnoredSemverGroup = IgnoredSemverGroup;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { WithRangeSemverGroup } from './with-range';
|
|
1
|
+
import type { DisabledSemverGroup } from './disabled.js';
|
|
2
|
+
import type { FilteredOutSemverGroup } from './filtered-out.js';
|
|
3
|
+
import type { IgnoredSemverGroup } from './ignored.js';
|
|
4
|
+
import type { WithRangeSemverGroup } from './with-range.js';
|
|
6
5
|
export declare namespace SemverGroup {
|
|
7
6
|
export type Disabled = DisabledSemverGroup;
|
|
8
7
|
export type FilteredOut = FilteredOutSemverGroup;
|
|
9
8
|
export type Ignored = IgnoredSemverGroup;
|
|
10
9
|
export type WithRange = WithRangeSemverGroup;
|
|
11
10
|
export type Any = Disabled | FilteredOut | Ignored | WithRange;
|
|
12
|
-
const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<
|
|
11
|
+
const ConfigError_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> & {
|
|
13
12
|
readonly _tag: "SemverGroupConfigError";
|
|
14
|
-
}
|
|
13
|
+
};
|
|
15
14
|
export class ConfigError extends ConfigError_base<{
|
|
16
15
|
readonly config: unknown;
|
|
17
16
|
readonly error: string;
|