SDA-3733 (Upgrade electron version to 19) (#1437)

* SDA-3733 - Update electron version to 19

* Remove electron-rebuild dependency

* Switch to node version 16.13.2

* Remove rebuild script

* Bump napi

* Use node 16.13.2

* remove @types dependency

* Bump node version for build-mac.sh

* Bump run-script-os and screen-share-indicator-frame

* updated electron and electron-builder

* Capture unhandled rejections

* Remove swift search

* Update to version 19

* Swift Shader is no longer part of 19 builds

* Update ci node version

* SDA-3733 - Bump electron version to 19.0.2
This commit is contained in:
Kiran Niranjan 2022-06-14 14:00:20 +05:30 committed by GitHub
parent a2453c27e4
commit 4d3455b3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 26545 additions and 1754 deletions

View File

@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
node-version: [12.x]
node-version: [16.x]
os: [ubuntu-latest, windows-2019, macos-latest]
steps:

View File

@ -31,7 +31,6 @@ install:
script:
- node --version
- npm --version
- npm run rebuild
- npm run test
cache:

View File

@ -113,31 +113,14 @@ class Script
new DirFiles(@"..\..\..\dist\win-unpacked\resources\*.*"),
new Dir(@"app.asar.unpacked",
new Dir(@"node_modules",
new Dir(@"diskusage\build\Release",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\diskusage\build\Release\diskusage.node")
),
new Dir(@"ffi-napi\build\Release",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\ffi-napi\build\Release\ffi_bindings.node")
),
new Dir(@"ffi-napi\node_modules\ref-napi\prebuilds\win32-x64",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\ffi-napi\node_modules\ref-napi\prebuilds\win32-x64\electron.napi.node")
),
new Dir(@"ref-napi\build\Release",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\ref-napi\build\Release\binding.node")
),
new Dir(@"swift-search\node_modules",
new Dir(@"ffi-napi\build\Release",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\swift-search\node_modules\ffi-napi\build\Release\ffi_bindings.node")
),
new Dir(@"ref-napi\build\Release",
new File(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\swift-search\node_modules\ref-napi\build\Release\binding.node")
)
new Files(@"..\..\..\dist\win-unpacked\resources\app.asar.unpacked\node_modules\ref-napi\prebuilds\*.*")
)
)
)
),
new Dir(@"swiftshader",
new Files(@"..\..\..\dist\win-unpacked\swiftshader\*.*")
)
),

