MCPcopy Index your code
hub / github.com/angular/angular-cli / addLibToWorkspaceFile

Function addLibToWorkspaceFile

packages/schematics/angular/library/index.ts:91–135  ·  view source on GitHub ↗
(
  options: LibraryOptions,
  projectRoot: string,
  projectName: string,
  hasZoneDependency: boolean,
)

Source from the content-addressed store, hash-verified

89}
90
91function addLibToWorkspaceFile(
92 options: LibraryOptions,
93 projectRoot: string,
94 projectName: string,
95 hasZoneDependency: boolean,
96): Rule {
97 return updateWorkspace((workspace) => {
98 workspace.projects.add({
99 name: projectName,
100 root: projectRoot,
101 sourceRoot: `${projectRoot}/src`,
102 projectType: ProjectType.Library,
103 prefix: options.prefix,
104 targets: {
105 build: {
106 builder: Builders.BuildNgPackagr,
107 defaultConfiguration: 'production',
108 configurations: {
109 production: {
110 tsConfig: `${projectRoot}/tsconfig.lib.prod.json`,
111 },
112 development: {
113 tsConfig: `${projectRoot}/tsconfig.lib.json`,
114 },
115 },
116 },
117 test:
118 options.testRunner === TestRunner.Vitest
119 ? {
120 builder: Builders.BuildUnitTest,
121 options: {
122 tsConfig: `${projectRoot}/tsconfig.spec.json`,
123 },
124 }
125 : {
126 builder: Builders.BuildKarma,
127 options: {
128 tsConfig: `${projectRoot}/tsconfig.spec.json`,
129 polyfills: hasZoneDependency ? ['zone.js', 'zone.js/testing'] : undefined,
130 },
131 },
132 },
133 });
134 });
135}
136
137export default function (options: LibraryOptions): Rule {
138 return async (host: Tree) => {

Callers 1

index.tsFile · 0.85

Calls 2

updateWorkspaceFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected