Socket
Socket
Sign inDemoInstall

clean-webpack-plugin

Package Overview
Dependencies
12
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.9 to 0.1.10

44

index.js
'use strict';
var fs = require('fs');
var os = require('os');

@@ -125,4 +126,38 @@ var path = require('path');

var childrenAfterExcluding = [];
var excludedChildren = [];
if(_this.options.exclude && _this.options.exclude.length) {
try {
var pathStat = fs.statSync(rimrafPath);
if (pathStat.isDirectory()) {
childrenAfterExcluding = fs.readdirSync(rimrafPath)
.filter(function (childFile) {
var include = _this.options.exclude.indexOf(childFile) < 0;
if (!include) {
excludedChildren.push(childFile);
}
return include;
})
.map(function (file) {
var fullPath = path.join(rimrafPath, file);
if (os.platform() === 'win32') {
fullPath = upperCaseWindowsRoot(fullPath);
}
return fullPath;
});
}
} catch (e) {
childrenAfterExcluding = [];
}
}
if (_this.options.dry !== true) {
rimraf.sync(rimrafPath);
if (_this.options.exclude && excludedChildren.length) {
childrenAfterExcluding.forEach(function (child) {
rimraf.sync(child);
});
} else {
rimraf.sync(rimrafPath);
}
}

@@ -132,3 +167,8 @@

console.warn('clean-webpack-plugin: ' + rimrafPath + ' has been removed.');
results.push({ path: rimrafPath, output: 'removed' });
_this.options.verbose && excludedChildren.length &&
console.warn('clean-webpack-plugin: ' + excludedChildren.length + ' file(s) excluded - ' + excludedChildren.join(', '));
excludedChildren.length ?
results.push({ path: rimrafPath, output: 'removed with exclusions (' + excludedChildren.length + ')'}) :
results.push({ path: rimrafPath, output: 'removed' });
});

@@ -135,0 +175,0 @@

4

package.json
{
"name": "clean-webpack-plugin",
"version": "0.1.9",
"author": "John Agan <johnagan@github.com>",
"version": "0.1.10",
"author": "John Agan <johnagan@gmail.com>",
"description": "A webpack plugin to remove your build folder(s) before building",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/johnagan/clean-webpack-plugin",

@@ -22,3 +22,4 @@ # Clean for webpack

verbose: true,
dry: false
dry: false,
exclude: ['shared.js']
})

@@ -48,2 +49,5 @@ ]

"dry": false, // Do not delete anything, good for testing.
"exclude": ["files", "to", "ignore"] // Instead of removing whole path recursively,
// remove all path's content with exclusion of provided immediate children.
// Good for not removing shared files from build directories.
}

@@ -50,0 +54,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc