| 120 | } |
| 121 | |
| 122 | function updateTsConfigFile(tsConfigPath: string): Rule { |
| 123 | return (host: Tree) => { |
| 124 | const json = new JSONFile(host, tsConfigPath); |
| 125 | // Skip adding the files entry if the server entry would already be included. |
| 126 | const include = json.get(['include']); |
| 127 | if (!Array.isArray(include) || !include.includes('src/**/*.ts')) { |
| 128 | const filesPath = ['files']; |
| 129 | const files = new Set((json.get(filesPath) as string[] | undefined) ?? []); |
| 130 | files.add('src/' + serverMainEntryName); |
| 131 | json.modify(filesPath, [...files]); |
| 132 | } |
| 133 | |
| 134 | const typePath = ['compilerOptions', 'types']; |
| 135 | const types = new Set((json.get(typePath) as string[] | undefined) ?? []); |
| 136 | types.add('node'); |
| 137 | json.modify(typePath, [...types]); |
| 138 | }; |
| 139 | } |
| 140 | |
| 141 | function addDependencies(skipInstall: boolean | undefined): Rule { |
| 142 | return (host: Tree) => { |