Skip to content

Commit

Permalink
Fix(schematics): fix issue when the angular.json file have the old st…
Browse files Browse the repository at this point in the history
…ructure, add more error message and how can fix
  • Loading branch information
jorgeucano committed Feb 19, 2021
1 parent b333214 commit 141521e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/scully-schematics/src/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const addDependencies = (local: boolean = false) => (tree: Tree, context: Schema
_scullyComponentVersion = 'file:scullyio/ng-lib-v8.tgz';
addPackageToPackageJson(tree, '@scullyio/ng-lib-v8', `${_scullyComponentVersion}`);
} else {
context.logger.info('Install ng-lib for Angular v+9');
context.logger.info('Install ng-lib');
addPackageToPackageJson(tree, '@scullyio/ng-lib', `${_scullyComponentVersion}`);
}
context.logger.info('✅️ Added dependency');
Expand All @@ -70,7 +70,7 @@ const importScullyModule = (project: string) => (tree: Tree, context: SchematicC
tree.commitUpdate(recorder);
return tree;
} catch (e) {
context.logger.error('error into import SculyLib', e);
context.logger.error(e);
}
};
const addScullyModule = (project: string) => (tree: Tree, context: SchematicContext) => {
Expand Down
14 changes: 14 additions & 0 deletions libs/scully-schematics/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,21 @@ function getProjectProperty(host: Tree, propertyPath: string[], project = '', an
if (!project || project === 'defaultProject') {
project = angularConfig.defaultProject;
}
if (project === undefined) {
throw new Error(`The angular.json file don't have the property 'defaultProject', please run
'ng/nx add @scullyio/init' again with '--project=<<project_name>>' and add the name of your project`);
}
const projectConfig = angularConfig.projects[project];
if(projectConfig === undefined) {
throw new Error(`The angular.json file don't have the property sourceRoot.
Scully need the value for work.
Please add into your angular.json:
...
"projects": {
"${project}": {
"sourceRoot": "<<app_source_root>>",
...`);
return propertyPath.slice(0).reduce((v, item, i, pp) => {
if (v[item] === undefined) {
pp.splice(1);
Expand Down

0 comments on commit 141521e

Please sign in to comment.