mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-17 20:31:50 +01:00
gulp tweaks
This commit is contained in:
parent
96bb409ee7
commit
888a85e0bc
44
gulpfile.js
44
gulpfile.js
@ -8,7 +8,8 @@ const gulp = require('gulp'),
|
|||||||
child = require('child_process'),
|
child = require('child_process'),
|
||||||
zip = require('gulp-zip'),
|
zip = require('gulp-zip'),
|
||||||
manifest = require('./src/manifest.json'),
|
manifest = require('./src/manifest.json'),
|
||||||
xmlpoke = require('gulp-xmlpoke');
|
xmlpoke = require('gulp-xmlpoke'),
|
||||||
|
del = require('del');
|
||||||
|
|
||||||
const paths = {
|
const paths = {
|
||||||
releases: './releases/',
|
releases: './releases/',
|
||||||
@ -19,15 +20,15 @@ const paths = {
|
|||||||
cssDir: './src/popup/css/'
|
cssDir: './src/popup/css/'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fontsFilter = [
|
||||||
|
'!dist/popup/fonts/*',
|
||||||
|
'dist/popup/fonts/Open_Sans*.woff',
|
||||||
|
'dist/popup/fonts/fontawesome*.woff'
|
||||||
|
];
|
||||||
|
|
||||||
function dist(browserName, manifest) {
|
function dist(browserName, manifest) {
|
||||||
return gulp.src(paths.dist + '**/*')
|
return gulp.src(paths.dist + '**/*')
|
||||||
.pipe(gulpif(browserName !== 'edge', filter([
|
.pipe(filter(['**', '!dist/edge/**/*'].concat(fontsFilter)))
|
||||||
'**',
|
|
||||||
'!dist/edge/**/*',
|
|
||||||
'!dist/popup/fonts/*',
|
|
||||||
'dist/popup/fonts/Open_Sans*.woff',
|
|
||||||
'dist/popup/fonts/fontawesome*.woff'
|
|
||||||
])))
|
|
||||||
.pipe(gulpif('popup/index.html', replace('__BROWSER__', browserName)))
|
.pipe(gulpif('popup/index.html', replace('__BROWSER__', browserName)))
|
||||||
.pipe(gulpif('manifest.json', jeditor(manifest)))
|
.pipe(gulpif('manifest.json', jeditor(manifest)))
|
||||||
.pipe(zip(`dist-${browserName}.zip`))
|
.pipe(zip(`dist-${browserName}.zip`))
|
||||||
@ -64,28 +65,25 @@ gulp.task('dist:chrome', (cb) => {
|
|||||||
gulp.task('dist:edge', (cb) => {
|
gulp.task('dist:edge', (cb) => {
|
||||||
const edgePath = paths.releases + 'Edge/';
|
const edgePath = paths.releases + 'Edge/';
|
||||||
const extensionPath = edgePath + 'Extension/';
|
const extensionPath = edgePath + 'Extension/';
|
||||||
|
const appxPath = paths.releases + 'dist-edge.appx';
|
||||||
|
|
||||||
return copyDistEdge(paths.dist + '**/*', extensionPath)
|
return del([edgePath, appxPath])
|
||||||
.then(copyAssetsEdge('./store/windows/**/*', edgePath))
|
.then(() => edgeCopyDist(paths.dist + '**/*', extensionPath))
|
||||||
|
.then(() => edgeCopyAssets('./store/windows/**/*', edgePath))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// makeappx.exe must be in your system's path already
|
// makeappx.exe must be in your system's path already
|
||||||
child.spawn('makeappx.exe', ['pack', '/h', 'SHA256', '/d', edgePath, '/p', paths.releases + 'dist-edge.appx']);
|
child.spawn('makeappx.exe', ['pack', '/h', 'SHA256', '/d', edgePath, '/p', appxPath]);
|
||||||
return cb;
|
return cb;
|
||||||
}, () => {
|
}, () => {
|
||||||
return cb;
|
return cb;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function copyDistEdge(source, dest) {
|
function edgeCopyDist(source, dest) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
gulp.src(source)
|
gulp.src(source)
|
||||||
.on('error', reject)
|
.on('error', reject)
|
||||||
.pipe(filter([
|
.pipe(filter(['**'].concat(fontsFilter)))
|
||||||
'**',
|
|
||||||
'!dist/popup/fonts/*',
|
|
||||||
'dist/popup/fonts/Open_Sans*.woff',
|
|
||||||
'dist/popup/fonts/fontawesome*.woff'
|
|
||||||
]))
|
|
||||||
.pipe(gulpif('popup/index.html', replace('__BROWSER__', 'edge')))
|
.pipe(gulpif('popup/index.html', replace('__BROWSER__', 'edge')))
|
||||||
.pipe(gulpif('manifest.json', jeditor((manifest) => {
|
.pipe(gulpif('manifest.json', jeditor((manifest) => {
|
||||||
delete manifest.applications;
|
delete manifest.applications;
|
||||||
@ -97,7 +95,7 @@ function copyDistEdge(source, dest) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyAssetsEdge(source, dest) {
|
function edgeCopyAssets(source, dest) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
gulp.src(source)
|
gulp.src(source)
|
||||||
.on('error', reject)
|
.on('error', reject)
|
||||||
@ -137,9 +135,7 @@ gulp.task('lint', () => {
|
|||||||
//'./src/content/**/*.js',
|
//'./src/content/**/*.js',
|
||||||
'./src/overlay/**/*.js',
|
'./src/overlay/**/*.js',
|
||||||
'./src/background.js'
|
'./src/background.js'
|
||||||
])
|
]).pipe(jshint({
|
||||||
.pipe(jshint({
|
esversion: 6
|
||||||
esversion: 6
|
})).pipe(jshint.reporter('default'));
|
||||||
}))
|
|
||||||
.pipe(jshint.reporter('default'));
|
|
||||||
});
|
});
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"clipboard": "1.7.1",
|
"clipboard": "1.7.1",
|
||||||
"copy-webpack-plugin": "^4.2.0",
|
"copy-webpack-plugin": "^4.2.0",
|
||||||
"css-loader": "^0.28.7",
|
"css-loader": "^0.28.7",
|
||||||
|
"del": "3.0.0",
|
||||||
"extract-text-webpack-plugin": "^3.0.1",
|
"extract-text-webpack-plugin": "^3.0.1",
|
||||||
"file-loader": "^1.1.5",
|
"file-loader": "^1.1.5",
|
||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user