MCPcopy Index your code
hub / github.com/angular/angularfire / addFixesToServer

Function addFixesToServer

src/schematics/utils.ts:120–149  ·  view source on GitHub ↗
(host: Tree)

Source from the content-addressed store, hash-verified

118
119// TODO rewrite using typescript
120export 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
151export function featureToRules(
152 features: FEATURES[],

Callers

nothing calls this directly

Calls 2

overwriteIfExistsFunction · 0.90
existsMethod · 0.65

Tested by

no test coverage detected