| 56 | } |
| 57 | |
| 58 | function addTsProjectReference(...paths: string[]) { |
| 59 | return (host: Tree) => { |
| 60 | if (!host.exists('tsconfig.json')) { |
| 61 | return host; |
| 62 | } |
| 63 | |
| 64 | const newReferences = paths.map((path) => ({ path })); |
| 65 | |
| 66 | const file = new JSONFile(host, 'tsconfig.json'); |
| 67 | const jsonPath = ['references']; |
| 68 | const value = file.get(jsonPath); |
| 69 | file.modify(jsonPath, Array.isArray(value) ? [...value, ...newReferences] : newReferences); |
| 70 | }; |
| 71 | } |
| 72 | |
| 73 | function addDependenciesToPackageJson({ skipInstall, testRunner }: LibraryOptions): Rule { |
| 74 | return chain([ |