Skip to content

Commit

Permalink
Fixed "targets" issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nitayneeman committed Sep 11, 2018
1 parent 5538e90 commit 878651e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "schematics-utilities",
"version": "1.1.0",
"version": "1.1.1",
"author": "Nitay Neeman",
"description": "🛠️ Useful exported utilities for working with Schematics",
"homepage": "https://github.com/nitayneeman/schematics-utilities",
Expand Down
2 changes: 1 addition & 1 deletion src/angular/project-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function getProjectTargets(
): experimental.workspace.WorkspaceTool {
const projectTargets = (<any>project).targets || project.architect;
if (!projectTargets) {
throw new Error('Project architect not found.');
throw new Error('Project targets not found.');
}

return projectTargets;
Expand Down
9 changes: 6 additions & 3 deletions src/material/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export function getSourceFile(host: Tree, path: string): ts.SourceFile {

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

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

/** Gets the app index.html file */
export function getIndexHtmlPath(project: WorkspaceProject): string {
const buildTarget = project.architect.build.options;
const targets = (<any>project).targets || project.architect;
const buildTarget = targets.build.options;

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

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

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

0 comments on commit 878651e

Please sign in to comment.