From e183c43741b89661cc7e0d328dd565a771eabb75 Mon Sep 17 00:00:00 2001 From: Colin Eberhardt Date: Mon, 19 Dec 2022 14:26:49 +0000 Subject: [PATCH] fix: formatting uses ES module rather than running a shell command --- src/generate.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/generate.js b/src/generate.js index e9f2d2c..9fb2439 100644 --- a/src/generate.js +++ b/src/generate.js @@ -211,10 +211,13 @@ async function generate(schemaPathOrUrl, generatorPathOrUrl, options) { }); log.verbose("\nIteration complete\n"); - const currentPath = process.cwd(); - shell.cd(generatorPath); - shell.exec(`npm run format:write -- ${outputFolder}`, log.shellOptions); - shell.cd(currentPath, log.shellOptions); + + try { + const formatter = require(path.resolve(generatorPath, "./formatter.js")); + formatter(outputFolder, log.getLogLevel()); + } catch { + log.error(`No formatter found in ${generatorPath}`); + } } catch (e) { exception = e; } finally {