Skip to content

Commit 878651e

Browse files
committed
Fixed "targets" issue
1 parent 5538e90 commit 878651e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "schematics-utilities",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"author": "Nitay Neeman",
55
"description": "🛠️ Useful exported utilities for working with Schematics",
66
"homepage": "https://github.com/nitayneeman/schematics-utilities",

src/angular/project-targets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function getProjectTargets(
1313
): experimental.workspace.WorkspaceTool {
1414
const projectTargets = (<any>project).targets || project.architect;
1515
if (!projectTargets) {
16-
throw new Error('Project architect not found.');
16+
throw new Error('Project targets not found.');
1717
}
1818

1919
return projectTargets;

src/material/ast.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export function getSourceFile(host: Tree, path: string): ts.SourceFile {
3030

3131
/** Import and add module to root app module. */
3232
export function addModuleImportToRootModule(host: Tree, moduleName: string, src: string, project: WorkspaceProject) {
33-
const modulePath = getAppModulePath(host, project.architect.build.options.main);
33+
const targets = (<any>project).targets || project.architect;
34+
const modulePath = getAppModulePath(host, targets.build.options.main);
3435
addModuleImportToModule(host, modulePath, moduleName, src);
3536
}
3637

@@ -62,7 +63,8 @@ export function addModuleImportToModule(host: Tree, modulePath: string, moduleNa
6263

6364
/** Gets the app index.html file */
6465
export function getIndexHtmlPath(project: WorkspaceProject): string {
65-
const buildTarget = project.architect.build.options;
66+
const targets = (<any>project).targets || project.architect;
67+
const buildTarget = targets.build.options;
6668

6769
if (buildTarget.index && buildTarget.index.endsWith('index.html')) {
6870
return buildTarget.index;
@@ -73,7 +75,8 @@ export function getIndexHtmlPath(project: WorkspaceProject): string {
7375

7476
/** Get the root stylesheet file. */
7577
export function getStylesPath(project: WorkspaceProject): string {
76-
const buildTarget = project.architect['build'];
78+
const targets = (<any>project).targets || project.architect;
79+
const buildTarget = targets['build'];
7780

7881
if (buildTarget.options && buildTarget.options.styles && buildTarget.options.styles.length) {
7982
const styles = buildTarget.options.styles.map(s => (typeof s === 'string' ? s : s.input));

0 commit comments

Comments
 (0)