Skip to content

refactor(@schematics/angular): remove unused buildDefaultPath #17597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions packages/schematics/angular/utility/project-targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import { SchematicsException, Tree } from '@angular-devkit/schematics';
import { getProject, isWorkspaceProject } from './project';
import { WorkspaceProject, WorkspaceSchema, WorkspaceTargets } from './workspace-models';

export function getProjectTargets(project: WorkspaceProject): WorkspaceTargets;
export function getProjectTargets(
workspaceOrHost: WorkspaceSchema | Tree,
projectName: string,
): WorkspaceTargets;
export function getProjectTargets(
projectOrHost: WorkspaceProject | Tree | WorkspaceSchema,
projectName = '',
): WorkspaceTargets {
const project = isWorkspaceProject(projectOrHost)
? projectOrHost
: getProject(projectOrHost, projectName);

const projectTargets = project.targets || project.architect;
if (!projectTargets) {
throw new Error('Project target not found.');
}

return projectTargets;
}
import { SchematicsException } from '@angular-devkit/schematics';

export function targetBuildNotFoundError(): SchematicsException {
return new SchematicsException(`Project target "build" not found.`);
Expand Down
48 changes: 0 additions & 48 deletions packages/schematics/angular/utility/project.ts

This file was deleted.

40 changes: 0 additions & 40 deletions packages/schematics/angular/utility/project_spec.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/schematics/angular/utility/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
import { virtualFs, workspaces } from '@angular-devkit/core';
import { Rule, Tree } from '@angular-devkit/schematics';
import { ProjectType } from './workspace-models';

function createHost(tree: Tree): workspaces.WorkspaceHost {
return {
Expand Down Expand Up @@ -74,7 +75,7 @@ export async function getWorkspace(tree: Tree, path = '/') {
*/
export function buildDefaultPath(project: workspaces.ProjectDefinition): string {
const root = project.sourceRoot ? `/${project.sourceRoot}/` : `/${project.root}/src/`;
const projectDirName = project.extensions['projectType'] === 'application' ? 'app' : 'lib';
const projectDirName = project.extensions['projectType'] === ProjectType.Application ? 'app' : 'lib';

return `${root}${projectDirName}`;
}
Expand Down