Skip to content

Commit

Permalink
fix(schematics): add parse5 dep (#11647)
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl authored and victoriaaa234 committed Jul 25, 2018
1 parent 046f9b9 commit b7f7497
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -41,6 +41,9 @@
"tslib": "^1.9.0",
"zone.js": "^0.8.26"
},
"optionalDependencies": {
"parse5": "^5.0.0"
},
"devDependencies": {
"@angular-devkit/core": "^0.5.12",
"@angular-devkit/schematics": "^0.5.12",
Expand Down
7 changes: 6 additions & 1 deletion src/lib/schematics/install/index.ts
@@ -1,4 +1,4 @@
import {chain, noop, Rule, Tree, SchematicContext} from '@angular-devkit/schematics';
import {chain, noop, Rule, Tree, SchematicContext, SchematicsException} from '@angular-devkit/schematics';
import {NodePackageInstallTask} from '@angular-devkit/schematics/tasks';
import {addModuleImportToRootModule, getStylesPath} from '../utils/ast';
import {InsertChange} from '../utils/devkit-utils/change';
Expand All @@ -8,6 +8,7 @@ import {angularVersion, materialVersion} from '../utils/lib-versions';
import {addPackageToPackageJson} from '../utils/package';
import {Schema} from './schema';
import {addThemeToAppStyles} from './theming';
import * as parse5 from 'parse5';


/**
Expand All @@ -17,6 +18,10 @@ import {addThemeToAppStyles} from './theming';
* - Adds Browser Animation to app.momdule
*/
export default function(options: Schema): Rule {
if (!parse5) {
throw new SchematicsException('parse5 depedency not found! Please install parse5 from npm to continue.');
}

return chain([
options && options.skipPackageJson ? noop() : addMaterialToPackageJson(),
addThemeToAppStyles(options),
Expand Down

0 comments on commit b7f7497

Please sign in to comment.