diff --git a/schematics/scully/src/ng-add/index.ts b/schematics/scully/src/ng-add/index.ts index 3d8b9cbcc..5ecdb3a36 100644 --- a/schematics/scully/src/ng-add/index.ts +++ b/schematics/scully/src/ng-add/index.ts @@ -19,13 +19,12 @@ export default (options: Schema): Rule => { runScullySchematic(options), ]); }; - const addDependencies = () => (tree: Tree, context: SchematicContext) => { addPackageToPackageJson(tree, '@scullyio/scully', `${scullyVersion}`); const ngCoreVersionTag = getPackageVersionFromPackageJson(tree, '@angular/core'); if (+ngCoreVersionTag.search(/(\^8|~8)/g) === 0) { context.logger.info('Install ng-lib for Angular v8'); - addPackageToPackageJson(tree, '@scullyio/ng-lib-8', `${scullyComponentVersion}`); + addPackageToPackageJson(tree, '@scullyio/ng-lib-v8', `${scullyComponentVersion}`); } else { context.logger.info('Install ng-lib for Angular v9'); addPackageToPackageJson(tree, '@scullyio/ng-lib', `${scullyComponentVersion}`); @@ -97,9 +96,14 @@ const injectIdleService = () => (tree: Tree, context: SchematicContext) => { if (appComponent.includes('IdleMonitorService')) { context.logger.info(`⚠️️ Skipping ${appComponentPath}`); } else { - const idleImport = `import {IdleMonitorService} from '@scullyio/ng-lib';`; + const ngCoreVersionTag = getPackageVersionFromPackageJson(tree, '@angular/core'); + let v8 = ''; + if (+ngCoreVersionTag.search(/(\^8|~8)/g) === 0) { + v8 = '-v8'; + } + const idleImport = `import {IdleMonitorService} from '@scullyio/ng-lib${v8}';`; // add - const idImport = `${idleImport} \n ${appComponent}`; + const idImport = `${idleImport}\n${appComponent}`; const idle = 'private idle: IdleMonitorService'; let output = ''; // check if exist