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 8
8
9
9
import { DirEntry , Rule , UpdateRecorder } from '@angular-devkit/schematics' ;
10
10
import * as ts from '../../third_party/github.com/Microsoft/TypeScript/lib/typescript' ;
11
+ import { getPackageJsonDependency } from '../../utility/dependencies' ;
11
12
12
13
function * visit ( directory : DirEntry ) : IterableIterator < ts . SourceFile > {
13
14
for ( const path of directory . subfiles ) {
@@ -46,6 +47,10 @@ function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
46
47
*/
47
48
export default function ( ) : Rule {
48
49
return ( tree ) => {
50
+ if ( ! getPackageJsonDependency ( tree , '@angular/ssr' ) ) {
51
+ return ;
52
+ }
53
+
49
54
for ( const sourceFile of visit ( tree . root ) ) {
50
55
let recorder : UpdateRecorder | undefined ;
51
56
Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ describe('CommonEngine migration', () => {
19
19
let tree : UnitTestTree ;
20
20
beforeEach ( ( ) => {
21
21
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
+ ) ;
22
30
} ) ;
23
31
24
32
function runMigration ( ) : Promise < UnitTestTree > {
You can’t perform that action at this time.
0 commit comments