10 examples of 'rimraf node_modules' in JavaScript

Every line of 'rimraf node_modules' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
9function clean(file) {
10 return rimraf(file, (err) => {
11 console.log(`${chalk.yellow('removed:')} ${chalk.grey(file)}`);
12 });
13}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

22function rimraf_err(e) {
23 if (e) {
24 console.error(e.message);
25 process.exit(1);
26 }
27}
111function cleanNodeModulePackages() {
112 return del(cleanGlobs);
113}
920rimraf(filePath: FilePath) {
921 super.rimraf(filePath);
922 return this.handleFn('rimraf', [filePath]);
923}
33function node_modules(dir) {
34 var fp = path.resolve(path.dirname(dir), 'node_modules/update');
35 return require.resolve(fp);
36}
13function rimraf(dirPath) {
14 if (fs.existsSync(dirPath)) {
15 fs.readdirSync(dirPath).forEach((entry) => {
16 const entryPath = path.join(dirPath, entry);
17 if (fs.lstatSync(entryPath).isDirectory()) {
18 rimraf(entryPath);
19 } else {
20 fs.unlinkSync(entryPath);
21 }
22 });
23 fs.rmdirSync(dirPath);
24 }
25}
28module.exports = function clean(done) {
29 return rimraf(config.dist, (err) => (
30 done(err)
31 ));
32};
90function rmdirSync (path) {
91 try {
92 rimraf.sync(path);
93 } catch(e) {
94 if ( e.code != 'ENOENT' ) throw e;
95 }
96}
55function removeOldFiles() {
56 rimraf.sync(getWebHookDirectory());
57}
197function rimrafDontThrow(directory: string) {
198 fs.removeSync(directory);
199}

Related snippets