const rmDirFiles = dir => { const dirPath = fs.readdirSync(dir); dirPath.map(item => { const currentPath = path.join(dir, item); console.log(`rmove ${currentPath}`); fileTool.removeSync(currentPath); }); }
afterAll(() => { fs.removeSync(out); });
cleanup() { fs.removeSync(this.tmpFolderPath); }
projects.forEach(({ name, docsPath, outputDir }) => { const tmpDir = path.join(outputDir, 'tmp'); const project = app.convert(app.expandInputFiles([docsPath])); if (project) { app.generateDocs(project, tmpDir); if (fs.existsSync(tmpDir)) { const [tmpFileName] = fs.readdirSync(tmpDir); const pathArr = tmpDir.split('/'); pathArr.splice(-1, 1); const out = path.join(...pathArr); const currentPath = path.join(out, `${name}.md`); fs.copyFileSync(path.join(tmpDir, tmpFileName), currentPath); fs.removeSync(tmpDir); } } else { console.error(`Error while generating '${name}' docs`); } });
constructor(repo) { this.repo = repo; this.tmpFolderPath = path.resolve('.', 'node_modules', '.tmp'); try { fs.mkdirSync(this.tmpFolderPath); } catch (err) { if (err.code === 'EEXIST') { fs.removeSync(this.tmpFolderPath); fs.mkdirSync(this.tmpFolderPath); } else { throw err; } } this.repoArchivePath = `${this.tmpFolderPath}/master.tar.gz`; }
removeUser(username, callback) { this.db.findOne({username}).exec((findError, user) => { if (findError) { return callback(null, findError); } // Username not found. if (user == null) { return callback(null, user); } this.db.remove({username}, {}, removeError => { if (removeError) { return callback(null, removeError); } fs.removeSync(path.join(config.dbPath, user._id)); return callback({username}); }); }); }
fs.removeSync(out); });
step('stop server 1', () => { return Promise.resolve() .then(() => { return context.httpServer1.stop(); }) .then(() => { fs.removeSync('data/' + name1 + '/'); }); });
const createNaivecoin = (name, host, port, peers, removeData = true) => { if (removeData) fs.removeSync('data/' + name + '/'); let blockchain = new Blockchain(name); let operator = new Operator(name, blockchain); let miner = new Miner(blockchain, logLevel); let node = new Node(host, port, peers, blockchain); let httpServer = new HttpServer(node, blockchain, operator, miner); return httpServer.listen(host, port); }
step('stop server 2', () => { return Promise.resolve() .then(() => { return context.httpServer2.stop(); }) .then(() => { fs.removeSync('data/' + name2 + '/'); }); });
link({instance, installPath, version, rollback}) { const symlinkSync = require('symlink-or-copy').sync; fs.removeSync(path.join(process.cwd(), 'current')); symlinkSync(installPath, path.join(process.cwd(), 'current')); instance.previousVersion = rollback ? null : instance.version; instance.version = version; instance.nodeVersion = process.versions.node; }
action() { try { readdirSync(process.cwd()) .filter(file => file[0] !== '.' && KEEPS.indexOf(file) === -1) .forEach(file => removeSync(file)) } catch (e) { logger.error(e) } }
output.on('close', () => { global.console.log(`mirror.zip [${archive.pointer()} bytes]`) removeSync(dir('temp')) copySync(dir('CNAME'), dir('docs', 'CNAME')) })
function T() { let a = u('clean target folder'); try {d.removeSync(M.dist);} catch (b) {return a.fail(b), !1;} return a.done(), !0; }
afterAll(() => { fs.removeSync(out); });