-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathgulpfile.js
More file actions
26 lines (23 loc) · 726 Bytes
/
gulpfile.js
File metadata and controls
26 lines (23 loc) · 726 Bytes
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
const gulp = require('gulp');
const vfs = require('vinyl-fs');
const zip = require('gulp-zip');
const rename = require('gulp-rename');
const join = require('path').join;
const package = require('./package.json')
gulp.task('build', function () {
var deps = Object.keys(package.dependencies || {});
var buildId = `${package.name}-${package.version}`;
var files = [
'package.json',
'index.js',
'{lib,public,server,webpackShims}/**/*',
`node_modules/{${ deps.join(',') }}/**/*`,
];
vfs
.src(files, { base: '.' })
.pipe(rename(function nestFileInDir(path) {
path.dirname = join(buildId, path.dirname);
}))
.pipe(zip(`${buildId}.zip`))
.pipe(vfs.dest(join('.', 'build')));
});