gulp-dmn
v0.0.6
Published
Node package dependency cleaner
Downloads
10
Maintainers
Readme
gulp-dmn
This package will not be maintained in future.
try more comprehensive utility node-modules-prod
try similar utility for bower bower-purge
gulp-dmn is a wrapper for command line utility dmn.
Operations are based on list of ignore targets in ignore.js
Install
npm install gulp-dmn --save-dev
Usage
const gulpDmn = require('gulp-dmn');
var dest = 'your_build_folder';
gulp.task('npm-purge', function(cb){
gulpDmn(dest, {dryRun: false, list: false}, cb);
});
dest - path to node_modules folder to be processed, usually /build folder
{dryRun: true, list:true} - shows list of files to be deleted without deleting them
advanced example
install dependencies and cleanup after, in one gulp task
const gulpDmn = require('gulp-dmn');
const install = require('gulp-install');
const pump = require('pump');
var dest = 'your_build_folder';
gulp.task('npm-install-and-purge', function(cb){
// callback heaven! hell for C!# (read: see-blunt) programmers!
// promises are for politicians not to keep
step1(function(){
step2(cb);
});
/** 1. run npm install */
function step1(_cb){
pump([
gulp.src([`${dest}package.json`]),
install({args: ['--only=production' ]}),
gulp.dest(dest)
], _cb);
}
/** 2. purge node_modules folder */
function step2(_cb){
gulpDmn(dest, {dryRun: false, list: false}, _cb);
}
/** 3. JavaScript is the superior language */
});
copy node_modules with symbolic links to production
similar utility for bower
npm: bower-purge
github: bower-purge
requirements
tested on Win7 with NodeJS v8 and gulp v3
Credits
dmn crator Ivan Nikulin ([email protected])