@shimo/gulp-build
v1.0.3
Published
Compress your backend codes.
Downloads
2
Keywords
Readme
@shimo/gulp-build
Compress your backend codes in private-deploy-env.
Getting Started
$ npm install --save-dev @shimo/gulp-build
Usage
The plug-in takes a option and process the current folder codes to a sub-dir for private-deploy.
const gulp = require('gulp');
const gulpBuild = require('@shimo/gulp-build');
gulp.task('private-deploy', () => gulpBuild({
dest: './release'
});
Options
dest
The destination dir you want to generate to, like ./release
.
copyResources
The resource files you want to copy to dest without any change.
gulpBuild({
// dest, ...
copyResources: [
'./config/default.toml',
'./config/test.toml',
'./database/migrations/*',
'./test/**'
]
})
entries
The files you want to webpack.
gulpBuild({
// dest, ...
entries: [
'./server.js',
'./bin/migrate.js'
]
})
nodeModuleFilter
This is a function which can exclude some modules to the dest dir. you may not want to webpack some modules in node_modules dir which is in your own private npm registery. using this function you can do this.
gulpBuild({
// dest, ...
nodeModuleFilter (x) {
return x.indexOf('shimo') === -1 &&
x.indexOf('richdoc') === -1
}
})
modifyPkg
The function can modify the package.json in the dest dir. some modules is useless in clients' server and it may occur error if you not modify the package.json.
gulpBuild({
// dest, ...
modifyPkg (pkg) {
['dependencies', 'devDependencies'].forEach(bigKey => {
Object.keys(pkg[bigKey]).forEach(key => {
if (key.indexOf('shimo') > -1) {
delete pkg[bigKey][key]
}
})
})
delete pkg.scripts.preinstall
delete pkg.scripts.install
return pkg
}
})
License
MIT