Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/cli): error when updating Angular packages across multi-…
…major migrations With this change we show an error message when users try to update `@angular/` and `@nguniversal/` packages across multiple major versions. (cherry picked from commit 57d7eb5)
- Loading branch information
1 parent
964a73f
commit 5ad1457
Showing
3 changed files
with
63 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 0 additions & 120 deletions
120
packages/schematics/angular/migrations/migration-collection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/legacy-cli/e2e/tests/update/update-multiple-versions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createProjectFromAsset } from '../../utils/assets'; | ||
import { installWorkspacePackages, setRegistry } from '../../utils/packages'; | ||
import { ng } from '../../utils/process'; | ||
import { isPrereleaseCli } from '../../utils/project'; | ||
import { expectToFail } from '../../utils/utils'; | ||
|
||
export default async function () { | ||
try { | ||
await createProjectFromAsset('9.0-project', true, true); | ||
await setRegistry(false); | ||
await installWorkspacePackages(); | ||
|
||
await setRegistry(true); | ||
const extraArgs = ['--force']; | ||
if (isPrereleaseCli()) { | ||
extraArgs.push('--next'); | ||
} | ||
|
||
const { message } = await expectToFail(() => | ||
ng('update', '@angular/cli', '--force', ...extraArgs), | ||
); | ||
if ( | ||
!message.includes( | ||
`Updating multiple major versions of '@angular/cli' at once is not supported`, | ||
) | ||
) { | ||
console.error(message); | ||
throw new Error( | ||
`Expected error message to include "Updating multiple major versions of '@angular/cli' at once is not supported" but didn't.`, | ||
); | ||
} | ||
} finally { | ||
await setRegistry(true); | ||
} | ||
} |