-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
39 lines (32 loc) · 1.1 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var gulp = require('gulp');
var path = require('path');
var zip = require('gulp-zip');
var minimist = require('minimist');
var fs = require('fs');
var knownOptions = {
string: 'packageName',
string: 'packagePath',
default: {packageName: "Package.zip", packagePath: path.join(__dirname, '_package')}
}
var options = minimist(process.argv.slice(2), knownOptions);
gulp.task('default', function () {
var packagePaths = ['**',
'!**/_package/**',
'!**/typings/**',
'!typings',
'!_package',
'!gulpfile.js']
//add exclusion patterns for all dev dependencies
var packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
var devDeps = packageJSON.devDependencies;
for(var propName in devDeps)
{
var excludePattern1 = "!**/node_modules/" + propName + "/**";
var excludePattern2 = "!**/node_modules/" + propName;
packagePaths.push(excludePattern1);
packagePaths.push(excludePattern2);
}
return gulp.src(packagePaths)
.pipe(zip(options.packageName))
.pipe(gulp.dest(options.packagePath));
});