syncpack 9.3.2 → 9.7.4
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/dist/bin-fix-mismatches/fix-mismatches-cli.js +4 -4
- package/dist/bin-fix-mismatches/fix-mismatches.js +14 -15
- package/dist/bin-fix-mismatches/index.js +50 -48
- package/dist/bin-format/format-cli.js +4 -4
- package/dist/bin-format/format.js +19 -18
- package/dist/bin-format/index.js +43 -46
- package/dist/bin-lint-semver-ranges/index.js +59 -48
- package/dist/bin-lint-semver-ranges/lint-semver-ranges-cli.js +4 -4
- package/dist/bin-lint-semver-ranges/lint-semver-ranges.js +13 -35
- package/dist/bin-list/index.js +43 -46
- package/dist/bin-list/list-cli.js +4 -4
- package/dist/bin-list/list.js +21 -28
- package/dist/bin-list-mismatches/index.js +46 -47
- package/dist/bin-list-mismatches/list-mismatches-cli.js +4 -4
- package/dist/bin-list-mismatches/list-mismatches.js +49 -38
- package/dist/bin-set-semver-ranges/index.js +62 -49
- package/dist/bin-set-semver-ranges/set-semver-ranges-cli.js +4 -4
- package/dist/bin-set-semver-ranges/set-semver-ranges.js +4 -4
- package/dist/bin.js +8 -8
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +6 -5
- package/dist/get-context/$R.js +14 -36
- package/dist/get-context/get-all-instances.js +3 -3
- package/dist/get-context/get-config/get-core-types.js +11 -41
- package/dist/get-context/get-config/get-custom-types.js +7 -19
- package/dist/get-context/get-config/get-enabled-types.js +9 -11
- package/dist/get-context/get-config/index.js +29 -59
- package/dist/get-context/get-config/path-strategy/index.js +8 -8
- package/dist/get-context/get-config/path-strategy/lib/get-non-empty-string-prop.js +6 -6
- package/dist/get-context/get-config/path-strategy/name-and-version-props.js +23 -49
- package/dist/get-context/get-config/path-strategy/name-and-version-string.js +26 -42
- package/dist/get-context/get-config/path-strategy/types.js +1 -1
- package/dist/get-context/get-config/path-strategy/version-string.js +25 -41
- package/dist/get-context/get-config/path-strategy/versions-by-name.js +14 -30
- package/dist/get-context/get-config/schema/base-group.d.ts +2 -2
- package/dist/get-context/get-config/schema/base-group.js +5 -5
- package/dist/get-context/get-config/schema/index.d.ts +254 -164
- package/dist/get-context/get-config/schema/index.js +40 -63
- package/dist/get-context/get-config/schema/paths.js +12 -12
- package/dist/get-context/get-config/schema/semver-group.d.ts +24 -24
- package/dist/get-context/get-config/schema/semver-group.js +11 -18
- package/dist/get-context/get-config/schema/semver-range.js +4 -4
- package/dist/get-context/get-config/schema/version-group.d.ts +77 -40
- package/dist/get-context/get-config/schema/version-group.js +20 -21
- package/dist/get-context/get-groups/base-group.d.ts +4 -1
- package/dist/get-context/get-groups/base-group.js +18 -19
- package/dist/get-context/get-groups/index.d.ts +2 -1
- package/dist/get-context/get-groups/index.js +31 -37
- package/dist/get-context/get-groups/semver-group.d.ts +0 -1
- package/dist/get-context/get-groups/semver-group.js +23 -66
- package/dist/get-context/get-groups/version-group/index.d.ts +2 -1
- package/dist/get-context/get-groups/version-group/index.js +29 -68
- package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.d.ts +3 -1
- package/dist/get-context/get-groups/version-group/instance-group/get-highest-version.js +36 -45
- package/dist/get-context/get-groups/version-group/instance-group/index.d.ts +2 -1
- package/dist/get-context/get-groups/version-group/instance-group/index.js +55 -47
- package/dist/get-context/get-groups/version-group/instance-group/lib/clean.d.ts +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/clean.js +13 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.d.ts +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/compare-semver.js +22 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/get-range-score.d.ts +2 -0
- package/dist/get-context/get-groups/version-group/instance-group/lib/get-range-score.js +23 -0
- package/dist/get-context/get-package-json-files/get-file-paths.js +18 -19
- package/dist/get-context/get-package-json-files/get-patterns/get-lerna-patterns.js +9 -12
- package/dist/get-context/get-package-json-files/get-patterns/get-pnpm-patterns.js +9 -11
- package/dist/get-context/get-package-json-files/get-patterns/get-yarn-patterns.js +10 -13
- package/dist/get-context/get-package-json-files/get-patterns/index.js +15 -42
- package/dist/get-context/get-package-json-files/get-patterns/lib/get-array-of-strings.js +4 -6
- package/dist/get-context/get-package-json-files/get-patterns/props.js +9 -33
- package/dist/get-context/get-package-json-files/get-patterns/read-json-safe.js +6 -9
- package/dist/get-context/get-package-json-files/get-patterns/read-yaml-safe.js +4 -4
- package/dist/get-context/get-package-json-files/index.js +7 -7
- package/dist/get-context/get-package-json-files/package-json-file/index.js +32 -55
- package/dist/get-context/get-package-json-files/package-json-file/instance.js +14 -15
- package/dist/get-context/index.js +19 -24
- package/dist/lib/disk.js +28 -29
- package/dist/lib/error.js +13 -31
- package/dist/lib/exit-if-invalid.js +1 -1
- package/dist/lib/is-semver.d.ts +1 -1
- package/dist/lib/is-semver.js +15 -7
- package/dist/lib/log.js +33 -58
- package/dist/lib/newlines.js +11 -11
- package/dist/lib/print-strings.js +2 -2
- package/dist/lib/set-semver-range.js +8 -8
- package/dist/lib/show-help-on-error.js +31 -8
- package/dist/lib/sort-by-name.js +1 -1
- package/dist/lib/write-if-changed.js +3 -3
- package/dist/option.js +8 -13
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -1
- package/package.json +20 -16
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.getContext = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
const disk_1 = require("../lib/disk");
|
|
5
|
+
const get_all_instances_1 = require("./get-all-instances");
|
|
6
|
+
const get_config_1 = require("./get-config");
|
|
7
|
+
const get_groups_1 = require("./get-groups");
|
|
8
|
+
const get_package_json_files_1 = require("./get-package-json-files");
|
|
20
9
|
/**
|
|
21
10
|
* Every command in syncpack should accept the return value of this function as
|
|
22
11
|
* its input.
|
|
@@ -25,12 +14,18 @@ var get_package_json_files_1 = require("./get-package-json-files");
|
|
|
25
14
|
* that the majority of syncpack and its tests don't have to deal with the file
|
|
26
15
|
* system and can focus solely on transformation logic.
|
|
27
16
|
*/
|
|
28
|
-
function getContext(program, disk) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
function getContext(program, disk = disk_1.disk) {
|
|
18
|
+
const config = (0, get_config_1.getConfig)(disk, program);
|
|
19
|
+
const packageJsonFiles = (0, get_package_json_files_1.getPackageJsonFiles)(disk, config);
|
|
20
|
+
const instances = (0, get_all_instances_1.getAllInstances)(packageJsonFiles);
|
|
21
|
+
const groups = (0, get_groups_1.getGroups)(config, instances, packageJsonFiles);
|
|
22
|
+
return {
|
|
23
|
+
...config,
|
|
24
|
+
disk,
|
|
25
|
+
isInvalid: false,
|
|
26
|
+
packageJsonFiles,
|
|
27
|
+
semverGroups: groups.semverGroups,
|
|
28
|
+
versionGroups: groups.versionGroups,
|
|
29
|
+
};
|
|
35
30
|
}
|
|
36
31
|
exports.getContext = getContext;
|
package/dist/lib/disk.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.disk = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
|
+
const is_non_empty_object_1 = require("expect-more/dist/is-non-empty-object");
|
|
6
|
+
const fs_extra_1 = require("fs-extra");
|
|
7
|
+
const glob_1 = require("glob");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const read_yaml_file_1 = require("read-yaml-file");
|
|
10
|
+
const constants_1 = require("../constants");
|
|
11
|
+
const log_1 = require("./log");
|
|
12
|
+
const client = (0, cosmiconfig_1.cosmiconfigSync)('syncpack');
|
|
13
13
|
exports.disk = {
|
|
14
14
|
process: {
|
|
15
|
-
exit
|
|
15
|
+
exit(code) {
|
|
16
16
|
(0, log_1.verbose)('exit(', code, ')');
|
|
17
17
|
process.exit(code);
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
},
|
|
20
|
-
globSync
|
|
20
|
+
globSync(pattern) {
|
|
21
21
|
(0, log_1.verbose)('globSync(', pattern, ')');
|
|
22
22
|
return (0, glob_1.sync)(pattern, {
|
|
23
23
|
ignore: '**/node_modules/**',
|
|
24
24
|
absolute: true,
|
|
25
|
-
cwd: constants_1.CWD
|
|
25
|
+
cwd: constants_1.CWD,
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
|
-
readConfigFileSync
|
|
29
|
-
var _a;
|
|
28
|
+
readConfigFileSync(configPath) {
|
|
30
29
|
(0, log_1.verbose)('readConfigFileSync(', configPath, ')');
|
|
31
30
|
try {
|
|
32
|
-
|
|
31
|
+
const result = configPath ? client.load(configPath) : client.search();
|
|
33
32
|
if (result === null) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if ((0,
|
|
38
|
-
return
|
|
33
|
+
const rcPath = (0, path_1.join)(constants_1.CWD, 'package.json');
|
|
34
|
+
const pjson = (0, fs_extra_1.readJsonSync)(rcPath, { throws: false });
|
|
35
|
+
const rcConfig = pjson?.config?.syncpack;
|
|
36
|
+
if ((0, is_non_empty_object_1.isNonEmptyObject)(rcConfig))
|
|
37
|
+
return rcConfig;
|
|
39
38
|
(0, log_1.verbose)('no config file found');
|
|
40
39
|
return {};
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const rcPath = result.filepath;
|
|
42
|
+
const rcConfig = result.config;
|
|
44
43
|
(0, log_1.verbose)('.syncpackrc path:', rcPath);
|
|
45
44
|
(0, log_1.verbose)('.syncpackrc contents:', rcConfig);
|
|
46
45
|
return rcConfig;
|
|
@@ -50,20 +49,20 @@ exports.disk = {
|
|
|
50
49
|
return {};
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
|
-
readFileSync
|
|
52
|
+
readFileSync(filePath) {
|
|
54
53
|
(0, log_1.verbose)('readFileSync(', filePath, ')');
|
|
55
54
|
return (0, fs_extra_1.readFileSync)(filePath, { encoding: 'utf8' });
|
|
56
55
|
},
|
|
57
|
-
readYamlFileSync
|
|
56
|
+
readYamlFileSync(filePath) {
|
|
58
57
|
(0, log_1.verbose)('readYamlFileSync(', filePath, ')');
|
|
59
58
|
return (0, read_yaml_file_1.sync)(filePath);
|
|
60
59
|
},
|
|
61
|
-
removeSync
|
|
60
|
+
removeSync(filePath) {
|
|
62
61
|
(0, log_1.verbose)('removeSync(', filePath, ')');
|
|
63
62
|
(0, fs_extra_1.removeSync)(filePath);
|
|
64
63
|
},
|
|
65
|
-
writeFileSync
|
|
64
|
+
writeFileSync(filePath, contents) {
|
|
66
65
|
(0, log_1.verbose)('writeFileSync(', filePath, contents, ')');
|
|
67
66
|
(0, fs_extra_1.writeFileSync)(filePath, contents);
|
|
68
|
-
}
|
|
67
|
+
},
|
|
69
68
|
};
|
package/dist/lib/error.js
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.BaseError = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_this.cause = BaseError.normalize(options === null || options === void 0 ? void 0 : options.cause);
|
|
25
|
-
return _this;
|
|
4
|
+
class BaseError extends Error {
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'SyncpackError';
|
|
8
|
+
this.cause = BaseError.normalize(options?.cause);
|
|
26
9
|
}
|
|
27
|
-
|
|
10
|
+
static normalize(value) {
|
|
28
11
|
if (value instanceof BaseError)
|
|
29
12
|
return value;
|
|
30
13
|
if (value instanceof Error)
|
|
@@ -32,12 +15,11 @@ var BaseError = /** @class */ (function (_super) {
|
|
|
32
15
|
if (typeof value === 'string')
|
|
33
16
|
return new Error(value);
|
|
34
17
|
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return
|
|
38
|
-
return new BaseError(message, { cause
|
|
18
|
+
}
|
|
19
|
+
static map(message) {
|
|
20
|
+
return (cause) => {
|
|
21
|
+
return new BaseError(message, { cause });
|
|
39
22
|
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}(Error));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
43
25
|
exports.BaseError = BaseError;
|
package/dist/lib/is-semver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Syncpack } from '../types';
|
|
2
2
|
export declare function isValidSemverRange(value: unknown): value is Syncpack.Config.SemverRange.Value;
|
|
3
|
-
export declare function isSemver(version: unknown):
|
|
3
|
+
export declare function isSemver(version: unknown): version is string;
|
|
4
4
|
export declare function isLooseSemver(version: unknown): boolean;
|
package/dist/lib/is-semver.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isLooseSemver = exports.isSemver = exports.isValidSemverRange = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const is_string_1 = require("expect-more/dist/is-string");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
6
|
function isValidSemverRange(value) {
|
|
7
7
|
return (value === constants_1.RANGE.ANY ||
|
|
8
8
|
value === constants_1.RANGE.EXACT ||
|
|
@@ -16,12 +16,20 @@ function isValidSemverRange(value) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.isValidSemverRange = isValidSemverRange;
|
|
18
18
|
function isSemver(version) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const range = '(~|\\^|>=|>|<=|<)?';
|
|
20
|
+
const ints = '[0-9]+';
|
|
21
|
+
const intsOrX = '([0-9]+|x)';
|
|
22
|
+
const dot = '\\.';
|
|
23
|
+
const major = new RegExp(`^${range}${ints}$`);
|
|
24
|
+
const minor = new RegExp(`^${range}${ints}${dot}${intsOrX}$`);
|
|
25
|
+
const patch = new RegExp(`^${range}${ints}${dot}${intsOrX}${dot}${intsOrX}$`);
|
|
26
|
+
return ((0, is_string_1.isString)(version) &&
|
|
27
|
+
(version.search(major) !== -1 ||
|
|
28
|
+
version.search(minor) !== -1 ||
|
|
29
|
+
version.search(patch) !== -1));
|
|
22
30
|
}
|
|
23
31
|
exports.isSemver = isSemver;
|
|
24
32
|
function isLooseSemver(version) {
|
|
25
|
-
return
|
|
33
|
+
return isSemver(version) && version.search(/\.x(\.|$)/) !== -1;
|
|
26
34
|
}
|
|
27
35
|
exports.isLooseSemver = isLooseSemver;
|
package/dist/lib/log.js
CHANGED
|
@@ -1,79 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
7
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
8
|
-
if (!m) return o;
|
|
9
|
-
var i = m.call(o), r, ar = [], e;
|
|
10
|
-
try {
|
|
11
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
12
|
-
}
|
|
13
|
-
catch (error) { e = { error: error }; }
|
|
14
|
-
finally {
|
|
15
|
-
try {
|
|
16
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
17
|
-
}
|
|
18
|
-
finally { if (e) throw e.error; }
|
|
19
|
-
}
|
|
20
|
-
return ar;
|
|
21
|
-
};
|
|
22
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
23
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
24
|
-
if (ar || !(i in from)) {
|
|
25
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
26
|
-
ar[i] = from[i];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
30
|
-
};
|
|
31
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
4
|
};
|
|
34
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
6
|
exports.versionGroupHeader = exports.semverGroupHeader = exports.invalid = exports.valid = exports.skip = exports.fixed = exports.verbose = void 0;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
function verbose() {
|
|
41
|
-
|
|
42
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
43
|
-
values[_i] = arguments[_i];
|
|
44
|
-
}
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const is_string_1 = require("expect-more/dist/is-string");
|
|
9
|
+
const util_1 = require("util");
|
|
10
|
+
const constants_1 = require("../constants");
|
|
11
|
+
function verbose(...values) {
|
|
12
|
+
/* istanbul ignore if */
|
|
45
13
|
if (process.env.SYNCPACK_VERBOSE) {
|
|
46
|
-
console.info
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
: (0, util_1.inspect)(value, false, null, true);
|
|
50
|
-
})), false));
|
|
14
|
+
console.info(chalk_1.default.yellow(constants_1.ICON.debug), ...values.map((value) => (0, is_string_1.isString)(value)
|
|
15
|
+
? chalk_1.default.yellow(value)
|
|
16
|
+
: (0, util_1.inspect)(value, { showHidden: false, colors: true, depth: 20 })));
|
|
51
17
|
}
|
|
52
18
|
}
|
|
53
19
|
exports.verbose = verbose;
|
|
54
20
|
function fixed(message) {
|
|
55
|
-
console.log((0, chalk_1
|
|
21
|
+
console.log((0, chalk_1.default) `{green ${constants_1.ICON.tick}}`, message);
|
|
56
22
|
}
|
|
57
23
|
exports.fixed = fixed;
|
|
58
24
|
function skip(message) {
|
|
59
|
-
console.log(chalk_1
|
|
25
|
+
console.log(chalk_1.default.dim(constants_1.ICON.skip), chalk_1.default.dim(message));
|
|
60
26
|
}
|
|
61
27
|
exports.skip = skip;
|
|
62
28
|
function valid(message, comment) {
|
|
63
29
|
if (comment) {
|
|
64
|
-
console.log((0, chalk_1
|
|
30
|
+
console.log((0, chalk_1.default) `{dim ${constants_1.ICON.skip}} ${message} {dim ${comment}}`);
|
|
65
31
|
}
|
|
66
32
|
else {
|
|
67
|
-
console.log((0, chalk_1
|
|
33
|
+
console.log((0, chalk_1.default) `{dim ${constants_1.ICON.skip}} ${message}`);
|
|
68
34
|
}
|
|
69
35
|
}
|
|
70
36
|
exports.valid = valid;
|
|
71
37
|
function invalid(message, comment) {
|
|
72
38
|
if (comment) {
|
|
73
|
-
console.log((0, chalk_1
|
|
39
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${message} {dim ${comment}}`);
|
|
74
40
|
}
|
|
75
41
|
else {
|
|
76
|
-
console.log((0, chalk_1
|
|
42
|
+
console.log((0, chalk_1.default) `{red ${constants_1.ICON.cross}} ${message}`);
|
|
77
43
|
}
|
|
78
44
|
}
|
|
79
45
|
exports.invalid = invalid;
|
|
@@ -86,12 +52,21 @@ function versionGroupHeader(group, i) {
|
|
|
86
52
|
}
|
|
87
53
|
exports.versionGroupHeader = versionGroupHeader;
|
|
88
54
|
function logHeader(group, type, i) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.log(chalk_1
|
|
55
|
+
const customLabel = group.groupConfig.label;
|
|
56
|
+
const labelWhenDefault = group.isDefault ? `Default ${type} Group` : '';
|
|
57
|
+
const anonymousLabel = `${type} Group ${i + 1}`;
|
|
58
|
+
const label = (customLabel || labelWhenDefault || anonymousLabel).trim();
|
|
59
|
+
const hasNewLines = label.search(/[\r\n]/) !== -1;
|
|
60
|
+
const header = hasNewLines ? formatMultiLine(label) : formatSingleLine(label);
|
|
61
|
+
console.log(chalk_1.default.blue(header));
|
|
62
|
+
}
|
|
63
|
+
function formatSingleLine(label) {
|
|
64
|
+
const leftSide = `= ${label} `;
|
|
65
|
+
const dividerWidth = 80 - leftSide.length;
|
|
66
|
+
const rightSide = dividerWidth > 0 ? '='.repeat(dividerWidth) : '';
|
|
67
|
+
return `${leftSide}${rightSide}`;
|
|
68
|
+
}
|
|
69
|
+
function formatMultiLine(label) {
|
|
70
|
+
const reindented = label.replace(/^\s+/gm, ' ');
|
|
71
|
+
return `= ${reindented}`;
|
|
96
72
|
}
|
|
97
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
package/dist/lib/newlines.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newlines = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const os_1 = require("os");
|
|
5
|
+
const CR = '\r';
|
|
6
|
+
const CRLF = '\r\n';
|
|
7
|
+
const LF = '\n';
|
|
8
8
|
exports.newlines = {
|
|
9
|
-
detect
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
detect(source) {
|
|
10
|
+
const cr = source.split(CR).length;
|
|
11
|
+
const lf = source.split(LF).length;
|
|
12
|
+
const crlf = source.split(CRLF).length;
|
|
13
13
|
if (cr + lf === 0)
|
|
14
14
|
return os_1.EOL;
|
|
15
15
|
if (crlf === cr && crlf === lf)
|
|
@@ -18,7 +18,7 @@ exports.newlines = {
|
|
|
18
18
|
return CR;
|
|
19
19
|
return LF;
|
|
20
20
|
},
|
|
21
|
-
fix
|
|
21
|
+
fix(source, lineEnding) {
|
|
22
22
|
return source.replace(/\r\n|\n|\r/g, lineEnding);
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printStrings = void 0;
|
|
4
4
|
function printStrings(strings) {
|
|
5
|
-
return strings.map(
|
|
5
|
+
return strings.map((str) => `"${str}"`).join(', ');
|
|
6
6
|
}
|
|
7
7
|
exports.printStrings = printStrings;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setSemverRange = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const is_semver_1 = require("./is-semver");
|
|
6
6
|
function setSemverRange(semverRange, version) {
|
|
7
7
|
if (!(0, is_semver_1.isSemver)(version) || !(0, is_semver_1.isValidSemverRange)(semverRange))
|
|
8
8
|
return version;
|
|
9
9
|
if (semverRange === '*')
|
|
10
10
|
return semverRange;
|
|
11
|
-
|
|
11
|
+
const nextVersion = (0, is_semver_1.isLooseSemver)(version)
|
|
12
12
|
? version.replace(/\.x/g, '.0')
|
|
13
13
|
: version;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const from1stNumber = nextVersion.search(/[0-9]/);
|
|
15
|
+
const from1stDot = nextVersion.indexOf('.');
|
|
16
16
|
return semverRange === constants_1.RANGE.LOOSE
|
|
17
|
-
?
|
|
18
|
-
:
|
|
17
|
+
? `${nextVersion.slice(from1stNumber, from1stDot)}.x.x`
|
|
18
|
+
: `${semverRange}${nextVersion.slice(from1stNumber)}`;
|
|
19
19
|
}
|
|
20
20
|
exports.setSemverRange = setSemverRange;
|
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
4
|
};
|
|
9
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
6
|
exports.showHelpOnError = void 0;
|
|
11
|
-
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
8
|
function showHelpOnError(program) {
|
|
13
|
-
program.showHelpAfterError((0, chalk_1
|
|
9
|
+
program.showHelpAfterError((0, chalk_1.default) `
|
|
10
|
+
1. The following options were replaced in syncpack@9.0.0:
|
|
11
|
+
{red
|
|
12
|
+
-p, --prod include dependencies
|
|
13
|
+
-d, --dev include devDependencies
|
|
14
|
+
-P, --peer include peerDependencies
|
|
15
|
+
-R, --resolutions include resolutions (yarn)
|
|
16
|
+
-o, --overrides include overrides (npm)
|
|
17
|
+
-O, --pnpmOverrides include overrides (pnpm)
|
|
18
|
+
-w, --workspace include locally developed package versions
|
|
19
|
+
}
|
|
20
|
+
Instead use the new {green --types} option like so:
|
|
21
|
+
|
|
22
|
+
{green --types dev,prod,peer}
|
|
23
|
+
|
|
24
|
+
2. In .syncpackrc, the following options were replaced:
|
|
25
|
+
{red
|
|
26
|
+
"dev": true,
|
|
27
|
+
"overrides": true,
|
|
28
|
+
"peer": true,
|
|
29
|
+
"pnpmOverrides": true,
|
|
30
|
+
"prod": true,
|
|
31
|
+
"resolutions": true,
|
|
32
|
+
"workspace": true,
|
|
33
|
+
}
|
|
34
|
+
Instead use the new {green dependencyTypes} array like so:
|
|
35
|
+
{green
|
|
36
|
+
"dependencyTypes": ["dev", "prod", "peer"]
|
|
37
|
+
}`);
|
|
14
38
|
}
|
|
15
39
|
exports.showHelpOnError = showHelpOnError;
|
|
16
|
-
var templateObject_1;
|
package/dist/lib/sort-by-name.js
CHANGED
|
@@ -22,11 +22,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.writeIfChanged = void 0;
|
|
27
|
-
|
|
27
|
+
const log = __importStar(require("./log"));
|
|
28
28
|
function writeIfChanged(ctx) {
|
|
29
|
-
ctx.packageJsonFiles.forEach(
|
|
29
|
+
ctx.packageJsonFiles.forEach((packageJsonFile) => {
|
|
30
30
|
if (packageJsonFile.hasChanged()) {
|
|
31
31
|
packageJsonFile.write();
|
|
32
32
|
log.fixed(packageJsonFile.shortPath);
|
package/dist/option.js
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
4
|
};
|
|
9
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
6
|
exports.option = void 0;
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const constants_1 = require("./constants");
|
|
13
9
|
exports.option = {
|
|
14
10
|
config: ['-c, --config <path>', 'path to a syncpack config file'],
|
|
15
11
|
filter: [
|
|
16
12
|
'-f, --filter [pattern]',
|
|
17
|
-
(0, chalk_1
|
|
13
|
+
(0, chalk_1.default) `only include dependencies whose {yellow name} matches this regex`,
|
|
18
14
|
],
|
|
19
15
|
indent: [
|
|
20
16
|
'-i, --indent [value]',
|
|
21
|
-
|
|
17
|
+
`override indentation. defaults to "${constants_1.DEFAULT_CONFIG.indent}"`,
|
|
22
18
|
],
|
|
23
19
|
semverRange: [
|
|
24
20
|
'-r, --semver-range <range>',
|
|
25
|
-
|
|
21
|
+
`see supported ranges below. defaults to "${constants_1.DEFAULT_CONFIG.semverRange}"`,
|
|
26
22
|
],
|
|
27
23
|
source: [
|
|
28
24
|
'-s, --source [pattern]',
|
|
@@ -32,10 +28,9 @@ exports.option = {
|
|
|
32
28
|
],
|
|
33
29
|
types: [
|
|
34
30
|
'-t, --types <names>',
|
|
35
|
-
(0, chalk_1
|
|
36
|
-
]
|
|
31
|
+
(0, chalk_1.default) `only include dependencies matching these types (eg. {yellow types=dev,prod,myCustomType})`,
|
|
32
|
+
],
|
|
37
33
|
};
|
|
38
34
|
function collect(value, previous) {
|
|
39
35
|
return previous.concat([value]);
|
|
40
36
|
}
|
|
41
|
-
var templateObject_1, templateObject_2;
|
package/dist/types.d.ts
CHANGED
|
@@ -78,6 +78,8 @@ export declare namespace Syncpack {
|
|
|
78
78
|
export type Ignored = z.infer<T['ignored']>;
|
|
79
79
|
/** Override the version of dependencies in this group to always be this */
|
|
80
80
|
export type Pinned = z.infer<T['pinned']>;
|
|
81
|
+
/** Use these named packages as the source of truth for versions */
|
|
82
|
+
export type SnappedTo = z.infer<T['snappedTo']>;
|
|
81
83
|
/** @private */
|
|
82
84
|
export type Default = z.infer<T['base']>;
|
|
83
85
|
/** Every valid type of VersionGroup */
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|