MCPcopy Create free account
hub / github.com/callstackincubator/polygen / finalize

Method finalize

packages/codegen/src/codegen.ts:257–272  ·  view source on GitHub ↗

* Finalizes the generation process by writing the generated files to the output directory.

()

Source from the content-addressed store, hash-verified

255 * Finalizes the generation process by writing the generated files to the output directory.
256 */
257 async finalize() {
258 const generatedMapPath = this.generator.outputPathTo('polygen-output.json');
259 const resolvedExternalModules =
260 await this.project.modules.getExternalModules();
261 const contents = {
262 files: this.generator.writtenFiles,
263 externalPackages: Object.fromEntries(
264 resolvedExternalModules.map((m) => [m.packageName, m.resolvedPath])
265 ),
266 };
267
268 await fs.writeFile(
269 generatedMapPath,
270 JSON.stringify(contents, undefined, 2)
271 );
272 }
273
274 get rootOutput(): OutputGenerator {
275 return this.generator;

Callers 1

generateFunction · 0.80

Calls 2

outputPathToMethod · 0.80
getExternalModulesMethod · 0.80

Tested by

no test coverage detected