mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-12 01:48:21 +02:00
pkg mas gulp task
This commit is contained in:
parent
fc2761cfca
commit
5268b1be0b
59
gulpfile.js
59
gulpfile.js
@ -2,10 +2,13 @@ const gulp = require('gulp');
|
||||
const googleWebFonts = require('gulp-google-webfonts');
|
||||
const del = require('del');
|
||||
const fs = require('fs');
|
||||
const child = require('child_process');
|
||||
|
||||
const paths = {
|
||||
cssDir: './src/css/',
|
||||
node_modules: './node_modules/',
|
||||
dist: './dist/',
|
||||
resources: './resources/',
|
||||
};
|
||||
|
||||
function clean() {
|
||||
@ -34,9 +37,65 @@ function fixSweetAlert(cb) {
|
||||
cb();
|
||||
}
|
||||
|
||||
function pkgMas(cb) {
|
||||
const appPath = paths.dist + 'mas/Bitwarden.app';
|
||||
const pkgPath = paths.dist + 'mas/Bitwarden-mas.pkg';
|
||||
const safariAppexPath = appPath + '/Contents/PlugIns/safari.appex';
|
||||
const safariAppexFrameworkPath = safariAppexPath + '/Contents/Frameworks/';
|
||||
const safariEntitlementsPath = paths.resources + 'safari.entitlements';
|
||||
|
||||
return del([paths.dist + 'Bitwarden*.pkg'])
|
||||
.then(() => {
|
||||
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
|
||||
.map((p) => builtAppexFrameworkPath + p);
|
||||
const allItems = libs.concat([safariAppexPath]);
|
||||
const promises = [];
|
||||
allItems.forEach((i) => {
|
||||
const proc = child.spawn('codesign', [
|
||||
'--verbose',
|
||||
'--force',
|
||||
'-o',
|
||||
'runtime',
|
||||
'--sign',
|
||||
'3rd Party Mac Developer Application: 8bit Solutions LLC',
|
||||
'--entitlements',
|
||||
safariEntitlementsPath,
|
||||
i]);
|
||||
stdOutProc(proc);
|
||||
promises.push(new Promise((resolve) => proc.on('close', resolve)));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
}).then(() => {
|
||||
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
|
||||
.map((p) => builtAppexFrameworkPath + p);
|
||||
const allItems = libs.concat([safariAppexPath]);
|
||||
const promises = [];
|
||||
allItems.forEach((i) => {
|
||||
const proc = child.spawn('productbuild', [
|
||||
'--component',
|
||||
appPath,
|
||||
'/Applications',
|
||||
pkgPath]);
|
||||
stdOutProc(proc);
|
||||
promises.push(new Promise((resolve) => proc.on('close', resolve)));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
}).then(() => {
|
||||
return cb;
|
||||
}, () => {
|
||||
return cb;
|
||||
});
|
||||
}
|
||||
|
||||
function stdOutProc(proc) {
|
||||
proc.stdout.on('data', (data) => console.log(data.toString()));
|
||||
proc.stderr.on('data', (data) => console.error(data.toString()));
|
||||
}
|
||||
|
||||
exports.clean = clean;
|
||||
exports.cleanupAotIssue = cleanupAotIssue;
|
||||
exports.webfonts = gulp.series(clean, webfonts);
|
||||
exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue);
|
||||
exports.fixSweetAlert = fixSweetAlert;
|
||||
exports.pkgMas = pkgMas;
|
||||
exports.postinstall = fixSweetAlert;
|
||||
|
Loading…
Reference in New Issue
Block a user