-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
66 lines (60 loc) · 2.31 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const gulp = require('gulp');
const gutil = require("gulp-util");
const zip = require('gulp-zip');
const config = require("./gulpconfig.json");
const webpack = require("webpack");
var replace = require('gulp-replace');
/****//****//****//****/
// Google Extension
/****//****//****//****/
gulp.task("copy-images", function () {
return gulp.src(config.paths.chromeExt.images.src)
.pipe(gulp.dest(config.paths.chromeExt.images.dist));
});
gulp.task("copy-data", function () {
let cdnUrl = process.env.NODE_ENV.trim().toLocaleLowerCase() === 'production' ?
config.paths.chromeExt.data.productionCdn :
config.paths.chromeExt.data.developmentCdn;
return gulp.src(config.paths.chromeExt.data.src)
.pipe(replace('__%__CDN_URL__%__', cdnUrl))
.pipe(gulp.dest(config.paths.chromeExt.data.dist));
});
gulp.task("copy-rootFolderFiles", function () {
return gulp.src(config.paths.chromeExt.rootFolderFiles)
.pipe(gulp.dest(config.paths.chromeExt.rootDistFoldder));
});
gulp.task("build-chromeExt", function (callback) {
var prodConfig = require('./webpack/webpack.config.chromeExtension.prod.js');
webpack(prodConfig, function (err, stats) {
if (err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
colors: true,
chunks: false
}));
callback();
});
});
gulp.task("generate-chrome-dev", ["copy-images", 'copy-data', "copy-rootFolderFiles", 'build-chromeExt'], function () {
});
gulp.task("generate-chrome-package", ["generate-chrome-dev"], function () {
return gulp.src(config.paths.chromeExt.package.packageFiles)
.pipe(zip(config.paths.chromeExt.package.name))
.pipe(gulp.dest(config.paths.chromeExt.package.distFolder));
});
/****//****//****//****/
// SharePoint Actions
/****//****//****//****/
gulp.task("build-actions", function (callback) {
var prodConfig = require('./webpack/webpack.config.actions.prod.js');
webpack(prodConfig, function (err, stats) {
if (err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
colors: true,
chunks: false
}));
callback();
});
});
gulp.task("default", function () { });