MCPcopy Create free account
hub / github.com/SoCreate/angular-playground / getProjectPath

Function getProjectPath

projects/schematics/src/utils/project.ts:5–25  ·  view source on GitHub ↗
(
  workspace: workspaces.WorkspaceDefinition,
  options: { project?: string | undefined; path?: string | undefined },
)

Source from the content-addressed store, hash-verified

3import { ProjectDefinitionCollection } from "@angular-devkit/core/src/workspace/definitions";
4
5export function getProjectPath(
6 workspace: workspaces.WorkspaceDefinition,
7 options: { project?: string | undefined; path?: string | undefined },
8) {
9 const project = getProject(workspace, options);
10
11 if (project?.root.substr(-1) === '/') {
12 project.root = project.root.substr(0, project.root.length - 1);
13 }
14
15 if (options.path === undefined) {
16 const projectDirName = project?.extensions.projectType === 'application'
17 ? 'app'
18 : 'lib';
19
20 const sourceRoot = getSourceRoot(project?.sourceRoot);
21 return `${project?.root ? `/${project.root}` : ''}/${sourceRoot}/${projectDirName}`;
22 }
23
24 return options.path;
25}
26
27export function getProject(
28 workspace: workspaces.WorkspaceDefinition,

Callers 1

sandboxFunction · 0.90

Calls 2

getProjectFunction · 0.85
getSourceRootFunction · 0.85

Tested by

no test coverage detected