Comparing version 10.2.0 to 10.5.1
@@ -29,2 +29,3 @@ "use strict"; | ||
} | ||
case 'SAME_RANGE_MISMATCH': | ||
case 'UNSUPPORTED_MISMATCH': { | ||
@@ -35,4 +36,2 @@ // @TODO Output something when fix-mismatches faces an unsupported mismatch | ||
} | ||
// @TODO case 'SEMVER_UNSATISFIED': break; | ||
// @TODO case 'WORKSPACE_UNSATISFIED': break; | ||
} | ||
@@ -39,0 +38,0 @@ }); |
@@ -87,2 +87,9 @@ "use strict"; | ||
} | ||
case 'SAME_RANGE_MISMATCH': { | ||
console.log((0, chalk_1.default) `{red %s} %s {dim has mismatched semver range versions which syncpack cannot fix}`, constants_1.ICON.cross, report.name); | ||
report.instances.forEach((instance) => { | ||
console.log((0, chalk_1.default) ` {yellow %s} {dim in %s of %s}`, instance.version, instance.strategy.path, instance.packageJsonFile.shortPath); | ||
}); | ||
break; | ||
} | ||
case 'UNSUPPORTED_MISMATCH': { | ||
@@ -104,4 +111,2 @@ console.log((0, chalk_1.default) `{red %s} %s {dim has mismatched versions which syncpack cannot fix}`, constants_1.ICON.cross, report.name); | ||
} | ||
// @TODO case 'SEMVER_UNSATISFIED': break; | ||
// @TODO case 'WORKSPACE_UNSATISFIED': break; | ||
} | ||
@@ -108,0 +113,0 @@ }); |
@@ -35,2 +35,4 @@ "use strict"; | ||
const get_version_groups_1 = require("../get-version-groups"); | ||
const get_unique_versions_1 = require("../get-version-groups/lib/get-unique-versions"); | ||
const is_semver_1 = require("../lib/is-semver"); | ||
const log = __importStar(require("../lib/log")); | ||
@@ -75,10 +77,11 @@ const sort_by_name_1 = require("../lib/sort-by-name"); | ||
} | ||
case 'SAME_RANGE_MISMATCH': | ||
case 'UNSUPPORTED_MISMATCH': { | ||
console.log((0, chalk_1.default) `{red %s %s} %s`, constants_1.ICON.cross, report.name, report.instances | ||
.map((instance) => chalk_1.default.red(instance.version)) | ||
console.log((0, chalk_1.default) `{red %s %s} %s`, constants_1.ICON.cross, report.name, (0, get_unique_versions_1.getUniqueVersions)(report.instances) | ||
.map((version) => (0, is_semver_1.isSupported)(version) | ||
? chalk_1.default.red(version) | ||
: chalk_1.default.yellow(version)) | ||
.join(chalk_1.default.dim(', '))); | ||
break; | ||
} | ||
// @TODO case 'SEMVER_UNSATISFIED': break; | ||
// @TODO case 'WORKSPACE_UNSATISFIED': break; | ||
} | ||
@@ -85,0 +88,0 @@ function listColouredVersions(pinVersion, instances) { |
@@ -26,2 +26,5 @@ #!/usr/bin/env node | ||
}) | ||
.command('prompt', 'fix mismatches which syncpack cannot fix automatically', { | ||
executableFile: './bin-prompt/index.js', | ||
}) | ||
.command('set-semver-ranges', 'set semver ranges to the given format', { | ||
@@ -28,0 +31,0 @@ executableFile: './bin-set-semver-ranges/index.js', |
@@ -9,2 +9,3 @@ "use strict"; | ||
: [ | ||
'bin', | ||
'contributors', | ||
@@ -11,0 +12,0 @@ 'dependencies', |
@@ -51,6 +51,12 @@ import type { Union } from 'ts-toolbelt'; | ||
} | ||
interface SameRange extends GroupConfig { | ||
policy: 'sameRange'; | ||
} | ||
interface SnappedTo extends GroupConfig { | ||
snapTo: string[]; | ||
} | ||
interface Standard extends GroupConfig { | ||
preferVersion?: 'highestSemver' | 'lowestSemver'; | ||
} | ||
type Any = Union.Strict<Standard | Banned | Ignored | Pinned | SnappedTo>; | ||
type Any = Union.Strict<Banned | Ignored | Pinned | SameRange | SnappedTo | Standard>; | ||
} | ||
@@ -57,0 +63,0 @@ declare namespace CustomTypeConfig { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSemverGroups = void 0; | ||
const minimatch_1 = __importDefault(require("minimatch")); | ||
const minimatch_1 = require("minimatch"); | ||
const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings"); | ||
@@ -31,5 +28,5 @@ const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array"); | ||
(!(0, is_non_empty_array_1.isNonEmptyArray)(packages) || | ||
packages.some((pattern) => (0, minimatch_1.default)(instance.pkgName, pattern))) && | ||
packages.some((pattern) => (0, minimatch_1.minimatch)(instance.pkgName, pattern))) && | ||
(!(0, is_non_empty_array_1.isNonEmptyArray)(dependencies) || | ||
dependencies.some((pattern) => (0, minimatch_1.default)(instance.name, pattern)))) { | ||
dependencies.some((pattern) => (0, minimatch_1.minimatch)(instance.name, pattern)))) { | ||
group.instances.push(instance); | ||
@@ -36,0 +33,0 @@ return; |
@@ -8,5 +8,6 @@ import type { Context } from '../get-context'; | ||
import { PinnedVersionGroup } from './pinned'; | ||
import { SameRangeVersionGroup } from './same-range'; | ||
import { SnappedToVersionGroup } from './snapped-to'; | ||
import { StandardVersionGroup } from './standard'; | ||
export type AnyVersionGroup = BannedVersionGroup | CatchAllVersionGroup | FilteredOutVersionGroup | IgnoredVersionGroup | PinnedVersionGroup | SnappedToVersionGroup | StandardVersionGroup; | ||
export type AnyVersionGroup = BannedVersionGroup | CatchAllVersionGroup | FilteredOutVersionGroup | IgnoredVersionGroup | PinnedVersionGroup | SameRangeVersionGroup | SnappedToVersionGroup | StandardVersionGroup; | ||
export type VersionGroupReport = { | ||
@@ -37,3 +38,3 @@ name: string; | ||
} | { | ||
status: 'SEMVER_UNSATISFIED'; | ||
status: 'SAME_RANGE_MISMATCH'; | ||
isValid: false; | ||
@@ -55,6 +56,3 @@ } | { | ||
workspaceInstance: Instance; | ||
} | { | ||
status: 'WORKSPACE_UNSATISFIED'; | ||
isValid: false; | ||
}); | ||
export declare function getVersionGroups(ctx: Context): AnyVersionGroup[]; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVersionGroups = void 0; | ||
const minimatch_1 = __importDefault(require("minimatch")); | ||
const minimatch_1 = require("minimatch"); | ||
const is_array_of_strings_1 = require("tightrope/guard/is-array-of-strings"); | ||
@@ -18,2 +15,3 @@ const is_non_empty_array_1 = require("tightrope/guard/is-non-empty-array"); | ||
const pinned_1 = require("./pinned"); | ||
const same_range_1 = require("./same-range"); | ||
const snapped_to_1 = require("./snapped-to"); | ||
@@ -33,5 +31,5 @@ const standard_1 = require("./standard"); | ||
(!(0, is_non_empty_array_1.isNonEmptyArray)(packages) || | ||
packages.some((pattern) => (0, minimatch_1.default)(instance.pkgName, pattern))) && | ||
packages.some((pattern) => (0, minimatch_1.minimatch)(instance.pkgName, pattern))) && | ||
(!(0, is_non_empty_array_1.isNonEmptyArray)(dependencies) || | ||
dependencies.some((pattern) => (0, minimatch_1.default)(instance.name, pattern)))) { | ||
dependencies.some((pattern) => (0, minimatch_1.minimatch)(instance.name, pattern)))) { | ||
group.instances.push(instance); | ||
@@ -102,2 +100,11 @@ return; | ||
} | ||
else if (config.policy === 'sameRange') { | ||
versionGroups.push(new same_range_1.SameRangeVersionGroup({ | ||
dependencies, | ||
dependencyTypes, | ||
label, | ||
packages, | ||
policy: config.policy, | ||
})); | ||
} | ||
else { | ||
@@ -104,0 +111,0 @@ versionGroups.push(new standard_1.StandardVersionGroup({ |
import type { O } from 'ts-toolbelt'; | ||
import type { RcConfig } from '../config/types'; | ||
export type Disk = { | ||
askForChoice: (opts: { | ||
message: string; | ||
choices: string[]; | ||
}) => Promise<string>; | ||
askForInput: (opts: { | ||
message: string; | ||
}) => Promise<string>; | ||
globSync: (pattern: string) => string[]; | ||
process: { | ||
exit: (code: number) => void; | ||
}; | ||
globSync: (pattern: string) => string[]; | ||
readConfigFileSync: (configPath?: string) => O.Partial<RcConfig, 'deep'>; | ||
@@ -9,0 +16,0 @@ readFileSync: (filePath: string) => string; |
@@ -5,2 +5,5 @@ "use strict"; | ||
const cosmiconfig_1 = require("cosmiconfig"); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore Select *does* exist | ||
const enquirer_1 = require("enquirer"); | ||
const fs_extra_1 = require("fs-extra"); | ||
@@ -15,8 +18,10 @@ const glob_1 = require("glob"); | ||
exports.disk = { | ||
process: { | ||
exit(code) { | ||
(0, log_1.verbose)('exit(', code, ')'); | ||
process.exit(code); | ||
}, | ||
askForChoice({ message, choices }) { | ||
return new enquirer_1.Select({ name: 'choice', message, choices }) | ||
.run() | ||
.catch(console.error); | ||
}, | ||
askForInput({ message }) { | ||
return new enquirer_1.Input({ message }).run().catch(console.error); | ||
}, | ||
globSync(pattern) { | ||
@@ -30,2 +35,8 @@ (0, log_1.verbose)('globSync(', pattern, ')'); | ||
}, | ||
process: { | ||
exit(code) { | ||
(0, log_1.verbose)('exit(', code, ')'); | ||
process.exit(code); | ||
}, | ||
}, | ||
readConfigFileSync(configPath) { | ||
@@ -32,0 +43,0 @@ (0, log_1.verbose)('readConfigFileSync(', configPath, ')'); |
@@ -27,3 +27,3 @@ "use strict"; | ||
(0, and_then_1.andThen)((value) => { | ||
const [name, version] = value.split('@'); | ||
const [name, version] = value.split(/@(.*)/); | ||
return (0, is_non_empty_string_1.isNonEmptyString)(name) && (0, is_non_empty_string_1.isNonEmptyString)(version) | ||
@@ -30,0 +30,0 @@ ? new result_1.Ok([[name, version]]) |
{ | ||
"name": "syncpack", | ||
"description": "Consistent dependency versions in large JavaScript Monorepos", | ||
"version": "10.2.0", | ||
"version": "10.5.1", | ||
"author": "Jamie Mason <jamie@foldleft.io> (https://github.com/JamieMason)", | ||
@@ -10,5 +10,7 @@ "bin": { | ||
"syncpack-format": "dist/bin-format/index.js", | ||
"syncpack-lint": "dist/bin-lint/index.js", | ||
"syncpack-lint-semver-ranges": "dist/bin-lint-semver-ranges/index.js", | ||
"syncpack-list": "dist/bin-list/index.js", | ||
"syncpack-list-mismatches": "dist/bin-list-mismatches/index.js", | ||
"syncpack-prompt": "dist/bin-prompt/index.js", | ||
"syncpack-set-semver-ranges": "dist/bin-set-semver-ranges/index.js" | ||
@@ -35,7 +37,8 @@ }, | ||
"cosmiconfig": "8.1.3", | ||
"enquirer": "2.3.6", | ||
"fs-extra": "11.1.1", | ||
"glob": "8.1.0", | ||
"minimatch": "6.2.0", | ||
"glob": "10.2.6", | ||
"minimatch": "9.0.1", | ||
"read-yaml-file": "2.1.0", | ||
"semver": "7.5.0", | ||
"semver": "7.5.1", | ||
"tightrope": "0.1.0", | ||
@@ -48,8 +51,8 @@ "ts-toolbelt": "9.6.0" | ||
"@types/glob": "8.1.0", | ||
"@types/jest": "29.5.1", | ||
"@types/jest": "29.5.2", | ||
"@types/node": "14.18.36", | ||
"@types/semver": "7.3.13", | ||
"@typescript-eslint/eslint-plugin": "5.59.0", | ||
"@typescript-eslint/parser": "5.59.0", | ||
"eslint": "8.39.0", | ||
"@types/semver": "7.5.0", | ||
"@typescript-eslint/eslint-plugin": "5.59.8", | ||
"@typescript-eslint/parser": "5.59.8", | ||
"eslint": "8.42.0", | ||
"eslint-plugin-import": "2.27.5", | ||
@@ -60,6 +63,6 @@ "eslint-plugin-jest": "27.2.1", | ||
"prettier": "2.8.8", | ||
"rimraf": "4.4.1", | ||
"rimraf": "5.0.1", | ||
"ts-jest": "29.1.0", | ||
"ts-node": "10.9.1", | ||
"typescript": "5.0.4" | ||
"typescript": "5.1.3" | ||
}, | ||
@@ -97,3 +100,6 @@ "engines": { | ||
"resolutions": { | ||
"chalk": "4.1.2" | ||
"chalk": "4.1.2", | ||
"string-width": "<5.0.0", | ||
"strip-ansi": "<7.0.0", | ||
"wrap-ansi": "<8.0.0" | ||
}, | ||
@@ -100,0 +106,0 @@ "scripts": { |
160979
173
3610
11
+ Addedenquirer@2.3.6
+ Added@isaacs/cliui@8.0.2(transitive)
+ Added@pkgjs/parseargs@0.11.0(transitive)
+ Addedansi-colors@4.1.3(transitive)
+ Addedansi-regex@5.0.16.1.0(transitive)
+ Addedansi-styles@6.2.1(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@8.0.09.2.2(transitive)
+ Addedenquirer@2.3.6(transitive)
+ Addedforeground-child@3.3.0(transitive)
+ Addedglob@10.2.6(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjackspeak@2.3.6(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedminimatch@9.0.1(transitive)
+ Addedminipass@6.0.2(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedsemver@7.5.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstring-width@4.2.35.1.2(transitive)
+ Addedstrip-ansi@6.0.17.1.0(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwrap-ansi@7.0.08.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@8.1.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@5.1.66.2.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedsemver@7.5.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedglob@10.2.6
Updatedminimatch@9.0.1
Updatedsemver@7.5.1