1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

safari build task

This commit is contained in:
Kyle Spearrin 2018-01-11 17:33:13 -05:00
parent a5375b35ae
commit cd2713ff2a
3 changed files with 42 additions and 7 deletions

1
.gitignore vendored
View File

@ -9,5 +9,6 @@ webfonts/
*.pem
*.zip
build/
build.safariextension/
package-lock.json
coverage/

View File

@ -20,11 +20,22 @@ const paths = {
cssDir: './src/popup/css/'
};
const fontsFilter = [
'!build/popup/fonts/*',
'build/popup/fonts/Open_Sans*.woff',
'build/popup/fonts/fontawesome*.woff'
];
const filters = {
fonts: [
'!build/popup/fonts/*',
'build/popup/fonts/Open_Sans*.woff',
'build/popup/fonts/fontawesome*.woff'
],
safari: [
'!build/Info.plist'
],
notSafari: [
'!build/manifest.json'
],
notEdge: [
'!build/edge/**/*'
]
};
function buildString() {
var build = '';
@ -40,7 +51,7 @@ function distFileName(browserName, ext) {
function dist(browserName, manifest) {
return gulp.src(paths.build + '**/*')
.pipe(filter(['**', '!build/edge/**/*'].concat(fontsFilter)))
.pipe(filter(['**'].concat(filters.notEdge).concat(filters.fonts).concat(filters.safari)))
.pipe(gulpif('popup/index.html', replace('__BROWSER__', browserName)))
.pipe(gulpif('manifest.json', jeditor(manifest)))
.pipe(zip(distFileName(browserName, 'zip')))
@ -97,7 +108,7 @@ function edgeCopyBuild(source, dest) {
return new Promise((resolve, reject) => {
gulp.src(source)
.on('error', reject)
.pipe(filter(['**'].concat(fontsFilter)))
.pipe(filter(['**'].concat(filters.fonts).concat(filters.safari)))
.pipe(gulpif('popup/index.html', replace('__BROWSER__', 'edge')))
.pipe(gulpif('manifest.json', jeditor((manifest) => {
delete manifest.applications;
@ -148,6 +159,28 @@ gulp.task('ci:coverage', (cb) => {
.pipe(gulp.dest(paths.coverage));
});
gulp.task('safari:build', (cb) => {
const buildPath = './build.safariextension/';
return del([buildPath + '**/*'])
.then(() => safariMoveBuild(paths.build + '**/*', buildPath))
.then(() => {
return cb;
}, () => {
return cb;
});
});
function safariMoveBuild(source, dest) {
return new Promise((resolve, reject) => {
gulp.src(source)
.on('error', reject)
.pipe(filter(['**'].concat(filters.notEdge).concat(filters.fonts).concat(filters.notSafari)))
.pipe(gulp.dest(dest))
.on('end', resolve);
});
}
// LEGACY CODE!
gulp.task('lint', () => {

View File

@ -96,6 +96,7 @@ module.exports = {
}),
new CopyWebpackPlugin([
'./src/manifest.json',
'./src/Info.plist',
{ from: './src/_locales', to: '_locales' },
{ from: './src/edge', to: 'edge' },
{ from: './src/images', to: 'images' },