license import { Tree } from '@angular-devkit/schematics' ; import { getWorkspace } from '../utility/config' ; import { ProjectType , WorkspaceProject , WorkspaceSchema } from '../utility/workspace-models' ; param project export function buildDefaultPath ( project ) { const root = project . sourceRoot ? `/${ project . sourceRoot }/` : `/${ project . root }/src/` ; const projectDirName = project . projectType === ProjectType . Application ? 'app' : 'lib' ; return `${ root }${ projectDirName }` ; } export function getProject < TProjectType extends ProjectType = ProjectType . Application > ( workspaceOrHost , projectName ) { const workspace = isWorkspaceSchema ( workspaceOrHost ) ? workspaceOrHost : getWorkspace ( workspaceOrHost ) ; return workspace . projects [ projectName ] as WorkspaceProject < TProjectType > ; } export function isWorkspaceSchema ( workspace ) { return ! ! ( workspace && ( workspace as WorkspaceSchema ) . projects ) ; } export function isWorkspaceProject ( project ) { return ! ! ( project && ( project as WorkspaceProject ) . projectType ) ; }