Skip to content

Commit

Permalink
[CHORE] Build configuration update (RocketChat#1204)
Browse files Browse the repository at this point in the history
* Fix file indentation

* Amend tasks to ESLint rules

* Remove node_modules from electron-builder configuration

* Remove 32-bit builds for Linux
  • Loading branch information
tassoevan authored Apr 30, 2019
1 parent bc6fab5 commit 7155b40
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 113 deletions.
189 changes: 94 additions & 95 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -1,102 +1,101 @@
{
"files": [
"app/**/*",
"node_modules/**/*",
"package.json"
],
"extraResources": [
"dictionaries/**/*",
"build/icon.ico",
"servers.json"
],
"appId": "chat.rocket",
"mac": {
"category": "public.app-category.productivity",
"target": [
"dmg",
"pkg",
"zip",
"mas"
],
"icon": "build/icon.icns",
"bundleVersion": "50",
"helperBundleId": "chat.rocket.electron.helper",
"type": "distribution",
"files": [
"app/**/*",
"package.json"
],
"extraResources": [
"dictionaries/**/*",
"build/icon.ico",
"servers.json"
],
"appId": "chat.rocket",
"mac": {
"category": "public.app-category.productivity",
"target": [
"dmg",
"pkg",
"zip",
"mas"
],
"icon": "build/icon.icns",
"bundleVersion": "50",
"helperBundleId": "chat.rocket.electron.helper",
"type": "distribution",
"artifactName": "rocketchat-${version}.${ext}",
"extendInfo": {
"NSMicrophoneUsageDescription": "I need access to your microphone to record the audio you want to send.",
"NSCameraUsageDescription": "I need access to your camera to record the video you want to send."
}
},
"dmg": {
"background": "build/background.png",
"contents": [
{
"type": "dir",
"x": 100,
"y": 211
},
{
"type": "link",
"path": "/Applications",
"x": 500,
"y": 211
}
]
},
"pkg": {
"isRelocatable": false,
"overwriteAction": "upgrade"
},
"mas": {
"entitlements": "build/entitlements.mas.plist",
"entitlementsInherit": "build/entitlements.mas.inherit.plist",
"artifactName": "rocketchat-${version}-mas.${ext}"
},
"win": {
"target": [
"nsis"
],
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"artifactName": "rocketchat-setup-${version}.${ext}"
},
"appx": {
"backgroundColor": "#2f343d",
"displayName": "Rocket.Chat",
"publisherDisplayName": "Rocket.Chat",
"languages": [
"en-US",
"en-GB",
"pt-BR"
],
"artifactName": "rocketchat-${version}-${arch}.${ext}"
},
"linux": {
"target": [
"tar.gz",
"deb",
"rpm",
"snap"
],
"executableName": "rocketchat-desktop",
"category": "GNOME;GTK;Network;InstantMessaging",
"desktop": {
"StartupWMClass": "Rocket.Chat",
"MimeType": "x-scheme-handler/rocketchat"
}
},
"publish": [
{
"provider": "github",
"owner": "RocketChat",
"repo": "Rocket.Chat.Electron",
"vPrefixedTagName": false
}
]
},
"dmg": {
"background": "build/background.png",
"contents": [
{
"type": "dir",
"x": 100,
"y": 211
},
{
"type": "link",
"path": "/Applications",
"x": 500,
"y": 211
}
]
},
"pkg": {
"isRelocatable": false,
"overwriteAction": "upgrade"
},
"mas": {
"entitlements": "build/entitlements.mas.plist",
"entitlementsInherit": "build/entitlements.mas.inherit.plist",
"artifactName": "rocketchat-${version}-mas.${ext}"
},
"win": {
"target": [
"nsis"
],
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"perMachine": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"artifactName": "rocketchat-setup-${version}.${ext}"
},
"appx": {
"backgroundColor": "#2f343d",
"displayName": "Rocket.Chat",
"publisherDisplayName": "Rocket.Chat",
"languages": [
"en-US",
"en-GB",
"pt-BR"
],
"artifactName": "rocketchat-${version}-${arch}.${ext}"
},
"linux": {
"target": [
"tar.gz",
"deb",
"rpm",
"snap"
],
"executableName": "rocketchat-desktop",
"category": "GNOME;GTK;Network;InstantMessaging",
"desktop": {
"StartupWMClass": "Rocket.Chat",
"MimeType": "x-scheme-handler/rocketchat"
}
},
"publish": [
{
"provider": "github",
"owner": "RocketChat",
"repo": "Rocket.Chat.Electron",
"vPrefixedTagName": false
}
]
}
4 changes: 2 additions & 2 deletions tasks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const appManifest = require('../package.json');

const cached = {};

const bundle = async(src, dest, { coverage = false, env = 'development' } = {}) => {
const bundle = async (src, dest, { coverage = false, env = 'development' } = {}) => {
const inputOptions = {
input: src,
external: [
Expand Down Expand Up @@ -51,7 +51,7 @@ const bundle = async(src, dest, { coverage = false, env = 'development' } = {})
await bundle.write(outputOptions);
};

const bundleMany = async(srcDirPath, matching, dest, options) => {
const bundleMany = async (srcDirPath, matching, dest, options) => {
const srcDir = jetpack.cwd(srcDirPath);
const src = srcDir.path(path.basename(dest));

Expand Down
2 changes: 1 addition & 1 deletion tasks/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const bundle = require('./bundle');
const getEnv = require('./env');


gulp.task('coverage:build', async() => {
gulp.task('coverage:build', async () => {
const env = getEnv();
const coverage = true;
await bundle.many('src', 'main/*.spec.js', 'app/main.specs.js', { coverage, env });
Expand Down
2 changes: 1 addition & 1 deletion tasks/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const bundle = require('./bundle');
const getEnv = require('./env');


gulp.task('e2e:build', async() => {
gulp.task('e2e:build', async () => {
const env = getEnv();
await bundle.many('src', '*.e2e.js', 'app/e2e.js', { env });
});
Expand Down
2 changes: 1 addition & 1 deletion tasks/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const minimist = require('minimist');

let { env } = minimist(process.argv, { default: { env: 'development' } });

const setEnv = (newEnv) => async() => (env = newEnv);
const setEnv = (newEnv) => async () => (env = newEnv);
gulp.task('env:development', setEnv('development'));
gulp.task('env:test', setEnv('test'));
gulp.task('env:production', setEnv('production'));
Expand Down
10 changes: 5 additions & 5 deletions tasks/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const toIco = require('to-ico');
const icnsConvert = require('@fiahfy/icns-convert');


gulp.task('icons:clean', async() => {
gulp.task('icons:clean', async () => {
await jetpack.removeAsync('src/public/images/tray/darwin');
await jetpack.removeAsync('src/public/images/tray/darwin-dark');
await jetpack.removeAsync('src/public/images/tray/linux');
await jetpack.removeAsync('src/public/images/tray/win32');
});

const createDarwinTrayIcon = ({ src, dest, dark = false }) => async() => {
const createDarwinTrayIcon = ({ src, dest, dark = false }) => async () => {
const svg = (await jetpack.readAsync(`src/icons/${ dark ? 'white' : 'black' }/${ src }.svg`))
.replace('viewBox="0 0 64 64"', 'viewBox="0 0 64 64" transform="scale(0.8)"');

Expand All @@ -31,7 +31,7 @@ gulp.task('icons:darwin-dark:default', createDarwinTrayIcon({ src: 'default', de
gulp.task('icons:darwin-dark:notification', createDarwinTrayIcon({ src: 'notification-dot', dest: 'notification', dark: true }));
gulp.task('icons:darwin-dark', gulp.series('icons:darwin-dark:default', 'icons:darwin-dark:notification'));

const createLinuxTrayIcon = ({ src, dest }) => async() => {
const createLinuxTrayIcon = ({ src, dest }) => async () => {
const svg = await jetpack.readAsync(`src/icons/grey/${ src }.svg`);

const png24 = await convert(svg, { width: 64, height: 64 });
Expand Down Expand Up @@ -68,7 +68,7 @@ gulp.task('icons:linux', gulp.series(
'icons:linux:notification-plus-9',
));

const createWindowsTrayIcon = ({ src, dest }) => async() => {
const createWindowsTrayIcon = ({ src, dest }) => async () => {
const smallSrc = src.startsWith('notification-') ? 'notification-dot' : src;
const smallSvg = await jetpack.readAsync(`src/icons/grey/${ smallSrc }.svg`);
const svg = await jetpack.readAsync(`src/icons/grey/${ src }.svg`);
Expand Down Expand Up @@ -112,7 +112,7 @@ gulp.task('icons:win32', gulp.series(
'icons:win32:notification-plus-9',
));

gulp.task('icons:app', async() => {
gulp.task('icons:app', async () => {
const svg = await jetpack.readAsync('src/icons/icon.svg');

const png16 = await convert(svg, { width: 16, height: 16 });
Expand Down
11 changes: 4 additions & 7 deletions tasks/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ const getEnv = require('./env');
const x64 = true;
const ia32 = true;

gulp.task('release:darwin', async() => {
gulp.task('release:darwin', async () => {
const publish = getEnv() === 'production' ? 'onTagOrDraft' : 'never';
await build({ publish, x64, mac: [] });
});

gulp.task('release:linux', async() => {
const { linux: { target } } = require('../electron-builder.json');
gulp.task('release:linux', async () => {
const publish = getEnv() === 'production' ? 'onTagOrDraft' : 'never';
const targets = target.filter((target) => target !== 'snap');
await build({ publish, x64, ia32, linux: targets, c: { productName: 'rocketchat' } });
await build({ publish, x64, linux: ['snap'], c: { productName: 'rocketchat' } });
await build({ publish, x64, linux: [], c: { productName: 'rocketchat' } });
});

gulp.task('release:win32', async() => {
gulp.task('release:win32', async () => {
const publish = getEnv() === 'production' ? 'onTagOrDraft' : 'never';
await build({ publish, x64, ia32, win: [] });
});
Expand Down
2 changes: 1 addition & 1 deletion tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const bundle = require('./bundle');
const getEnv = require('./env');


gulp.task('test:build', async() => {
gulp.task('test:build', async () => {
const env = getEnv();
await bundle.many('src', 'main/*.spec.js', 'app/main.specs.js', { env });
await bundle.many('src', ['*.spec.js', '!main/*.spec.js'], 'app/renderer.specs.js', { env });
Expand Down

0 comments on commit 7155b40

Please sign in to comment.