syncpack 12.0.1 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/bin-fix-mismatches/fix-mismatches.js +8 -19
- package/dist/bin-fix-mismatches/index.js +3 -1
- package/dist/bin-format/index.js +1 -1
- package/dist/bin-lint/index.js +1 -1
- package/dist/bin-lint-semver-ranges/index.js +3 -1
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +7 -7
- package/dist/bin-list/index.js +3 -1
- package/dist/bin-list/list.d.ts +2 -0
- package/dist/bin-list/list.js +78 -50
- package/dist/bin-list-mismatches/index.js +3 -1
- package/dist/bin-list-mismatches/list-mismatches.d.ts +4 -5
- package/dist/bin-list-mismatches/list-mismatches.js +185 -220
- package/dist/bin-prompt/index.js +2 -0
- package/dist/bin-prompt/prompt.js +7 -3
- package/dist/bin-set-semver-ranges/index.js +3 -1
- package/dist/bin-update/effects.js +6 -6
- package/dist/bin-update/index.js +2 -0
- package/dist/bin-update/update.js +3 -3
- package/dist/config/get-custom-types.js +2 -1
- package/dist/config/types.d.ts +15 -7
- package/dist/constants.d.ts +71 -8
- package/dist/constants.js +34 -1
- package/dist/get-instances/instance.d.ts +2 -1
- package/dist/get-instances/instance.js +4 -3
- package/dist/guards/can-add-to-group.js +14 -7
- package/dist/io/index.d.ts +2 -2
- package/dist/io/index.js +1 -1
- package/dist/io/read-config-file-sync.js +1 -1
- package/dist/option.d.ts +2 -1
- package/dist/option.js +4 -0
- package/dist/report.d.ts +64 -99
- package/dist/report.js +81 -16
- package/dist/schema.json +202 -77
- package/dist/semver-group/create-semver-groups.js +6 -0
- package/dist/semver-group/disabled.js +1 -3
- package/dist/semver-group/filtered-out.js +1 -3
- package/dist/semver-group/ignored.js +1 -3
- package/dist/semver-group/index.d.ts +1 -2
- package/dist/semver-group/with-range.d.ts +1 -1
- package/dist/semver-group/with-range.js +7 -15
- package/dist/specifier/alias.d.ts +2 -0
- package/dist/specifier/alias.js +3 -1
- package/dist/specifier/base.d.ts +4 -2
- package/dist/specifier/base.js +3 -1
- package/dist/specifier/delete.d.ts +4 -2
- package/dist/specifier/delete.js +3 -1
- package/dist/specifier/{version.d.ts → exact.d.ts} +3 -1
- package/dist/specifier/{version.js → exact.js} +6 -4
- package/dist/specifier/file.d.ts +2 -0
- package/dist/specifier/file.js +3 -1
- package/dist/specifier/hosted-git.d.ts +2 -0
- package/dist/specifier/hosted-git.js +3 -1
- package/dist/specifier/index.d.ts +5 -4
- package/dist/specifier/index.js +7 -3
- package/dist/specifier/latest.d.ts +19 -0
- package/dist/specifier/latest.js +24 -0
- package/dist/specifier/lib/parse-specifier.js +1 -1
- package/dist/specifier/range.d.ts +2 -1
- package/dist/specifier/range.js +3 -2
- package/dist/specifier/tag.d.ts +2 -0
- package/dist/specifier/tag.js +3 -1
- package/dist/specifier/unsupported.d.ts +2 -0
- package/dist/specifier/unsupported.js +3 -1
- package/dist/specifier/url.d.ts +2 -0
- package/dist/specifier/url.js +3 -1
- package/dist/specifier/workspace-protocol.d.ts +2 -0
- package/dist/specifier/workspace-protocol.js +6 -3
- package/dist/strategy/name-and-version-props.js +4 -4
- package/dist/version-group/banned.js +1 -3
- package/dist/version-group/create-version-groups.js +11 -0
- package/dist/version-group/filtered-out.js +1 -1
- package/dist/version-group/ignored.js +1 -1
- package/dist/version-group/index.d.ts +1 -2
- package/dist/version-group/pinned.js +3 -3
- package/dist/version-group/same-range.js +9 -14
- package/dist/version-group/snapped-to.js +12 -22
- package/dist/version-group/standard.js +44 -55
- package/package.json +7 -7
package/dist/config/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CUSTOM_TYPES } from '../constants';
|
|
2
|
+
import type { Specifier } from '../specifier';
|
|
2
3
|
/**
|
|
3
4
|
* Aliases for semver range formats supported by syncpack
|
|
4
5
|
*
|
|
@@ -18,12 +19,16 @@ import type { Union } from 'ts-toolbelt';
|
|
|
18
19
|
*
|
|
19
20
|
* @default ""
|
|
20
21
|
*/
|
|
21
|
-
export type SemverRange = '' | '*' | '>' | '>=' | '.x' | '<' | '<=' | '^' | '~';
|
|
22
|
+
export type SemverRange = '' | '*' | '>' | '>=' | '.x' | '<' | '<=' | '^' | '~' | 'workspace:';
|
|
23
|
+
type DefaultDependencyType = keyof typeof CUSTOM_TYPES;
|
|
24
|
+
export type DependencyType = DefaultDependencyType | `!${DefaultDependencyType}` | (string & {});
|
|
25
|
+
export type SpecifierType = Specifier.Any['name'] | `!${Specifier.Any['name']}` | (string & {});
|
|
22
26
|
export interface GroupConfig {
|
|
23
27
|
dependencies?: string[];
|
|
24
|
-
dependencyTypes?:
|
|
28
|
+
dependencyTypes?: DependencyType[];
|
|
25
29
|
label?: string;
|
|
26
30
|
packages?: string[];
|
|
31
|
+
specifierTypes?: SpecifierType[];
|
|
27
32
|
}
|
|
28
33
|
export declare namespace SemverGroupConfig {
|
|
29
34
|
interface Disabled extends GroupConfig {
|
|
@@ -35,7 +40,7 @@ export declare namespace SemverGroupConfig {
|
|
|
35
40
|
interface WithRange extends GroupConfig {
|
|
36
41
|
range: SemverRange;
|
|
37
42
|
}
|
|
38
|
-
type Any =
|
|
43
|
+
type Any = Disabled | Ignored | WithRange;
|
|
39
44
|
}
|
|
40
45
|
export declare namespace VersionGroupConfig {
|
|
41
46
|
interface Banned extends GroupConfig {
|
|
@@ -59,7 +64,7 @@ export declare namespace VersionGroupConfig {
|
|
|
59
64
|
interface Standard extends GroupConfig {
|
|
60
65
|
preferVersion?: 'highestSemver' | 'lowestSemver';
|
|
61
66
|
}
|
|
62
|
-
type Any =
|
|
67
|
+
type Any = Banned | Ignored | Pinned | SameRange | SnappedTo | Standard;
|
|
63
68
|
}
|
|
64
69
|
declare namespace CustomTypeConfig {
|
|
65
70
|
interface NameAndVersionProps {
|
|
@@ -79,20 +84,21 @@ declare namespace CustomTypeConfig {
|
|
|
79
84
|
path: string;
|
|
80
85
|
strategy: 'versionsByName';
|
|
81
86
|
}
|
|
82
|
-
type Any =
|
|
87
|
+
type Any = NameAndVersionProps | NamedVersionString | UnnamedVersionString | VersionsByName;
|
|
83
88
|
}
|
|
84
89
|
export interface CliConfig {
|
|
85
90
|
readonly configPath?: string;
|
|
86
91
|
readonly filter: string;
|
|
87
92
|
readonly indent: string;
|
|
88
93
|
readonly source: string[];
|
|
94
|
+
readonly specs: string;
|
|
89
95
|
readonly types: string;
|
|
90
96
|
}
|
|
91
97
|
export interface RcConfig {
|
|
92
98
|
/** @see https://jamiemason.github.io/syncpack/config/custom-types */
|
|
93
99
|
customTypes: Record<string, CustomTypeConfig.Any>;
|
|
94
100
|
/** @see https://jamiemason.github.io/syncpack/config/dependency-types */
|
|
95
|
-
dependencyTypes:
|
|
101
|
+
dependencyTypes: DependencyType[];
|
|
96
102
|
/** @see https://jamiemason.github.io/syncpack/config/filter */
|
|
97
103
|
filter: string;
|
|
98
104
|
/** @see https://jamiemason.github.io/syncpack/config/indent */
|
|
@@ -105,6 +111,8 @@ export interface RcConfig {
|
|
|
105
111
|
sortFirst: string[];
|
|
106
112
|
/** @see https://jamiemason.github.io/syncpack/config/source */
|
|
107
113
|
source: string[];
|
|
114
|
+
/** @see https://jamiemason.github.io/syncpack/config/specifier-types */
|
|
115
|
+
specifierTypes: SpecifierType[];
|
|
108
116
|
/** @see https://jamiemason.github.io/syncpack/config/version-groups */
|
|
109
117
|
versionGroups: VersionGroupConfig.Any[];
|
|
110
118
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -24,13 +24,76 @@ export declare const RANGE: {
|
|
|
24
24
|
readonly WORKSPACE: "workspace:";
|
|
25
25
|
};
|
|
26
26
|
export declare const INTERNAL_TYPES: readonly ["dev", "local", "overrides", "peer", "pnpmOverrides", "prod", "resolutions"];
|
|
27
|
+
export declare const CUSTOM_TYPES: {
|
|
28
|
+
readonly dev: {
|
|
29
|
+
readonly strategy: "versionsByName";
|
|
30
|
+
readonly path: "devDependencies";
|
|
31
|
+
};
|
|
32
|
+
readonly local: {
|
|
33
|
+
readonly strategy: "name~version";
|
|
34
|
+
readonly namePath: "name";
|
|
35
|
+
readonly path: "version";
|
|
36
|
+
};
|
|
37
|
+
readonly overrides: {
|
|
38
|
+
readonly strategy: "versionsByName";
|
|
39
|
+
readonly path: "overrides";
|
|
40
|
+
};
|
|
41
|
+
readonly peer: {
|
|
42
|
+
readonly strategy: "versionsByName";
|
|
43
|
+
readonly path: "peerDependencies";
|
|
44
|
+
};
|
|
45
|
+
readonly pnpmOverrides: {
|
|
46
|
+
readonly strategy: "versionsByName";
|
|
47
|
+
readonly path: "pnpm.overrides";
|
|
48
|
+
};
|
|
49
|
+
readonly prod: {
|
|
50
|
+
readonly strategy: "versionsByName";
|
|
51
|
+
readonly path: "dependencies";
|
|
52
|
+
};
|
|
53
|
+
readonly resolutions: {
|
|
54
|
+
readonly strategy: "versionsByName";
|
|
55
|
+
readonly path: "resolutions";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
27
58
|
export declare const DEFAULT_CONFIG: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
59
|
+
customTypes: {
|
|
60
|
+
readonly dev: {
|
|
61
|
+
readonly strategy: "versionsByName";
|
|
62
|
+
readonly path: "devDependencies";
|
|
63
|
+
};
|
|
64
|
+
readonly local: {
|
|
65
|
+
readonly strategy: "name~version";
|
|
66
|
+
readonly namePath: "name";
|
|
67
|
+
readonly path: "version";
|
|
68
|
+
};
|
|
69
|
+
readonly overrides: {
|
|
70
|
+
readonly strategy: "versionsByName";
|
|
71
|
+
readonly path: "overrides";
|
|
72
|
+
};
|
|
73
|
+
readonly peer: {
|
|
74
|
+
readonly strategy: "versionsByName";
|
|
75
|
+
readonly path: "peerDependencies";
|
|
76
|
+
};
|
|
77
|
+
readonly pnpmOverrides: {
|
|
78
|
+
readonly strategy: "versionsByName";
|
|
79
|
+
readonly path: "pnpm.overrides";
|
|
80
|
+
};
|
|
81
|
+
readonly prod: {
|
|
82
|
+
readonly strategy: "versionsByName";
|
|
83
|
+
readonly path: "dependencies";
|
|
84
|
+
};
|
|
85
|
+
readonly resolutions: {
|
|
86
|
+
readonly strategy: "versionsByName";
|
|
87
|
+
readonly path: "resolutions";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
dependencyTypes: "**"[];
|
|
91
|
+
filter: string;
|
|
92
|
+
indent: string;
|
|
93
|
+
semverGroups: never[];
|
|
94
|
+
sortAz: string[];
|
|
95
|
+
sortFirst: string[];
|
|
96
|
+
source: string[];
|
|
97
|
+
specifierTypes: "**"[];
|
|
98
|
+
versionGroups: never[];
|
|
36
99
|
};
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
3
|
+
exports.DEFAULT_CONFIG = exports.CUSTOM_TYPES = exports.INTERNAL_TYPES = exports.RANGE = exports.ICON = exports.CWD = void 0;
|
|
4
4
|
/** Single source of truth, intended to aid testing or to override */
|
|
5
5
|
exports.CWD = process.env.MOCK_CWD || process.cwd();
|
|
6
6
|
/** Single source of truth for icons used in output */
|
|
@@ -35,7 +35,39 @@ exports.INTERNAL_TYPES = [
|
|
|
35
35
|
'prod',
|
|
36
36
|
'resolutions',
|
|
37
37
|
];
|
|
38
|
+
exports.CUSTOM_TYPES = {
|
|
39
|
+
dev: {
|
|
40
|
+
strategy: 'versionsByName',
|
|
41
|
+
path: 'devDependencies',
|
|
42
|
+
},
|
|
43
|
+
local: {
|
|
44
|
+
strategy: 'name~version',
|
|
45
|
+
namePath: 'name',
|
|
46
|
+
path: 'version',
|
|
47
|
+
},
|
|
48
|
+
overrides: {
|
|
49
|
+
strategy: 'versionsByName',
|
|
50
|
+
path: 'overrides',
|
|
51
|
+
},
|
|
52
|
+
peer: {
|
|
53
|
+
strategy: 'versionsByName',
|
|
54
|
+
path: 'peerDependencies',
|
|
55
|
+
},
|
|
56
|
+
pnpmOverrides: {
|
|
57
|
+
strategy: 'versionsByName',
|
|
58
|
+
path: 'pnpm.overrides',
|
|
59
|
+
},
|
|
60
|
+
prod: {
|
|
61
|
+
strategy: 'versionsByName',
|
|
62
|
+
path: 'dependencies',
|
|
63
|
+
},
|
|
64
|
+
resolutions: {
|
|
65
|
+
strategy: 'versionsByName',
|
|
66
|
+
path: 'resolutions',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
38
69
|
exports.DEFAULT_CONFIG = {
|
|
70
|
+
customTypes: exports.CUSTOM_TYPES,
|
|
39
71
|
dependencyTypes: ['**'],
|
|
40
72
|
filter: '.',
|
|
41
73
|
indent: ' ',
|
|
@@ -51,5 +83,6 @@ exports.DEFAULT_CONFIG = {
|
|
|
51
83
|
],
|
|
52
84
|
sortFirst: ['name', 'description', 'version', 'author'],
|
|
53
85
|
source: ['package.json', 'packages/*/package.json'],
|
|
86
|
+
specifierTypes: ['**'],
|
|
54
87
|
versionGroups: [],
|
|
55
88
|
};
|
|
@@ -2,6 +2,7 @@ import type { Effect } from 'effect';
|
|
|
2
2
|
import type { Strategy } from '../config/get-custom-types';
|
|
3
3
|
import type { PackageJsonFile } from '../get-package-json-files/package-json-file';
|
|
4
4
|
import type { SemverGroup } from '../semver-group';
|
|
5
|
+
import { Specifier } from '../specifier';
|
|
5
6
|
import type { VersionGroup } from '../version-group';
|
|
6
7
|
import type { Delete } from '../version-group/lib/delete';
|
|
7
8
|
export declare class Instance {
|
|
@@ -10,7 +11,7 @@ export declare class Instance {
|
|
|
10
11
|
/** The .name property of the package.json file of this instance */
|
|
11
12
|
pkgName: string;
|
|
12
13
|
/** The specifier as it is on disk before being fixed */
|
|
13
|
-
rawSpecifier:
|
|
14
|
+
rawSpecifier: Specifier.Any;
|
|
14
15
|
/** The package this dependency is installed in this specific time */
|
|
15
16
|
packageJsonFile: PackageJsonFile;
|
|
16
17
|
/** Locates where in the file this dependency is installed */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Instance = void 0;
|
|
4
|
+
const specifier_1 = require("../specifier");
|
|
4
5
|
class Instance {
|
|
5
6
|
/** The name of this dependency */
|
|
6
7
|
name;
|
|
@@ -19,16 +20,16 @@ class Instance {
|
|
|
19
20
|
constructor(name, rawSpecifier, packageJsonFile, strategy) {
|
|
20
21
|
this.name = name;
|
|
21
22
|
this.pkgName = packageJsonFile.jsonFile.contents.name || 'PACKAGE_JSON_HAS_NO_NAME';
|
|
22
|
-
this.rawSpecifier = rawSpecifier;
|
|
23
23
|
this.packageJsonFile = packageJsonFile;
|
|
24
24
|
this.strategy = strategy;
|
|
25
25
|
this.semverGroup = null;
|
|
26
26
|
this.versionGroup = null;
|
|
27
|
+
this.rawSpecifier = specifier_1.Specifier.create(this, rawSpecifier);
|
|
27
28
|
}
|
|
28
29
|
/** Mutate the package.json file in memory with the latest version specifier */
|
|
29
30
|
write(rawSpecifier) {
|
|
30
|
-
this.rawSpecifier = rawSpecifier;
|
|
31
|
-
return this.strategy.write(this.packageJsonFile, [this.name, this.rawSpecifier]);
|
|
31
|
+
this.rawSpecifier = specifier_1.Specifier.create(this, rawSpecifier);
|
|
32
|
+
return this.strategy.write(this.packageJsonFile, [this.name, this.rawSpecifier.raw]);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
exports.Instance = Instance;
|
|
@@ -4,11 +4,12 @@ exports.canAddToGroup = void 0;
|
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
5
|
const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array");
|
|
6
6
|
function canAddToGroup(packageJsonFilesByName, group, instance) {
|
|
7
|
-
const { dependencies, dependencyTypes, packages } = group.config;
|
|
7
|
+
const { dependencies, dependencyTypes, packages, specifierTypes } = group.config;
|
|
8
8
|
return (group.canAdd(instance) &&
|
|
9
9
|
matchesDependencyTypes(dependencyTypes, instance) &&
|
|
10
10
|
matchesPackages(packages, instance) &&
|
|
11
|
-
matchesDependencies(packageJsonFilesByName, group, dependencies, instance)
|
|
11
|
+
matchesDependencies(packageJsonFilesByName, group, dependencies, instance) &&
|
|
12
|
+
matchesSpecifierTypes(specifierTypes, instance));
|
|
12
13
|
}
|
|
13
14
|
exports.canAddToGroup = canAddToGroup;
|
|
14
15
|
function matchesDependencies(packageJsonFilesByName, group, dependencies, instance) {
|
|
@@ -28,14 +29,20 @@ function matchesPackages(packages, instance) {
|
|
|
28
29
|
return packages.some((pattern) => (0, minimatch_1.minimatch)(instance.pkgName, pattern));
|
|
29
30
|
}
|
|
30
31
|
function matchesDependencyTypes(dependencyTypes, instance) {
|
|
32
|
+
return matchesKnownList(dependencyTypes, instance.strategy.name);
|
|
33
|
+
}
|
|
34
|
+
function matchesSpecifierTypes(specifierTypes, instance) {
|
|
35
|
+
return matchesKnownList(specifierTypes, instance.rawSpecifier.name);
|
|
36
|
+
}
|
|
37
|
+
function matchesKnownList(values, value) {
|
|
31
38
|
// matches if not defined
|
|
32
|
-
if (!(0, is_non_empty_array_1.isNonEmptyArray)(
|
|
39
|
+
if (!(0, is_non_empty_array_1.isNonEmptyArray)(values))
|
|
33
40
|
return true;
|
|
34
|
-
if (
|
|
41
|
+
if (values.join('') === '**')
|
|
35
42
|
return true;
|
|
36
43
|
const negative = [];
|
|
37
44
|
const positive = [];
|
|
38
|
-
|
|
45
|
+
values.forEach((name) => {
|
|
39
46
|
if (name.startsWith('!')) {
|
|
40
47
|
negative.push(name.replace('!', ''));
|
|
41
48
|
}
|
|
@@ -43,7 +50,7 @@ function matchesDependencyTypes(dependencyTypes, instance) {
|
|
|
43
50
|
positive.push(name);
|
|
44
51
|
}
|
|
45
52
|
});
|
|
46
|
-
if ((0, is_non_empty_array_1.isNonEmptyArray)(negative) && !negative.includes(
|
|
53
|
+
if ((0, is_non_empty_array_1.isNonEmptyArray)(negative) && !negative.includes(value))
|
|
47
54
|
return true;
|
|
48
|
-
return (0, is_non_empty_array_1.isNonEmptyArray)(positive) && positive.includes(
|
|
55
|
+
return (0, is_non_empty_array_1.isNonEmptyArray)(positive) && positive.includes(value);
|
|
49
56
|
}
|
package/dist/io/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
3
3
|
import { Context } from 'effect';
|
|
4
4
|
import { prompt } from 'enquirer';
|
|
5
5
|
import * as fs from 'fs';
|
|
@@ -7,7 +7,7 @@ import * as globby from 'globby';
|
|
|
7
7
|
import * as readYamlFile from 'read-yaml-file';
|
|
8
8
|
export interface Io {
|
|
9
9
|
cosmiconfig: {
|
|
10
|
-
|
|
10
|
+
cosmiconfig: typeof cosmiconfig;
|
|
11
11
|
};
|
|
12
12
|
enquirer: {
|
|
13
13
|
prompt: typeof prompt<any>;
|
package/dist/io/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const readYamlFile = __importStar(require("read-yaml-file"));
|
|
|
33
33
|
exports.IoTag = effect_1.Context.Tag();
|
|
34
34
|
exports.io = {
|
|
35
35
|
cosmiconfig: {
|
|
36
|
-
|
|
36
|
+
cosmiconfig: cosmiconfig_1.cosmiconfig,
|
|
37
37
|
},
|
|
38
38
|
enquirer: {
|
|
39
39
|
prompt: enquirer_1.prompt,
|
|
@@ -7,7 +7,7 @@ const is_non_empty_object_1 = require("tightrope/guard/is-non-empty-object");
|
|
|
7
7
|
const read_json_file_sync_1 = require("./read-json-file-sync");
|
|
8
8
|
const getOptionOfNonEmptyObject = effect_1.Option.liftPredicate((is_non_empty_object_1.isNonEmptyObject));
|
|
9
9
|
function readConfigFileSync(io, configPath) {
|
|
10
|
-
return (0, effect_1.pipe)(effect_1.Effect.try(() => io.cosmiconfig.
|
|
10
|
+
return (0, effect_1.pipe)(effect_1.Effect.try(() => io.cosmiconfig.cosmiconfig('syncpack')), effect_1.Effect.flatMap((client) => effect_1.Effect.tryPromise(() => (configPath ? client.load(configPath) : client.search()))), effect_1.Effect.flatMap((result) => result !== null ? getValueFromCosmiconfig(result) : findConfigInPackageJson(io)), effect_1.Effect.tap((config) => effect_1.Effect.logDebug(`config file found: ${JSON.stringify(config)}`)), effect_1.Effect.tapError(() => effect_1.Effect.logDebug('no config file found, will use defaults')), effect_1.Effect.catchAll(() => effect_1.Effect.succeed({})));
|
|
11
11
|
}
|
|
12
12
|
exports.readConfigFileSync = readConfigFileSync;
|
|
13
13
|
/**
|
package/dist/option.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare const option: {
|
|
2
2
|
readonly config: readonly ["-c, --config <path>", "path to a syncpack config file"];
|
|
3
3
|
readonly filter: readonly ["-f, --filter [pattern]", string];
|
|
4
|
-
readonly indent: readonly ["-i, --indent [value]",
|
|
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 ["-s, --specs <names>", string];
|
|
6
7
|
readonly types: readonly ["-t, --types <names>", string];
|
|
7
8
|
};
|
|
8
9
|
declare function collect(value: string, previous: string[]): string[];
|
package/dist/option.js
CHANGED
|
@@ -19,6 +19,10 @@ exports.option = {
|
|
|
19
19
|
collect,
|
|
20
20
|
[],
|
|
21
21
|
],
|
|
22
|
+
specs: [
|
|
23
|
+
'-s, --specs <names>',
|
|
24
|
+
(0, chalk_1.default) `only include dependencies whose version specifier match these types (eg. {yellow specs=latest,range,workspace-protocol})`,
|
|
25
|
+
],
|
|
22
26
|
types: [
|
|
23
27
|
'-t, --types <names>',
|
|
24
28
|
(0, chalk_1.default) `only include dependencies matching these types (eg. {yellow types=dev,prod,myCustomType})`,
|
package/dist/report.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Data } from 'effect';
|
|
2
|
-
import type { Union } from 'ts-toolbelt';
|
|
3
1
|
import type { Instance } from './get-instances/instance';
|
|
4
2
|
import type { Specifier } from './specifier';
|
|
5
3
|
export declare namespace Report {
|
|
4
|
+
export type Any = Semver.Any | Version.Any;
|
|
6
5
|
export namespace Semver {
|
|
7
|
-
type Any =
|
|
6
|
+
type Any = Report.Semver.Invalid.Any | Report.Semver.Valid.Any;
|
|
8
7
|
namespace Valid {
|
|
9
|
-
type Any =
|
|
8
|
+
type Any = Report.Disabled | Report.FilteredOut | Report.Ignored | Report.Valid;
|
|
10
9
|
}
|
|
11
10
|
namespace Invalid {
|
|
12
|
-
type Any =
|
|
11
|
+
type Any = Report.Semver.Fixable.Any | Report.Semver.Unfixable.Any;
|
|
13
12
|
}
|
|
14
13
|
namespace Fixable {
|
|
15
14
|
type Any = Report.SemverRangeMismatch;
|
|
@@ -23,144 +22,110 @@ export declare namespace Report {
|
|
|
23
22
|
name: string;
|
|
24
23
|
reports: Report.Version.Any[];
|
|
25
24
|
}
|
|
26
|
-
type Any =
|
|
25
|
+
type Any = Report.Version.Invalid.Any | Report.Version.Valid.Any;
|
|
27
26
|
namespace Valid {
|
|
28
|
-
type Any =
|
|
27
|
+
type Any = Report.Disabled | Report.FilteredOut | Report.Ignored | Report.Valid;
|
|
29
28
|
}
|
|
30
29
|
namespace Invalid {
|
|
31
|
-
type Any =
|
|
30
|
+
type Any = Report.Version.Fixable.Any | Report.Version.Unfixable.Any;
|
|
32
31
|
}
|
|
33
32
|
namespace Fixable {
|
|
34
|
-
type Any =
|
|
33
|
+
type Any = Report.Banned | Report.HighestSemverMismatch | Report.LocalPackageMismatch | Report.LowestSemverMismatch | Report.PinnedMismatch | Report.SemverRangeMismatch | Report.SnappedToMismatch;
|
|
35
34
|
}
|
|
36
35
|
namespace Unfixable {
|
|
37
|
-
type Any =
|
|
36
|
+
type Any = Report.MissingLocalVersion | Report.MissingSnappedToMismatch | Report.UnsupportedMismatch | Report.SameRangeMismatch;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
/** Semver Groups are disabled by default */
|
|
44
|
-
export class Disabled extends Disabled_base<{
|
|
39
|
+
class Excluded {
|
|
40
|
+
readonly _tagGroup = "Excluded";
|
|
41
|
+
readonly isInvalid = false;
|
|
45
42
|
readonly instance: Instance;
|
|
46
|
-
|
|
43
|
+
constructor(instance: Instance);
|
|
44
|
+
}
|
|
45
|
+
class Unfixable {
|
|
46
|
+
readonly _tagGroup = "Unfixable";
|
|
47
|
+
readonly isInvalid = true;
|
|
48
|
+
readonly unfixable: Instance;
|
|
49
|
+
constructor(unfixable: Instance);
|
|
50
|
+
}
|
|
51
|
+
class Fixable {
|
|
52
|
+
readonly _tagGroup = "Fixable";
|
|
53
|
+
readonly isInvalid = true;
|
|
54
|
+
readonly fixable: Specifier.Any;
|
|
55
|
+
constructor(fixable: Specifier.Any);
|
|
56
|
+
}
|
|
57
|
+
/** Semver Groups are disabled by default */
|
|
58
|
+
export class Disabled extends Excluded {
|
|
59
|
+
readonly _tag = "Disabled";
|
|
47
60
|
}
|
|
48
|
-
const FilteredOut_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
49
|
-
readonly _tag: "FilteredOut";
|
|
50
|
-
}>;
|
|
51
61
|
/** Has a name which does not match the `--filter` RegExp */
|
|
52
|
-
export class FilteredOut extends
|
|
53
|
-
readonly
|
|
54
|
-
}> {
|
|
62
|
+
export class FilteredOut extends Excluded {
|
|
63
|
+
readonly _tag = "FilteredOut";
|
|
55
64
|
}
|
|
56
|
-
const Ignored_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
57
|
-
readonly _tag: "Ignored";
|
|
58
|
-
}>;
|
|
59
65
|
/** Is in an ignored version group */
|
|
60
|
-
export class Ignored extends
|
|
61
|
-
readonly
|
|
62
|
-
}> {
|
|
66
|
+
export class Ignored extends Excluded {
|
|
67
|
+
readonly _tag = "Ignored";
|
|
63
68
|
}
|
|
64
|
-
const Valid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
65
|
-
readonly _tag: "Valid";
|
|
66
|
-
}>;
|
|
67
69
|
/** Version satisfies the rules of its version group */
|
|
68
|
-
export class Valid
|
|
70
|
+
export class Valid {
|
|
71
|
+
readonly _tag = "Valid";
|
|
72
|
+
readonly _tagGroup = "Valid";
|
|
73
|
+
readonly isInvalid = false;
|
|
69
74
|
readonly specifier: Specifier.Any;
|
|
70
|
-
|
|
75
|
+
constructor(specifier: Specifier.Any);
|
|
71
76
|
}
|
|
72
|
-
const Banned_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
73
|
-
readonly _tag: "Banned";
|
|
74
|
-
}>;
|
|
75
77
|
/** Must be removed */
|
|
76
|
-
export class Banned extends
|
|
77
|
-
readonly
|
|
78
|
-
}> {
|
|
78
|
+
export class Banned extends Fixable {
|
|
79
|
+
readonly _tag = "Banned";
|
|
79
80
|
}
|
|
80
|
-
const HighestSemverMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
81
|
-
readonly _tag: "HighestSemverMismatch";
|
|
82
|
-
}>;
|
|
83
81
|
/** Version mismatches and should use a higher version found on another */
|
|
84
|
-
export class HighestSemverMismatch extends
|
|
85
|
-
readonly
|
|
86
|
-
}> {
|
|
82
|
+
export class HighestSemverMismatch extends Fixable {
|
|
83
|
+
readonly _tag = "HighestSemverMismatch";
|
|
87
84
|
}
|
|
88
|
-
const LocalPackageMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
89
|
-
readonly _tag: "LocalPackageMismatch";
|
|
90
|
-
}>;
|
|
91
85
|
/** Version mismatches the `.version` of the package developed in this repo */
|
|
92
|
-
export class LocalPackageMismatch extends
|
|
93
|
-
readonly
|
|
86
|
+
export class LocalPackageMismatch extends Fixable {
|
|
87
|
+
readonly _tag = "LocalPackageMismatch";
|
|
94
88
|
readonly localInstance: Instance;
|
|
95
|
-
|
|
89
|
+
constructor(fixable: Specifier.Any, localInstance: Instance);
|
|
96
90
|
}
|
|
97
|
-
const LowestSemverMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
98
|
-
readonly _tag: "LowestSemverMismatch";
|
|
99
|
-
}>;
|
|
100
91
|
/** Version mismatches and should use a lower version found on another */
|
|
101
|
-
export class LowestSemverMismatch extends
|
|
102
|
-
readonly
|
|
103
|
-
}> {
|
|
92
|
+
export class LowestSemverMismatch extends Fixable {
|
|
93
|
+
readonly _tag = "LowestSemverMismatch";
|
|
104
94
|
}
|
|
105
|
-
const PinnedMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
106
|
-
readonly _tag: "PinnedMismatch";
|
|
107
|
-
}>;
|
|
108
95
|
/** Version is not identical to the `pinVersion` of its Pinned version group */
|
|
109
|
-
export class PinnedMismatch extends
|
|
110
|
-
readonly
|
|
111
|
-
}> {
|
|
96
|
+
export class PinnedMismatch extends Fixable {
|
|
97
|
+
readonly _tag = "PinnedMismatch";
|
|
112
98
|
}
|
|
113
|
-
const SemverRangeMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
114
|
-
readonly _tag: "SemverRangeMismatch";
|
|
115
|
-
}>;
|
|
116
99
|
/** Version is identical but the semver range does not match its semver group */
|
|
117
|
-
export class SemverRangeMismatch extends
|
|
118
|
-
readonly
|
|
119
|
-
}> {
|
|
100
|
+
export class SemverRangeMismatch extends Fixable {
|
|
101
|
+
readonly _tag = "SemverRangeMismatch";
|
|
120
102
|
}
|
|
121
|
-
const SnappedToMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
122
|
-
readonly _tag: "SnappedToMismatch";
|
|
123
|
-
}>;
|
|
124
103
|
/** Version mismatches the version used by the packages in the `snapTo` array */
|
|
125
|
-
export class SnappedToMismatch extends
|
|
126
|
-
readonly
|
|
104
|
+
export class SnappedToMismatch extends Fixable {
|
|
105
|
+
readonly _tag = "SnappedToMismatch";
|
|
127
106
|
readonly localInstance: Instance;
|
|
128
|
-
|
|
107
|
+
constructor(fixable: Specifier.Any, localInstance: Instance);
|
|
129
108
|
}
|
|
130
|
-
const MissingLocalVersion_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
131
|
-
readonly _tag: "MissingLocalVersion";
|
|
132
|
-
}>;
|
|
133
109
|
/** Dependency should match a local package.json which is missing a .version */
|
|
134
|
-
export class MissingLocalVersion extends
|
|
110
|
+
export class MissingLocalVersion extends Unfixable {
|
|
111
|
+
readonly _tag = "MissingLocalVersion";
|
|
135
112
|
readonly localInstance: Instance;
|
|
136
|
-
|
|
137
|
-
}> {
|
|
113
|
+
constructor(unfixable: Instance, localInstance: Instance);
|
|
138
114
|
}
|
|
139
|
-
const MissingSnappedToMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
140
|
-
readonly _tag: "MissingSnappedToMismatch";
|
|
141
|
-
}>;
|
|
142
115
|
/** Dependency is not present in any of the packages in the `snapTo` array */
|
|
143
|
-
export class MissingSnappedToMismatch extends
|
|
144
|
-
readonly
|
|
145
|
-
}> {
|
|
116
|
+
export class MissingSnappedToMismatch extends Unfixable {
|
|
117
|
+
readonly _tag = "MissingSnappedToMismatch";
|
|
146
118
|
}
|
|
147
|
-
const SameRangeMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
148
|
-
readonly _tag: "SameRangeMismatch";
|
|
149
|
-
}>;
|
|
150
119
|
/** Specifier does not cover the specifiers of every other instance in this group */
|
|
151
|
-
export class SameRangeMismatch extends
|
|
152
|
-
readonly
|
|
120
|
+
export class SameRangeMismatch extends Unfixable {
|
|
121
|
+
readonly _tag = "SameRangeMismatch";
|
|
153
122
|
/** the raw specifiers which this instance's specifier did not cover */
|
|
154
123
|
readonly mismatches: string[];
|
|
155
|
-
|
|
124
|
+
constructor(unfixable: Instance, mismatches: string[]);
|
|
156
125
|
}
|
|
157
|
-
const UnsupportedMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<Omit<A, keyof import("effect/Equal").Equal>, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" | keyof import("effect/Equal").Equal ? never : P]: A[P]; }) => Data.Data<Readonly<A> & {
|
|
158
|
-
readonly _tag: "UnsupportedMismatch";
|
|
159
|
-
}>;
|
|
160
126
|
/** Version mismatches and is not semver, syncpack cannot guess what to do */
|
|
161
|
-
export class UnsupportedMismatch extends
|
|
162
|
-
readonly
|
|
163
|
-
}> {
|
|
127
|
+
export class UnsupportedMismatch extends Unfixable {
|
|
128
|
+
readonly _tag = "UnsupportedMismatch";
|
|
164
129
|
}
|
|
165
130
|
export {};
|
|
166
131
|
}
|