Skip to content

Commit

Permalink
feat: add post-processing to generation (#172)
Browse files Browse the repository at this point in the history
* feat: add postprocess step at the end of generate

* fix: run prettier
  • Loading branch information
gkocak-scottlogic authored Mar 2, 2023
1 parent f309cdd commit a1c4c1b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ async function generate(schemaPathOrUrl, generatorPathOrUrl, options) {
templates.forEach(processTemplate);
log.verbose("\nIteration complete\n");

try {
const postProcess = require(path.resolve(
generatorPath,
"./postProcess.js"
));
await postProcess(outputFolder, log.getLogLevel(), options);
} catch {
log.verbose(`No post-processing found in ${generatorPath}`);
}

try {
const formatter = require(path.resolve(generatorPath, "./formatter.js"));
await formatter(outputFolder, log.getLogLevel());
Expand Down

0 comments on commit a1c4c1b

Please sign in to comment.