Merge branch 'master' into fix-typos
This commit is contained in:
commit
e47061fd7b
12
.babelrc
12
.babelrc
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["Electron >= 1.8"],
|
||||
"node": "8.2"
|
||||
}
|
||||
}],
|
||||
"react"
|
||||
],
|
||||
"plugins": ["transform-object-rest-spread", "transform-class-properties"]
|
||||
}
|
|
@ -13,6 +13,8 @@ Release date: TBD
|
|||
### Improvements
|
||||
|
||||
### Architectural Changes
|
||||
- Major version upgrade of Electron to v3.0.10. Electron is the underlying technology used to build the Desktop apps.
|
||||
[#892](https://github.com/mattermost/desktop/pull/892)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
19
babel.config.js
Normal file
19
babel.config.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
module.exports = (api) => { // eslint-disable-line import/no-commonjs
|
||||
api.cache.forever();
|
||||
return {
|
||||
presets: [
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: ['Electron >= 2.0'],
|
||||
node: '8.9',
|
||||
},
|
||||
}],
|
||||
'@babel/preset-react',
|
||||
],
|
||||
plugins: ['@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-class-properties'],
|
||||
};
|
||||
};
|
39
package.json
39
package.json
|
@ -26,7 +26,7 @@
|
|||
"watch:main": "node scripts/watch_main_and_preload.js",
|
||||
"watch:renderer": "webpack-dev-server --config webpack.config.renderer.js",
|
||||
"test": "npm-run-all test:* lint:*",
|
||||
"test:app": "cross-env NODE_ENV=production npm run build && mocha -r babel-register --reporter mocha-circleci-reporter --recursive test/specs",
|
||||
"test:app": "cross-env NODE_ENV=production npm run build && mocha -r @babel/register --reporter mocha-circleci-reporter --recursive test/specs",
|
||||
"package:all": "cross-env NODE_ENV=production npm-run-all check-build-config package:windows package:mac package:linux",
|
||||
"package:windows": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --win --x64 --ia32 --config.extraMetadata.name=mattermost --publish=never",
|
||||
"package:mac": "cross-env NODE_ENV=production npm-run-all check-build-config build && build --mac --publish=never",
|
||||
|
@ -34,22 +34,25 @@
|
|||
"manipulate-windows-zip": "node scripts/manipulate_windows_zip.js",
|
||||
"lint:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --ext .js --ext .jsx .",
|
||||
"fix:js": "eslint --ignore-path .gitignore --ignore-pattern node_modules --quiet --ext .js --ext .jsx . --fix",
|
||||
"check-build-config": "node -r babel-register scripts/check_build_config.js"
|
||||
"check-build-config": "node -r @babel/register scripts/check_build_config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"7zip-bin": "^4.0.2",
|
||||
"@storybook/react": "^3.4.6",
|
||||
"babel-core": "^6.26.3",
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/plugin-proposal-class-properties": "^7.1.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@storybook/addon-actions": "^4.0.9",
|
||||
"@storybook/react": "^4.0.9",
|
||||
"babel-eslint": "^8.2.3",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"babel-loader": "^8.0.4",
|
||||
"chai": "^4.1.2",
|
||||
"cross-env": "^5.1.6",
|
||||
"css-loader": "^0.28.11",
|
||||
"css-loader": "^1.0.1",
|
||||
"devtron": "^1.4.0",
|
||||
"electron": "2.0.12",
|
||||
"electron": "^3.0.10",
|
||||
"electron-builder": "20.14.7",
|
||||
"electron-builder-squirrel-windows": "~20.14.0",
|
||||
"electron-connect": "^0.6.3",
|
||||
|
@ -57,18 +60,18 @@
|
|||
"eslint-plugin-header": "^1.2.0",
|
||||
"eslint-plugin-import": "^2.12.0",
|
||||
"eslint-plugin-react": "^7.8.2",
|
||||
"file-loader": "^1.1.6",
|
||||
"file-loader": "^2.0.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-circleci-reporter": "0.0.3",
|
||||
"npm-run-all": "^4.1.3",
|
||||
"react": "^16.4.0",
|
||||
"react-dom": "^16.4.0",
|
||||
"spectron": "~3.8.0",
|
||||
"style-loader": "^0.21.0",
|
||||
"url-loader": "^1.0.1",
|
||||
"webpack": "^4.8.3",
|
||||
"webpack-cli": "^2.1.4",
|
||||
"webpack-dev-server": "^3.1.4",
|
||||
"webpack-merge": "^4.1.2"
|
||||
"spectron": "^5.0.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"url-loader": "^1.1.2",
|
||||
"webpack": "^4.26.1",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-dev-server": "^3.1.10",
|
||||
"webpack-merge": "^4.1.4"
|
||||
}
|
||||
}
|
||||
|
|
1
src/.storybook/addons.js
Normal file
1
src/.storybook/addons.js
Normal file
|
@ -0,0 +1 @@
|
|||
import '@storybook/addon-actions/register';
|
|
@ -1,7 +1,18 @@
|
|||
const path = require("path");
|
||||
|
||||
const rendererConfig = require('../../webpack.config.renderer');
|
||||
|
||||
// https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default
|
||||
module.exports = (baseConfig, env, defaultConfig) => {
|
||||
defaultConfig.resolve.modules = [path.resolve(__dirname, '../node_modules'), 'node_modules'];
|
||||
return defaultConfig;
|
||||
module.exports = (storybookBaseConfig, configType) => {
|
||||
// Avoid conflicting two instances of React due to two package.json structure
|
||||
storybookBaseConfig.resolve.modules.unshift(path.resolve(__dirname, '../node_modules'));
|
||||
|
||||
// Use same rules
|
||||
storybookBaseConfig.module.rules = rendererConfig.module.rules.concat({
|
||||
test: /\.(ttf|woff2?|eot|svg)/,
|
||||
use: {
|
||||
loader: 'file-loader'
|
||||
}
|
||||
});
|
||||
return storybookBaseConfig;
|
||||
}
|
||||
|
|
15
src/main.js
15
src/main.js
|
@ -177,13 +177,18 @@ const trayImages = (() => {
|
|||
})();
|
||||
|
||||
// If there is already an instance, activate the window in the existing instance and quit this one
|
||||
if (app.makeSingleInstance((commandLine/*, workingDirectory*/) => {
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) {
|
||||
app.exit();
|
||||
global.willAppQuit = true;
|
||||
}
|
||||
app.on('second-instance', (event, secondArgv) => {
|
||||
// Protocol handler for win32
|
||||
// argv: An array of the second instance’s (command line / deep linked) arguments
|
||||
if (process.platform === 'win32') {
|
||||
// Keep only command line / deep linked arguments
|
||||
if (Array.isArray(commandLine.slice(1)) && commandLine.slice(1).length > 0) {
|
||||
setDeeplinkingUrl(commandLine.slice(1)[0]);
|
||||
if (Array.isArray(secondArgv.slice(1)) && secondArgv.slice(1).length > 0) {
|
||||
setDeeplinkingUrl(secondArgv.slice(1)[0]);
|
||||
mainWindow.webContents.send('protocol-deeplink', deeplinkingUrl);
|
||||
}
|
||||
}
|
||||
|
@ -196,9 +201,7 @@ if (app.makeSingleInstance((commandLine/*, workingDirectory*/) => {
|
|||
mainWindow.show();
|
||||
}
|
||||
}
|
||||
})) {
|
||||
app.exit();
|
||||
}
|
||||
});
|
||||
|
||||
function shouldShowTrayIcon() {
|
||||
if (process.platform === 'win32') {
|
||||
|
|
16
test/modules/utils.js
Normal file
16
test/modules/utils.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
// Copyright (c) 2015-2016 Yuya Ochiai
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
function asyncSleep(timeout) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, timeout);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
asyncSleep,
|
||||
};
|
|
@ -75,7 +75,7 @@ describe('application', function desc() {
|
|||
url: env.mattermostURL,
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
|
||||
const url = await this.app.client.getUrl();
|
||||
url.should.match(/\/index.html$/);
|
||||
});
|
||||
|
@ -86,7 +86,6 @@ describe('application', function desc() {
|
|||
url: env.mattermostURL,
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
|
||||
const url = await this.app.client.getUrl();
|
||||
url.should.match(/\/index.html$/);
|
||||
|
|
|
@ -8,6 +8,7 @@ const http = require('http');
|
|||
const path = require('path');
|
||||
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
describe('browser/index.html', function desc() {
|
||||
this.timeout(30000);
|
||||
|
@ -35,10 +36,11 @@ describe('browser/index.html', function desc() {
|
|||
this.server = http.createServer(serverCallback).listen(serverPort, '127.0.0.1');
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = env.getSpectronApp();
|
||||
return this.app.start();
|
||||
await this.app.start();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
@ -56,15 +58,12 @@ describe('browser/index.html', function desc() {
|
|||
url: env.mattermostURL,
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
|
||||
const existing = await this.app.client.isExisting('#tabBar');
|
||||
existing.should.be.false;
|
||||
});
|
||||
|
||||
it('should set src of webview from config file', async () => {
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
|
||||
const src0 = await this.app.client.getAttribute('#mattermostView0', 'src');
|
||||
src0.should.equal(config.teams[0].url);
|
||||
|
||||
|
@ -76,8 +75,6 @@ describe('browser/index.html', function desc() {
|
|||
});
|
||||
|
||||
it('should set name of tab from config file', async () => {
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
|
||||
const tabName0 = await this.app.client.getText('#teamTabItem0');
|
||||
tabName0.should.equal(config.teams[0].name);
|
||||
|
||||
|
@ -86,7 +83,7 @@ describe('browser/index.html', function desc() {
|
|||
});
|
||||
|
||||
it('should show only the selected team', () => {
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
return this.app.client.
|
||||
waitForVisible('#mattermostView0', 2000).
|
||||
waitForVisible('#mattermostView1', 2000, true).
|
||||
click('#teamTabItem1').
|
||||
|
@ -104,7 +101,7 @@ describe('browser/index.html', function desc() {
|
|||
}],
|
||||
}));
|
||||
await this.app.restart();
|
||||
return this.app.client.waitUntilWindowLoaded().
|
||||
return this.app.client.
|
||||
waitForVisible('#mattermostView0-fail', 20000);
|
||||
});
|
||||
|
||||
|
@ -117,7 +114,7 @@ describe('browser/index.html', function desc() {
|
|||
}],
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.waitUntilWindowLoaded().pause(2000);
|
||||
await this.app.client.pause(2000);
|
||||
const windowTitle = await this.app.browserWindow.getTitle();
|
||||
windowTitle.should.equal('Mattermost Desktop testing html');
|
||||
});
|
||||
|
@ -135,7 +132,7 @@ describe('browser/index.html', function desc() {
|
|||
}],
|
||||
}));
|
||||
await this.app.restart();
|
||||
await this.app.client.waitUntilWindowLoaded().pause(500);
|
||||
await this.app.client.pause(500);
|
||||
|
||||
// Note: Indices of webview are correct.
|
||||
// Somehow they are swapped.
|
||||
|
@ -174,7 +171,7 @@ describe('browser/index.html', function desc() {
|
|||
|
||||
// Note: Indices of webview are correct.
|
||||
// Somehow they are swapped.
|
||||
await this.app.client.waitUntilWindowLoaded().pause(500);
|
||||
await this.app.client.pause(500);
|
||||
|
||||
await this.app.client.
|
||||
windowByIndex(2).
|
||||
|
@ -198,7 +195,6 @@ describe('browser/index.html', function desc() {
|
|||
|
||||
it('should open the new server prompt after clicking the add button', async () => {
|
||||
// See settings_test for specs that cover the actual prompt
|
||||
await this.app.client.waitUntilWindowLoaded();
|
||||
await this.app.client.click('#addServerButton').pause(500);
|
||||
const isModalExisting = await this.app.client.isExisting('#newServerModal');
|
||||
isModalExisting.should.be.true;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
const fs = require('fs');
|
||||
|
||||
const env = require('../../modules/environment');
|
||||
const {asyncSleep} = require('../../modules/utils');
|
||||
|
||||
describe('browser/settings.html', function desc() {
|
||||
this.timeout(30000);
|
||||
|
@ -21,10 +22,11 @@ describe('browser/settings.html', function desc() {
|
|||
}],
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
fs.writeFileSync(env.configFilePath, JSON.stringify(config));
|
||||
await asyncSleep(1000);
|
||||
this.app = env.getSpectronApp();
|
||||
return this.app.start();
|
||||
await this.app.start();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
@ -34,7 +36,7 @@ describe('browser/settings.html', function desc() {
|
|||
});
|
||||
|
||||
describe('Close button', async () => {
|
||||
it('should show index.html when it\'s clicked', async () => {
|
||||
it.skip('should show index.html when it\'s clicked', async () => {
|
||||
env.addClientCommands(this.app.client);
|
||||
await this.app.client.
|
||||
loadSettingsPage().
|
||||
|
@ -89,7 +91,7 @@ describe('browser/settings.html', function desc() {
|
|||
});
|
||||
|
||||
describe('Server list', () => {
|
||||
it('should open the corresponding tab when a server list item is clicked', async () => {
|
||||
it.skip('should open the corresponding tab when a server list item is clicked', async () => {
|
||||
env.addClientCommands(this.app.client);
|
||||
await this.app.client.
|
||||
loadSettingsPage().
|
||||
|
@ -339,13 +341,9 @@ describe('browser/settings.html', function desc() {
|
|||
it('should remove existing team on click Remove', async () => {
|
||||
await this.app.client.
|
||||
element('.modal-dialog').click('.btn=Remove').
|
||||
pause(500);
|
||||
const existing = await this.app.client.isExisting(modalTitleSelector);
|
||||
existing.should.be.false;
|
||||
waitForExist(modalTitleSelector, 5000, true);
|
||||
|
||||
await this.app.client.
|
||||
click('#btnClose').
|
||||
pause(500);
|
||||
await this.app.client.waitForVisible('#serversSaveIndicator', 10000, true);
|
||||
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.deep.equal(config.teams.slice(1));
|
||||
|
@ -354,13 +352,9 @@ describe('browser/settings.html', function desc() {
|
|||
it('should NOT remove existing team on click Cancel', async () => {
|
||||
await this.app.client.
|
||||
element('.modal-dialog').click('.btn=Cancel').
|
||||
pause(500);
|
||||
const existing = await this.app.client.isExisting(modalTitleSelector);
|
||||
existing.should.be.false;
|
||||
waitForExist(modalTitleSelector, 5000, true);
|
||||
|
||||
await this.app.client.
|
||||
click('#btnClose').
|
||||
pause(500);
|
||||
await this.app.client.waitForVisible('#serversSaveIndicator', 10000, true);
|
||||
|
||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||
savedConfig.teams.should.deep.equal(config.teams);
|
||||
|
|
Loading…
Reference in a new issue