tasks.add([ { title: 'Cleanup', skip: () => hasLockFile, task: () => del('node_modules') }, { title: 'Installing dependencies using Yarn', enabled: () => options.yarn === true, task: () => exec('yarn', ['install', '--frozen-lockfile', '--production=false']).pipe( catchError(error => { if (error.stderr.startsWith('error Your lockfile needs to be updated')) { return throwError(new Error('yarn.lock file is outdated. Run yarn, commit the updated lockfile and try again.')); } return throwError(error); }) ) }, { title: 'Installing dependencies using npm', enabled: () => options.yarn === false, task: () => { const args = hasLockFile ? ['ci'] : ['install', '--no-package-lock', '--no-production']; return exec('npm', [...args, '--engine-strict']); } } ]);
// Remove the cache of a file const removeOne = async function(path, { cacheDir, cwd: cwdOpt, mode } = {}) { const { cachePath } = await parsePath({ path, cacheDir, cwdOpt, mode }) if (!(await hasFiles(cachePath))) { return false } await del(cachePath, { force: true }) await removeManifest(cachePath) return true }
//////////////////////////////////////////////////////////////////////////////// // Clear compiled files //////////////////////////////////////////////////////////////////////////////// function clean() { return del(['./dist/', './app/assets/']); }
const removeUUID = (uuid) => { try { let cleanedUUID = uuid.replace(".", "") uploads[cleanedUUID].status = "deleted" del(outPath + cleanedUUID + "/", { force: true }) fileUpdateEvent(uuid) } catch (e) { console.log(`Couldn't delete ${uuid}`) } }
afterAll(async () => { await Promise.all([ del(testDir, {force: true}), npmServer && npmServer.close(), githubServer && githubServer.close(), ]); });
// Remove the cache manifest from filesystem const removeManifest = async function(cachePath) { const manifestPath = getManifestPath(cachePath) await del(manifestPath, { force: true }) }
const loadEdgeHandlerBundle = async function({ outputDir, manifestPath }) { const bundlePath = getEdgeHandlerBundlePath({ outputDir, manifestPath }) try { return requireEdgeHandleBundle(bundlePath) } finally { await del(bundlePath, { force: true }) } }
tap.afterEach(async () => { if (!shouldDeleteFile) return Promise.resolve() // console.error('########## DELETING CUSTOM PACKAGE.JSON FILE') await del('package.json') shouldDeleteFile = false expectedVersion = undefined })
// Useful resources // * https://www.smashingmagazine.com/2014/06/building-with-gulp/ // * https://github.com/gulpjs/gulp/tree/master/docs/recipes gulp.task('clean', () => { return del(['./dist/*']); });
function clean() { log('removing the old files in the directory') return del('../prod-build/**', {force:true}); }
// Removing a directory sometimes fails on Windows in CI due to Windows // directory locking. // This results in `EBUSY: resource busy or locked, rmdir /path/to/dir` const removeDir = async function(dir) { try { await del(dir, { force: true }) // eslint-disable-next-line no-empty } catch (error) {} }
const loadEdgeHandlerBundle = async function({ outputDir, manifestPath }) { const bundlePath = getEdgeHandlerBundlePath({ outputDir, manifestPath }) try { return requireEdgeHandleBundle(bundlePath) } finally { await del(bundlePath, { force: true }) } }
gulp.task('clean', function(done) { return del([ 'manifest/**/*' ], done); });
// Remove temporary directory const removeDist = async function(dir) { await del(dir, { force: true }) }
// Remove temporary directory const removeDist = async function(dir) { await del(dir, { force: true }) }