fix(core): handle specifying a prerelease version without a package when migrating (#11129)

This commit is contained in:
Leosvel Pérez Espinosa 2022-07-13 17:26:28 +01:00 committed by GitHub
parent ba592f8a99
commit 9933d91a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -768,6 +768,12 @@ describe('Migration', () => {
targetVersion: '12.0.0',
}
);
expect(
parseMigrationsOptions({ packageAndVersion: '8.12.0-beta.0' })
).toMatchObject({
targetPackage: '@nrwl/workspace',
targetVersion: '8.12.0-beta.0',
});
expect(
parseMigrationsOptions({ packageAndVersion: 'next' })
).toMatchObject({

View File

@ -394,14 +394,14 @@ function parseTargetPackageAndVersion(args: string) {
}
} else {
if (
args.match(/^\d+(?:\.\d+)?(?:\.\d+)?$/) ||
args === 'latest' ||
args === 'next'
args === 'next' ||
valid(args) ||
args.match(/^\d+(?:\.\d+)?(?:\.\d+)?$/)
) {
const targetVersion = normalizeVersionWithTagCheck(args);
const targetPackage =
args.match(/^\d+(?:\.\d+)?(?:\.\d+)?$/) &&
lt(targetVersion, '14.0.0-beta.0')
!['latest', 'next'].includes(args) && lt(targetVersion, '14.0.0-beta.0')
? '@nrwl/workspace'
: 'nx';