Skip to content

Commit ff477a5

Browse files
committed
fix(schematics): use default project instead of first project if not set
1 parent 24125e5 commit ff477a5

File tree

1 file changed

+2
-7
lines changed
  • projects/angular-calendar/schematics/ng-add

1 file changed

+2
-7
lines changed

projects/angular-calendar/schematics/ng-add/index.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Rule,
44
SchematicContext,
55
Tree,
6-
chain,
6+
chain
77
} from '@angular-devkit/schematics';
88
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
99
import { getWorkspace } from '@schematics/angular/utility/config';
@@ -102,12 +102,7 @@ function addModuleToImports(options: Schema): Rule {
102102
context.logger.log('info', `Add modules imports options...`);
103103

104104
const workspace = getWorkspace(host);
105-
const project = getProjectFromWorkspace(
106-
workspace,
107-
options.projectName
108-
? options.projectName
109-
: Object.keys(workspace['projects'])[0]
110-
);
105+
const project = getProjectFromWorkspace(workspace, options.projectName);
111106
const mainPath = getProjectMainFile(project);
112107
const appModulePath = options.module
113108
? normalize(project.root + '/' + options.module)

0 commit comments

Comments
 (0)