diff --git a/scripts/build-static-assets-artifact.js b/scripts/build-static-assets-artifact.js index ee3e7328..d2189f3e 100755 --- a/scripts/build-static-assets-artifact.js +++ b/scripts/build-static-assets-artifact.js @@ -21,7 +21,7 @@ const fs = require('fs'); const path = require('path'); const mkdirp = require('mkdirp'); -const rimraf = require('rimraf'); +const { rimraf } = require('rimraf'); const TEMP_STATIC_PATH = path.resolve(__dirname, '../.tmp-statics'); const FINAL_TAR_DIR = path.resolve(__dirname, '../'); @@ -33,16 +33,6 @@ if (!DOCKER_IMAGE_LABEL) { throw new Error('docker image label to copy built static files from is required'); } -function removeDir(dirPath) { - return new Promise((res, rej) => rimraf(dirPath, { disableGlob: true }, (err) => { - if (err) { - rej(err); - } else { - res(); - } - })); -} - function promisifySpawn(...args) { return new Promise((res, rej) => { const spawnedProcess = spawn(...args); @@ -132,6 +122,6 @@ function moveTar(tarPath, finalTarDir) { console.error('unable to build static assets artifact,', err); process.exitCode = 1; } finally { - await removeDir(TEMP_STATIC_PATH); + await rimraf(TEMP_STATIC_PATH, { disableGlob: true }); } })(); diff --git a/scripts/set-dev-endpoints.js b/scripts/set-dev-endpoints.js index ff544197..7c3701cb 100644 --- a/scripts/set-dev-endpoints.js +++ b/scripts/set-dev-endpoints.js @@ -22,7 +22,7 @@ const os = require('os'); const assert = require('assert'); const { argv } = require('yargs'); -const rimraf = require('rimraf'); +const { rimrafSync } = require('rimraf'); const PATH_TO_ENDPOINTS = path.resolve(process.cwd(), argv.path || argv._[0]); const DEV_DIR = path.join(process.cwd(), '.dev'); @@ -35,7 +35,7 @@ const addDevFolder = () => { }; const removeExistingEndpointsFile = () => { - rimraf.sync(ENDPOINTS_DIR); + rimrafSync(ENDPOINTS_DIR); }; const symlinkEndpointsFile = () => {