Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { DirEntry, Rule, UpdateRecorder } from '@angular-devkit/schematics';
import * as ts from '../../third_party/github.com/Microsoft/TypeScript/lib/typescript';
import { getPackageJsonDependency } from '../../utility/dependencies';

function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
for (const path of directory.subfiles) {
Expand Down Expand Up @@ -46,6 +47,10 @@ function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
*/
export default function (): Rule {
return (tree) => {
if (!getPackageJsonDependency(tree, '@angular/ssr')) {
return;
}

for (const sourceFile of visit(tree.root)) {
let recorder: UpdateRecorder | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ describe('CommonEngine migration', () => {
let tree: UnitTestTree;
beforeEach(() => {
tree = new UnitTestTree(new EmptyTree());
tree.create(
'package.json',
JSON.stringify({
dependencies: {
'@angular/ssr': '0.0.0',
},
}),
);
});

function runMigration(): Promise<UnitTestTree> {
Expand Down