File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
packages/schematics/angular/migrations/update-ssr-imports Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 88
99import { DirEntry , Rule , UpdateRecorder } from '@angular-devkit/schematics' ;
1010import * as ts from '../../third_party/github.com/Microsoft/TypeScript/lib/typescript' ;
11+ import { getPackageJsonDependency } from '../../utility/dependencies' ;
1112
1213function * visit ( directory : DirEntry ) : IterableIterator < ts . SourceFile > {
1314 for ( const path of directory . subfiles ) {
@@ -46,6 +47,10 @@ function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
4647 */
4748export default function ( ) : Rule {
4849 return ( tree ) => {
50+ if ( ! getPackageJsonDependency ( tree , '@angular/ssr' ) ) {
51+ return ;
52+ }
53+
4954 for ( const sourceFile of visit ( tree . root ) ) {
5055 let recorder : UpdateRecorder | undefined ;
5156
Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ describe('CommonEngine migration', () => {
1919 let tree : UnitTestTree ;
2020 beforeEach ( ( ) => {
2121 tree = new UnitTestTree ( new EmptyTree ( ) ) ;
22+ tree . create (
23+ 'package.json' ,
24+ JSON . stringify ( {
25+ dependencies : {
26+ '@angular/ssr' : '0.0.0' ,
27+ } ,
28+ } ) ,
29+ ) ;
2230 } ) ;
2331
2432 function runMigration ( ) : Promise < UnitTestTree > {
You can’t perform that action at this time.
0 commit comments