Use electron-builder for all artifacts
This commit is contained in:
parent
851b51f11c
commit
133af47343
74
gulpfile.js
74
gulpfile.js
|
@ -11,7 +11,7 @@ var through = require('through2');
|
|||
var electron = require('electron-connect').server.create({
|
||||
path: './dist'
|
||||
});
|
||||
var packager = require('electron-packager');
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const distPackageAuthor = 'Mattermost, Inc.';
|
||||
|
@ -195,78 +195,6 @@ gulp.task('watch', ['build'], function() {
|
|||
gulp.watch(['dist/browser/*.js'], electron.reload);
|
||||
});
|
||||
|
||||
function makePackage(platform, arch, callback) {
|
||||
var packageJson = require('./src/package.json');
|
||||
packager({
|
||||
dir: './dist',
|
||||
platform: platform,
|
||||
arch: arch,
|
||||
version: require('./package.json').devDependencies['electron-prebuilt'],
|
||||
out: './release',
|
||||
prune: true,
|
||||
overwrite: true,
|
||||
"app-version": packageJson.version,
|
||||
icon: 'resources/icon',
|
||||
"version-string": {
|
||||
CompanyName: distPackageAuthor,
|
||||
LegalCopyright: `Copyright (c) 2015 - ${new Date().getFullYear()} ${packageJson.author.name}`,
|
||||
FileDescription: packageJson.productName,
|
||||
OriginalFilename: packageJson.productName + '.exe',
|
||||
ProductVersion: packageJson.version,
|
||||
ProductName: packageJson.productName,
|
||||
InternalName: packageJson.name
|
||||
}
|
||||
}, function(err, appPath) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
}
|
||||
else {
|
||||
if (platform === 'linux' || platform === 'all') {
|
||||
const dest_32 = 'release/Mattermost-linux-ia32';
|
||||
const dest_64 = 'release/Mattermost-linux-x64';
|
||||
fs.createReadStream('resources/icon.png').pipe(fs.createWriteStream(`${dest_32}/icon.png`));
|
||||
fs.createReadStream('resources/icon.png').pipe(fs.createWriteStream(`${dest_64}/icon.png`));
|
||||
fs.createReadStream('resources/linux/create_desktop_file.sh')
|
||||
.pipe(fs.createWriteStream(`${dest_32}/create_desktop_file.sh`))
|
||||
.on('finish', () => {
|
||||
fs.chmodSync(`${dest_32}/create_desktop_file.sh`, '755');
|
||||
});
|
||||
fs.createReadStream('resources/linux/create_desktop_file.sh')
|
||||
.pipe(fs.createWriteStream(`${dest_64}/create_desktop_file.sh`))
|
||||
.on('finish', () => {
|
||||
fs.chmodSync(`${dest_64}/create_desktop_file.sh`, '755');
|
||||
});
|
||||
setTimeout(() => {
|
||||
callback();
|
||||
}, 1000); // should wait all pipes
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
gulp.task('package', ['build'], function(cb) {
|
||||
makePackage(process.platform, 'all', cb);
|
||||
});
|
||||
|
||||
gulp.task('package:all', ['build'], function(cb) {
|
||||
makePackage('all', 'all', cb);
|
||||
});
|
||||
|
||||
gulp.task('package:windows', ['build'], function(cb) {
|
||||
makePackage('win32', 'all', cb);
|
||||
});
|
||||
|
||||
gulp.task('package:osx', ['build'], function(cb) {
|
||||
makePackage('darwin', 'all', cb);
|
||||
});
|
||||
|
||||
gulp.task('package:linux', ['build'], function(cb) {
|
||||
makePackage('linux', 'all', cb);
|
||||
});
|
||||
|
||||
gulp.task('sync-meta', function() {
|
||||
var appPackageJson = require('./src/package.json');
|
||||
var packageJson = require('./package.json');
|
||||
|
|
41
package.json
41
package.json
|
@ -2,7 +2,7 @@
|
|||
"name": "mattermost",
|
||||
"productName": "Mattermost",
|
||||
"version": "3.4.1",
|
||||
"description": "Mattermost Desktop application for Windows, Mac and Linux",
|
||||
"description": "Mattermost",
|
||||
"main": "main.js",
|
||||
"author": {
|
||||
"name": "Yuya Ochiai",
|
||||
|
@ -24,12 +24,11 @@
|
|||
"watch": "gulp watch",
|
||||
"serve": "gulp watch",
|
||||
"test": "gulp build && mocha --reporter mocha-circleci-reporter --recursive test/specs && gulp prettify:verify",
|
||||
"package": "gulp package",
|
||||
"package:windows": "gulp package:windows",
|
||||
"package:osx": "gulp package:osx",
|
||||
"package:linux": "gulp build && build --platform linux --arch all && npm run linux-additions",
|
||||
"linux-additions": "mkdir -p release/linux/ && cp resources/icon.png resources/linux/create_desktop_file.sh release/linux/ && mkdir -p release/linux-ia32/ && cp resources/icon.png resources/linux/create_desktop_file.sh release/linux-ia32/",
|
||||
"package:all": "gulp package:all",
|
||||
"package:all": "build -wml --x64 --ia32",
|
||||
"package:windows": "build --win --x64 --ia32",
|
||||
"package:osx": "build --mac --x64 --ia32",
|
||||
"package:linux": "build --linux --x64 --ia32",
|
||||
"linux-additions": "cp resources/icon.png resources/linux/create_desktop_file.sh release/linux/ && cp resources/icon.png resources/linux/create_desktop_file.sh release/linux-ia32/",
|
||||
"prettify": "gulp prettify",
|
||||
"installer": "node ./script/installer.js"
|
||||
},
|
||||
|
@ -40,11 +39,9 @@
|
|||
"chai": "^3.5.0",
|
||||
"chai-as-promised": "^5.3.0",
|
||||
"devtron": "^1.3.0",
|
||||
"electron-builder": "7.10.2",
|
||||
"electron-builder": "^7.3.0",
|
||||
"electron-connect": "~0.6.0",
|
||||
"electron-packager": "^7.0.1",
|
||||
"electron-prebuilt": "1.4.2",
|
||||
"electron-winstaller": "^2.2.0",
|
||||
"esformatter": "^0.9.6",
|
||||
"esformatter-jsx": "^7.0.1",
|
||||
"gulp": "^3.9.1",
|
||||
|
@ -63,11 +60,27 @@
|
|||
"webpack-stream": "^3.2.0"
|
||||
},
|
||||
"build": {
|
||||
"app-bundle-id": "com.mattermost.desktop",
|
||||
"app-category-type": "public.app-category.productivity",
|
||||
"appId": "com.mattermost.desktop",
|
||||
"linux": {
|
||||
"synopsis": "Mattermost Desktop",
|
||||
"target": "deb"
|
||||
"category": "InstantMessaging",
|
||||
"target": ["deb", "tar.gz"],
|
||||
"synopsis": "Mattermost",
|
||||
"extraFiles": [{
|
||||
"from": "resources",
|
||||
"filter": "icon.png"
|
||||
}, {
|
||||
"from": "resources/linux",
|
||||
"filter": "create_desktop_file.sh"
|
||||
}]
|
||||
},
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity",
|
||||
"target": ["tar.gz"]
|
||||
},
|
||||
"win": {
|
||||
"description": "Mattermost",
|
||||
"target": ["squirrel", "zip"],
|
||||
"iconUrl": "https://raw.githubusercontent.com/mattermost/desktop/master/resources/icon.ico"
|
||||
}
|
||||
},
|
||||
"directories": {
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller;
|
||||
const path = require('path');
|
||||
const rimraf = require('rimraf');
|
||||
|
||||
const archList = ['ia32', 'x64'];
|
||||
archList.forEach((arch) => {
|
||||
deleteOutputFolder(arch)
|
||||
.then(getInstallerConfig)
|
||||
.then(createWindowsInstaller)
|
||||
.catch((error) => {
|
||||
console.error(error.message || error);
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
|
||||
function getInstallerConfig(arch) {
|
||||
const rootPath = path.join(__dirname, '..');
|
||||
const outPath = path.join(rootPath, 'release');
|
||||
|
||||
return Promise.resolve({
|
||||
appDirectory: path.join(outPath, `Mattermost-win32-${arch}`),
|
||||
authors: 'Mattermost, Inc.',
|
||||
owners: 'Mattermost, Inc.',
|
||||
iconUrl: 'https://raw.githubusercontent.com/mattermost/desktop/master/resources/icon.ico',
|
||||
//loadingGif: path.join(rootPath, 'assets', 'img', 'loading.gif'),
|
||||
noMsi: true,
|
||||
outputDirectory: path.join(outPath, `windows-installer-${arch}`),
|
||||
setupExe: `mattermost-setup-${arch}.exe`,
|
||||
setupIcon: path.join(rootPath, 'resources', 'icon.ico'),
|
||||
skipUpdateIcon: true,
|
||||
exe: 'Mattermost.exe'
|
||||
});
|
||||
}
|
||||
|
||||
function deleteOutputFolder(arch) {
|
||||
return new Promise((resolve, reject) => {
|
||||
rimraf(path.join(__dirname, '..', 'out', `windows-installer-${arch}`), (error) => {
|
||||
error ? reject(error) : resolve(arch);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -3,12 +3,13 @@
|
|||
"productName": "Mattermost",
|
||||
"desktopName": "Mattermost.desktop",
|
||||
"version": "3.4.1",
|
||||
"description": "Mattermost Desktop application for Windows, Mac and Linux",
|
||||
"description": "Mattermost",
|
||||
"main": "main.js",
|
||||
"author": {
|
||||
"name": "Yuya Ochiai",
|
||||
"email": "yuya0321@gmail.com"
|
||||
},
|
||||
"homepage": "https://about.mattermost.com",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"electron-connect": "~0.6.0"
|
||||
|
|
Loading…
Reference in a new issue