MCPcopy
hub / github.com/angular/angular / addTypeScriptConfigTypes

Function addTypeScriptConfigTypes

packages/localize/schematics/ng-add/index.ts:65–148  ·  view source on GitHub ↗
(projectName: string)

Source from the content-addressed store, hash-verified

63}
64
65function addTypeScriptConfigTypes(projectName: string): Rule {
66 return async (host: Tree) => {
67 const workspace = await readWorkspace(host);
68 const project = workspace.projects.get(projectName);
69 if (!project) {
70 throw new SchematicsException(`Invalid project name '${projectName}'.`);
71 }
72
73 // We add the root workspace tsconfig for better IDE support.
74 const tsConfigFiles = new Set<string>();
75 for (const target of project.targets.values()) {
76 switch (target.builder) {
77 case AngularBuilder.Karma:
78 case AngularBuilder.Server:
79 case AngularBuilder.BrowserEsbuild:
80 case AngularBuilder.Browser:
81 case AngularBuilder.Application:
82 case AngularBuilder.BuildKarma:
83 case AngularBuilder.BuildApplication: {
84 const value = target.options?.['tsConfig'];
85 if (typeof value === 'string') {
86 tsConfigFiles.add(value);
87 }
88
89 break;
90 }
91 case AngularBuilder.BuildUnitTest: {
92 const value = target.options?.['tsConfig'];
93 if (typeof value === 'string') {
94 tsConfigFiles.add(value);
95 } else {
96 // Defaults to tsconfig in project root
97 tsConfigFiles.add((project.root || '.') + '/tsconfig.spec.json');
98 }
99
100 break;
101 }
102 }
103
104 if (
105 target.builder === AngularBuilder.Browser ||
106 target.builder === AngularBuilder.BrowserEsbuild
107 ) {
108 const value = target.options?.['main'];
109 if (typeof value === 'string') {
110 addTripleSlashType(host, value);
111 }
112 } else if (
113 target.builder === AngularBuilder.Application ||
114 target.builder === AngularBuilder.BuildApplication
115 ) {
116 const value = target.options?.['browser'];
117 if (typeof value === 'string') {
118 addTripleSlashType(host, value);
119 }
120 }
121 }
122

Callers 1

index.tsFile · 0.85

Calls 8

addTripleSlashTypeFunction · 0.85
valuesMethod · 0.80
isArrayMethod · 0.80
someMethod · 0.80
getMethod · 0.65
addMethod · 0.65
existsMethod · 0.65
modifyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…