Skip to content

Commit af54ef0

Browse files
clydinvikerman
authored andcommitted
fix(@angular/cli): support prerelease CLI versions when bootstrapping update
1 parent e620697 commit af54ef0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/angular/cli/commands/update-impl.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
4141
// tslint:disable-next-line:no-big-function
4242
async run(options: UpdateCommandSchema & Arguments) {
4343
// Check if the current installed CLI version is older than the latest version.
44-
if (await this.checkCLILatestVersion(options.verbose)) {
44+
if (await this.checkCLILatestVersion(options.verbose, options.next)) {
4545
this.logger.warn(
4646
'The installed Angular CLI version is older than the latest published version.\n' +
4747
'Installing a temporary version to perform the update.',
4848
);
4949

5050
return runTempPackageBin(
51-
'@angular/cli@latest',
51+
`@angular/cli@${options.next ? 'next' : 'latest'}`,
5252
this.logger,
5353
this.packageManager,
5454
process.argv.slice(2),
@@ -403,7 +403,7 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
403403
* Checks if the current installed CLI version is older than the latest version.
404404
* @returns `true` when the installed version is older.
405405
*/
406-
private async checkCLILatestVersion(verbose = false): Promise<boolean> {
406+
private async checkCLILatestVersion(verbose = false, next = false): Promise<boolean> {
407407
const { version: installedCLIVersion } = require('../package.json');
408408

409409
const LatestCLIManifest = await fetchPackageMetadata(
@@ -415,7 +415,7 @@ export class UpdateCommand extends SchematicCommand<UpdateCommandSchema> {
415415
},
416416
);
417417

418-
const latest = LatestCLIManifest.tags['latest'];
418+
const latest = LatestCLIManifest.tags[next ? 'next' : 'latest'];
419419
if (!latest) {
420420
return false;
421421
}

0 commit comments

Comments
 (0)