28167
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{
"name": "symphony",
"productName": "Symphony",
"version": "17.1.0",
"version": "19.0.0",
"clientVersion": "2.0.1",
"buildNumber": "0",
"searchAPIVersion": "1.55.3",
@ -17,7 +17,6 @@
"browserify-preload-component": "browserify -o lib/src/renderer/_preload-component.js -x electron --insert-global-vars=__filename,__dirname lib/src/renderer/preload-component.js",
"compile": "run-s lint compile:*",
"compile:project": "gulp build",
"compile:robot": "npm rebuild --build-from-source robotjs",
"dev": "gulp build && npm run browserify && cross-env ELECTRON_DEV=true electron .",
"demo": "run-os",
"demo:win32": "gulp build && npm run browserify && cross-env ELECTRON_DEV=true electron . --url=file:///src/demo/index.html",
@ -28,8 +27,8 @@
"lint:spec": "tslint --project tsconfig.spec.json",
"packed-linux": "npm run prebuild && npm run test && ./node_modules/.bin/electron-builder build --linux",
"packed-mac": "npm run unpacked-mac && packagesbuild -v installer/mac/symphony-mac-packager.pkgproj",
"prebuild": "run-s compile rebuild browserify",
"rebuild": "electron-rebuild -f",
"prebuild": "run-s compile browserify",
"postinstall": "electron-builder install-app-deps",
"start": "run-s compile browserify && cross-env ELECTRON_DEV=true electron .",
"test": "run-s lint test:unit",
"test:unit": "cross-env ELECTRON_QA=true jest --config jest-config.json --runInBand --detectOpenHandles",
@ -113,24 +112,21 @@
"devDependencies": {
"@types/cheerio": "^0.22.22",
"@types/enzyme": "^3.10.7",
"@types/ffi-napi": "2.4.1",
"@types/fs-extra": "^8.1.1",
"@types/jest": "23.3.12",
"@types/node": "^12.12.43",
"@types/react": "16.8.3",
"@types/react-dom": "16.0.9",
"@types/ref-napi": "1.4.0",
"@types/rimraf": "^3.0.0",
"ava": "2.4.0",
"browserify": "16.5.1",
"cross-env": "5.2.0",
"del": "3.0.0",
"electron": "^17.4.4",
"electron-builder": "22.7.0",
"electron": "^19.0.2",
"electron-builder": "23.0.9",
"electron-builder-squirrel-windows": "20.38.3",
"electron-icon-maker": "0.0.4",
"electron-osx-sign": "^0.4.16",
"electron-rebuild": "^3.2.7",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.10.0",
"enzyme-to-json": "^3.3.5",
@ -148,7 +144,7 @@
"prettier": "2.2.1",
"pretty-quick": "^3.1.0",
"robotjs": "0.6.0",
"run-script-os": "1.0.7",
"run-script-os": "1.1.6",
"spectron": "^15.0.0",
"ts-jest": "25.3.0",
"tslint": "5.11.0",
@ -163,21 +159,20 @@
"electron-dl": "3.0.0",
"electron-fetch": "1.4.0",
"electron-log": "4.0.7",
"ffi-napi": "3.0.0",
"ffi-napi": "^4.0.3",
"filesize": "6.1.0",
"lazy-brush": "^1.0.1",
"react": "16.13.0",
"react-dom": "16.13.0",
"ref-napi": "1.4.3",
"ref-napi": "^3.0.3",
"rimraf": "^3.0.2",
"save-svg-as-png": "^1.4.17",
"shell-path": "^3.0.0"
},
"optionalDependencies": {
"auto-update": "file:auto_update",
"screen-share-indicator-frame": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#v1.4.13",
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet2.git#9.2.2",
"screen-share-indicator-frame": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#v1.4.10",
"swift-search": "2.0.3",
"winreg": "^1.2.4"
},
"ava": {

View File

@ -4,7 +4,7 @@
echo "Unlocking keychain"
security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_NAME"
NODE_REQUIRED_VERSION=v12.13.1
NODE_REQUIRED_VERSION=v16.13.2
SNYK_ORG=sda
SNYK_PROJECT_NAME="Symphony Desktop Application"

View File

@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd
echo %PATH%
set DISABLE_REBUILD=true
set NODE_REQUIRED_VERSION=12.13.1
set NODE_REQUIRED_VERSION=16.13.2
set SNYK_ORG=sda
set SNYK_PROJECT_NAME="Symphony Desktop Application"

View File

@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tool
echo %PATH%
set DISABLE_REBUILD=true
set NODE_REQUIRED_VERSION=12.13.1
set NODE_REQUIRED_VERSION=16.13.2
set SNYK_ORG=sda
set SNYK_PROJECT_NAME="Symphony Desktop Application"

View File

@ -1,6 +1,7 @@
import { EventEmitter } from 'events';
import * as path from 'path';
import { isWindowsOS } from '../../src/common/env';
const ipcEmitter = new EventEmitter();
const mockIdleTime: number = 15;
@ -9,12 +10,22 @@ const executableName: string = '/Symphony.exe';
const isReady: boolean = true;
const version: string = '4.0.0';
process.on('unhandledRejection', (reason, promise) => {
console.warn(
'Unhandled promise rejection:',
promise,
'reason:',
reason ? (reason as any).stack : 'unknown' || reason,
);
});
interface IApp {
commandLine: any;
getAppPath(): string;
getPath(type: string): string;
getName(): string;
isReady(): boolean;
whenReady(): Promise<boolean>;
getVersion(): string;
on(eventName: any, cb: any): void;
once(eventName: any, cb: any): void;
@ -75,6 +86,7 @@ export const app: IApp = {
},
getName: () => appName,
isReady: () => isReady,
whenReady: () => Promise.resolve(isReady),
getVersion: () => version,
on: (event, cb) => {
ipcEmitter.on(event, cb);

View File

@ -100,6 +100,7 @@ jest.mock('../src/app/window-utils', () => {
windowExists: jest.fn(() => true),
zoomIn: jest.fn(),
zoomOut: jest.fn(),
reloadWindow: jest.fn(),
};
});

View File

@ -16,6 +16,12 @@ const getMainWindow = {
setFullScreenable: jest.fn(),
};
jest.mock('fs', () => ({
writeFile: jest.fn(),
existsSync: jest.fn(() => true),
readFileSync: jest.fn(() => '{"configVersion": "4.0.0"}'),
}));
jest.mock('electron-log');
jest.mock('../src/common/env', () => {

View File

@ -81,20 +81,6 @@ describe('config', () => {
expect(configField.url).toBe('something');
});
it('should fail when config path is invalid', () => {
const userConfig: object = { url: 'test' };
let isInvalidPath: boolean = false;
writeConfigFile(userConfig);
configInstance.globalConfigPath = '//';
try {
configInstance.readGlobalConfig();
} catch (e) {
isInvalidPath = true;
}
expect(isInvalidPath).toBeTruthy();
});
});
describe('updateConfig', () => {
@ -125,12 +111,6 @@ describe('config', () => {
test: 'test',
});
});
it('should fail when invalid path is used', () => {
configInstance.userConfigPath = '//';
return expect(configInstance.readUserConfig()).rejects.toBeTruthy();
});
});
describe('compareCloudConfig', () => {

View File

@ -5,6 +5,26 @@ import {
import { windowHandler } from '../src/app/window-handler';
import { BrowserWindow, dialog, ipcRenderer } from './__mocks__/electron';
jest.mock('fs', () => ({
writeFileSync: jest.fn(),
existsSync: jest.fn(() => true),
unlinkSync: jest.fn(),
readFileSync: jest.fn(() => '{ "configVersion": "4.0.0" }'),
readdirSync: jest.fn(() => [
'Cache',
'GPUCache',
'Symphony.config',
'cloudConfig.config',
]),
readFile: jest.fn(),
writeFile: jest.fn(),
lstatSync: jest.fn(() => {
return {
isDirectory: jest.fn(() => true),
};
}),
}));
jest.mock('../src/app/window-handler', () => {
return {
windowHandler: {

View File

@ -60,6 +60,7 @@ jest.mock('../src/app/window-utils', () => {
downloadManagerAction: jest.fn(),
getWindowByName: jest.fn(),
isValidWindow: jest.fn(() => true),
isValidView: jest.fn(),
sanitize: jest.fn(),
setDataUrl: jest.fn(),
showBadgeCount: jest.fn(),

View File

@ -561,7 +561,7 @@ class Config {
let parsedData;
if (!data) {
logger.error(`config-handler: unable to read config file`);
throw new Error('unable to read user config file');
return parsedData;
}
try {
parsedData = JSON.parse(data);
@ -596,9 +596,10 @@ class Config {
...rest,
} as IConfig);
}
this.userConfig = this.parseConfigData(
fs.readFileSync(this.userConfigPath, 'utf8'),
);
if (fs.existsSync(this.userConfigPath)) {
const userConfig = fs.readFileSync(this.userConfigPath, 'utf8');
this.userConfig = this.parseConfigData(userConfig);
}
logger.info(`config-handler: User configuration: `, this.userConfig);
}
@ -638,9 +639,12 @@ class Config {
configVersion: app.getVersion().toString(),
});
}
this.cloudConfig = this.parseConfigData(
fs.readFileSync(this.cloudConfigPath, 'utf8'),
);
if (fs.existsSync(this.cloudConfigPath)) {
const cloudConfig = fs.readFileSync(this.cloudConfigPath, 'utf8');
if (cloudConfig) {
this.cloudConfig = this.parseConfigData(cloudConfig);
}
}
// recalculate cloud config when we the application starts
this.filterCloudConfig();
logger.info(`config-handler: Cloud configuration: `, this.userConfig);

View File

@ -48,7 +48,7 @@ import {
let swiftSearchInstance;
try {
// tslint:disable-next-line:no-var-requires
const { SSAPIBridge } = require('swift-search');
const { SSAPIBridge } = {} as any; // require('swift-search');
swiftSearchInstance = new SSAPIBridge();
} catch (e) {
console.warn(

View File

@ -31,7 +31,6 @@ install:
script:
- node --version
- npm --version
- npm run rebuild
- npm run test:spectron
cache: