(host: Tree)
| 118 | |
| 119 | // TODO rewrite using typescript |
| 120 | export function addFixesToServer(host: Tree) { |
| 121 | const serverPath = `/server.ts`; |
| 122 | |
| 123 | if (!host.exists(serverPath)) { |
| 124 | return host; |
| 125 | } |
| 126 | |
| 127 | const text = host.read(serverPath); |
| 128 | if (text === null) { |
| 129 | throw new SchematicsException(`File ${serverPath} does not exist.`); |
| 130 | } |
| 131 | const sourceText = text.toString("utf-8"); |
| 132 | const addZonePatch = !sourceText.includes( |
| 133 | "import 'zone.js/dist/zone-patch-rxjs';" |
| 134 | ); |
| 135 | |
| 136 | if (addZonePatch) { |
| 137 | overwriteIfExists( |
| 138 | host, |
| 139 | serverPath, |
| 140 | sourceText.replace( |
| 141 | "import 'zone.js/dist/zone-node';", |
| 142 | `import 'zone.js/dist/zone-node'; |
| 143 | ${addZonePatch ? "import 'zone.js/dist/zone-patch-rxjs';" : ""}` |
| 144 | ) |
| 145 | ); |
| 146 | } |
| 147 | |
| 148 | return host; |
| 149 | } |
| 150 | |
| 151 | export function featureToRules( |
| 152 | features: FEATURES[], |
nothing calls this directly
no test coverage detected