(projectName: string)
| 63 | } |
| 64 | |
| 65 | function 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 |
no test coverage detected
searching dependent graphs…