Skip to content

Commit

Permalink
feat(ng-add): add support for angular v8 (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeucano authored Jan 9, 2020
1 parent 97f230a commit bced623
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions schematics/scully/src/ng-add/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {chain, Rule, SchematicContext, SchematicsException, Tree} from '@angular-devkit/schematics';
import {addPackageToPackageJson} from './package-config';
import {addPackageToPackageJson, getPackageVersionFromPackageJson} from './package-config';
import {Schema} from './schema';
import {scullyVersion, scullyComponentVersion} from './version-names';
import {NodePackageInstallTask, RunSchematicTask} from '@angular-devkit/schematics/tasks';
Expand All @@ -21,7 +21,14 @@ export default (options: Schema): Rule => {

const addDependencies = (options: Schema) => (tree: Tree, context: SchematicContext) => {
addPackageToPackageJson(tree, '@scullyio/scully', `${scullyVersion}`);
addPackageToPackageJson(tree, '@scullyio/ng-lib', `${scullyComponentVersion}`);
const ngCoreVersionTag = getPackageVersionFromPackageJson(tree, '@angular/core');
if (+ngCoreVersionTag.search(/(^8|~8)/g) < 0) {
console.log('⚠ install ng-lib for Angular v8');
addPackageToPackageJson(tree, '@scullyio/ng-lib-8', `${scullyComponentVersion}`);
} else {
console.log('⚠ install ng-lib for Angular v9');
addPackageToPackageJson(tree, '@scullyio/ng-lib', `${scullyComponentVersion}`);
}
context.logger.info('✅️ Added dependency');
};

Expand Down

0 comments on commit bced623

Please sign in to comment.