1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-02 18:17:46 +01:00

update to gulp 4.0.0

This commit is contained in:
Kyle Spearrin 2018-11-27 12:36:59 -05:00
parent c903ad7e66
commit 3b06fe68d9
3 changed files with 1409 additions and 331 deletions

View File

@ -60,18 +60,16 @@ function dist(browserName, manifest) {
.pipe(gulp.dest(paths.dist)); .pipe(gulp.dest(paths.dist));
} }
gulp.task('dist', ['dist:firefox', 'dist:chrome', 'dist:opera', 'dist:edge', 'dist:safari']); function distFirefox() {
gulp.task('dist:firefox', (cb) => {
return dist('firefox', (manifest) => { return dist('firefox', (manifest) => {
delete manifest['-ms-preload']; delete manifest['-ms-preload'];
delete manifest.content_security_policy; delete manifest.content_security_policy;
removeShortcuts(manifest); removeShortcuts(manifest);
return manifest; return manifest;
}); });
}); }
gulp.task('dist:opera', (cb) => { function distOpera() {
return dist('opera', (manifest) => { return dist('opera', (manifest) => {
delete manifest['-ms-preload']; delete manifest['-ms-preload'];
delete manifest.applications; delete manifest.applications;
@ -79,9 +77,9 @@ gulp.task('dist:opera', (cb) => {
removeShortcuts(manifest); removeShortcuts(manifest);
return manifest; return manifest;
}); });
}); }
gulp.task('dist:chrome', (cb) => { function distChrome() {
return dist('chrome', (manifest) => { return dist('chrome', (manifest) => {
delete manifest['-ms-preload']; delete manifest['-ms-preload'];
delete manifest.applications; delete manifest.applications;
@ -90,7 +88,7 @@ gulp.task('dist:chrome', (cb) => {
delete manifest.commands._execute_sidebar_action; delete manifest.commands._execute_sidebar_action;
return manifest; return manifest;
}); });
}); }
function removeShortcuts(manifest) { function removeShortcuts(manifest) {
if (manifest.content_scripts && manifest.content_scripts.length > 1) { if (manifest.content_scripts && manifest.content_scripts.length > 1) {
@ -102,7 +100,7 @@ function removeShortcuts(manifest) {
} }
// Since Edge extensions require makeappx to be run we temporarily store it in a folder. // Since Edge extensions require makeappx to be run we temporarily store it in a folder.
gulp.task('dist:edge', (cb) => { function distEdge(cb) {
const edgePath = paths.dist + 'Edge/'; const edgePath = paths.dist + 'Edge/';
const extensionPath = edgePath + 'Extension/'; const extensionPath = edgePath + 'Extension/';
const fileName = distFileName('edge', 'appx'); const fileName = distFileName('edge', 'appx');
@ -118,7 +116,7 @@ gulp.task('dist:edge', (cb) => {
}, () => { }, () => {
return cb; return cb;
}); });
}); }
function edgeCopyBuild(source, dest) { function edgeCopyBuild(source, dest) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -156,7 +154,7 @@ function edgeCopyAssets(source, dest) {
}); });
} }
gulp.task('dist:safari', (cb) => { function distSafari(cb) {
const buildPath = paths.dist + 'Safari/'; const buildPath = paths.dist + 'Safari/';
const extBuildPath = buildPath + 'bitwarden.safariextension/'; const extBuildPath = buildPath + 'bitwarden.safariextension/';
const extAssetsBuildPath = extBuildPath + 'safari/'; const extAssetsBuildPath = extBuildPath + 'safari/';
@ -171,7 +169,7 @@ gulp.task('dist:safari', (cb) => {
}, () => { }, () => {
return cb; return cb;
}); });
}); }
function safariCopyBuild(source, dest) { function safariCopyBuild(source, dest) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -194,25 +192,21 @@ function safariZip(buildPath) {
}); });
} }
gulp.task('build', ['webfonts']); function webfonts() {
gulp.task('webfonts', () => {
return gulp.src('./webfonts.list') return gulp.src('./webfonts.list')
.pipe(googleWebFonts({ .pipe(googleWebFonts({
fontsDir: 'webfonts', fontsDir: 'webfonts',
cssFilename: 'webfonts.css' cssFilename: 'webfonts.css'
})) }))
.pipe(gulp.dest(paths.cssDir)); .pipe(gulp.dest(paths.cssDir));
}); }
gulp.task('ci', ['ci:coverage']); function ciCoverage(cb) {
gulp.task('ci:coverage', (cb) => {
return gulp.src(paths.coverage + '**/*') return gulp.src(paths.coverage + '**/*')
.pipe(filter(['**', '!coverage/coverage*.zip'])) .pipe(filter(['**', '!coverage/coverage*.zip']))
.pipe(zip(`coverage${buildString()}.zip`)) .pipe(zip(`coverage${buildString()}.zip`))
.pipe(gulp.dest(paths.coverage)); .pipe(gulp.dest(paths.coverage));
}); }
function copy(source, dest) { function copy(source, dest) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -222,3 +216,14 @@ function copy(source, dest) {
.on('end', resolve); .on('end', resolve);
}); });
} }
exports['dist:firefox'] = distFirefox;
exports['dist:chrome'] = distChrome;
exports['dist:opera'] = distOpera;
exports['dist:edge'] = distEdge;
exports['dist:safari'] = distSafari;
exports.dist = gulp.parallel(distFirefox, distChrome, distOpera, distEdge, distSafari);
exports['ci:coverage'] = ciCoverage;
exports.ci = ciCoverage;
exports.webfonts = webfonts;
exports.build = webfonts;

1693
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
"del": "^3.0.0", "del": "^3.0.0",
"extract-text-webpack-plugin": "next", "extract-text-webpack-plugin": "next",
"file-loader": "^2.0.0", "file-loader": "^2.0.0",
"gulp": "^3.9.1", "gulp": "^4.0.0",
"gulp-filter": "^5.1.0", "gulp-filter": "^5.1.0",
"gulp-google-webfonts": "^2.0.0", "gulp-google-webfonts": "^2.0.0",
"gulp-if": "^2.0.2", "gulp-if": "^2.0.2",