diff --git a/scripts/generate-clients/code-gen.js b/scripts/generate-clients/code-gen.js index 3873716e9108b..256c0756d68d8 100644 --- a/scripts/generate-clients/code-gen.js +++ b/scripts/generate-clients/code-gen.js @@ -62,4 +62,4 @@ const spawnProcess = (command, args = [], options = {}) => } }); -module.exports = { generateClients }; +module.exports = { generateClients, CODE_GEN_INPUT_DIR }; diff --git a/scripts/generate-clients/copy-to-clients.js b/scripts/generate-clients/copy-to-clients.js index 278e4c2458e1a..10f61c6236ab4 100644 --- a/scripts/generate-clients/copy-to-clients.js +++ b/scripts/generate-clients/copy-to-clients.js @@ -86,4 +86,4 @@ async function copyToClients(clientsDir) { } } -module.exports = { copyToClients }; +module.exports = { copyToClients, CODE_GEN_OUTPUT_DIR }; diff --git a/scripts/generate-clients/index.js b/scripts/generate-clients/index.js index 36236958f6ebb..ce800c1d5d2f4 100644 --- a/scripts/generate-clients/index.js +++ b/scripts/generate-clients/index.js @@ -1,7 +1,8 @@ const yargs = require("yargs"); const path = require("path"); -const { generateClients } = require("./code-gen"); -const { copyToClients } = require("./copy-to-clients"); +const { emptyDirSync } = require("fs-extra"); +const { generateClients, CODE_GEN_INPUT_DIR } = require("./code-gen"); +const { copyToClients, CODE_GEN_OUTPUT_DIR } = require("./copy-to-clients"); const CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "clients")); @@ -20,6 +21,8 @@ const { models, output: clientsDir } = yargs try { await generateClients(models); await copyToClients(clientsDir); + emptyDirSync(CODE_GEN_INPUT_DIR); + emptyDirSync(CODE_GEN_OUTPUT_DIR); } catch (e) { console.log(e); process.exit(1);