Skip to content

Commit ac7753b

Browse files
Cyprien AutexierCyprien Autexier
authored andcommitted
add some modclean options
1 parent 6972ca6 commit ac7753b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

node-modclean.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var minimist = require('minimist');
12
var tasks = require('./tasks.js');
23
var series = require("async/series");
34
var path = require("path");
@@ -6,12 +7,27 @@ const modclean = require('modclean');
67

78
var runModclean = (project) => {
89
return (done) => {
9-
1010
if (fs.existsSync(path.join(project.directory, "node_modules"))) {
1111

12-
modclean({
12+
var modcleanOptions = {
1313
cwd: project.directory
14-
}, function (err, results) {
14+
};
15+
16+
var options = minimist(process.argv.slice(2), {});
17+
18+
if (options.patterns) {
19+
modcleanOptions.patterns = options.patterns.split(',');
20+
}
21+
22+
if (options.additionalpatterns) {
23+
modcleanOptions.additionalPatterns = options.additionalpatterns.split(',');
24+
}
25+
26+
if (options.ignorepatterns) {
27+
modcleanOptions.ignorePatterns = options.ignorepatterns.split(',');
28+
}
29+
30+
modclean(modcleanOptions, function (err, results) {
1531
// called once cleaning is complete.
1632
if (err) {
1733
console.error(`exec error: ${error}`);

0 commit comments

Comments
 (0)