main().catch((error) => { console.error(error); process.exit(1); }).then(() => { return fs.remove(tempDir); });
async function copyToDist(distDir) { await copyDir(clipperDir, 'popup/build', distDir); await copyDir(clipperDir, 'content_scripts', distDir); await copyDir(clipperDir, 'icons', distDir); await fs.copy(`${clipperDir}/background.js`, `${distDir}/background.js`); await fs.copy(`${clipperDir}/manifest.json`, `${distDir}/manifest.json`); await fs.remove(`${distDir}/popup/build/manifest.json`); }
async function checkSourceZip(sourceZip, compiledZip) { const tmpDir = `${require('os').tmpdir()}/${Date.now()}`; console.info(`Checking source ZIP in ${tmpDir}`); const sourceDir = `${tmpDir}/source`; const compiledDir = `${tmpDir}/compiled`; await fs.mkdirp(sourceDir); await fs.mkdirp(compiledDir); process.chdir(sourceDir); console.info(await execCommand(`cp "${sourceZip}" .`)); console.info(await execCommand(`unzip "${sourceZip}"`)); process.chdir(`${sourceDir}/Clipper-source/popup`); console.info(await execCommand('npm install')); process.chdir(compiledDir); console.info(await execCommand(`cp "${compiledZip}" .`)); console.info(await execCommand(`unzip "${compiledZip}"`)); const areEqual = await compareDir(`${sourceDir}/Clipper-source/popup/build`, `${compiledDir}/popup/build`); if (areEqual) { await fs.remove(sourceDir); await fs.remove(compiledDir); } }
const dist = dists[distName]; const distDir = `${clipperDir}/dist/${distName}`; await fs.remove(distDir); await fs.mkdirp(distDir); await copyToDist(distDir);
lproj.forEach(dir => { if (!lprojRegEx.test(dir)) { _promises.push(fs.remove(path.join(cwd, dir))); } });
fs.remove(zipFile);
/** * Remove the node from file system! `Directory` nodes can have contents. Like `rm -rf`. * Wrapper for `fs-extra.remove`. * @returns {promise} */ remove() { return this.fs.remove(this.pathName, ...arguments); }
// 删除模板 let RemoveTemplate = async (ctx, next) => { await authToken(ctx, next, async () => { let { name } = ctx.request.body; let tempPath = path.resolve(__dirname, `../../static/template/${name}`); let promise = fse.remove(tempPath); await setResponse(ctx, promise, { error: '模板删除失败', success: '模板删除成功' }) }, {admin: true}, {insRole: true, childrenKey: 'removeTemplate', parentKey: 'template'}) }
/** * Starts the build process */ async run() { await fs.remove(this._outputDir); await fs.mkdirp(this._outputDir); const srcDirs = await this.discoverDirs(); await this.processDirs(srcDirs); }
async function prepare() { // TODO: check for existence of a non-empty views folder + routes.js // TODO: check for reserved filenames: *.entry.js, views/routes await remove(config.outputDir); }