diff --git a/scripts/build.cli.js b/scripts/build.cli.js index 384f449f..06beb979 100644 --- a/scripts/build.cli.js +++ b/scripts/build.cli.js @@ -7,11 +7,6 @@ const {compilerOptions: {target}} = require('../tsconfig.json'); const diplodocExtensions = Object.keys(dependencies).filter((name) => name.startsWith('@diplodoc')); -for (const [type, path] of Object.entries(client.src)) { - const dst = client.dst[type]; - - shell.cp('-f', path, dst); -} const commonConfig = { tsconfig: './tsconfig.json', @@ -31,7 +26,7 @@ const builds = [ [['src/workers/linter/index.ts'], 'build/linter.js'], ]; -builds.forEach(([entries, outfile]) => { +Promise.all(builds.map(([entries, outfile]) => { const currentConfig = { ...commonConfig, entryPoints: entries, @@ -45,5 +40,13 @@ builds.forEach(([entries, outfile]) => { currentConfig.external = diplodocExtensions; } - esbuild.build(currentConfig); + return esbuild.build(currentConfig); +})).then(() => { + for (const [type, path] of Object.entries(client.src)) { + const dst = client.dst[type]; + + shell.cp('-f', path, dst); + } }); + +