[MM-43039] Upgrade and clean up dependencies (#2038)
* Upgrade Electron to v18 * Fix a test * Upgrade ESLint and TypeScript * Update Joi * Clean up and upgrade dependencies * Upgrade dev dependencies * Upgrade to Webpack 5 * Update NOTICE.txt * Update test runtime
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
import log from 'electron-log';
|
||||
|
||||
import Joi from '@hapi/joi';
|
||||
import Joi from 'joi';
|
||||
|
||||
import {Args} from 'types/args';
|
||||
import {ConfigV0, ConfigV1, ConfigV2, ConfigV3, TeamWithTabs} from 'types/config';
|
||||
|
@@ -261,28 +261,31 @@ describe('main/app/utils', () => {
|
||||
expect(updatePaths).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should copy all of the configs when they exist to the new directory', () => {
|
||||
const migrationPrefs = {
|
||||
getValue: () => false,
|
||||
setValue: jest.fn(),
|
||||
};
|
||||
JsonFileManager.mockImplementation(() => migrationPrefs);
|
||||
fs.readFileSync.mockReturnValue('config-data');
|
||||
fs.existsSync.mockImplementation((path) => {
|
||||
if (path === '/Library/Application Support/Mattermost') {
|
||||
return true;
|
||||
}
|
||||
return ['config', 'app-state', 'bounds-info', 'migration-info'].some((filename) => path.endsWith(`${filename}.json`));
|
||||
// this doesn't run on windows because of path resolution
|
||||
if (process.platform !== 'win32') {
|
||||
it('should copy all of the configs when they exist to the new directory', () => {
|
||||
const migrationPrefs = {
|
||||
getValue: () => false,
|
||||
setValue: jest.fn(),
|
||||
};
|
||||
JsonFileManager.mockImplementation(() => migrationPrefs);
|
||||
fs.readFileSync.mockReturnValue('config-data');
|
||||
fs.existsSync.mockImplementation((path) => {
|
||||
if (path === '/Library/Application Support/Mattermost') {
|
||||
return true;
|
||||
}
|
||||
return ['config', 'app-state', 'bounds-info', 'migration-info'].some((filename) => path.endsWith(`${filename}.json`));
|
||||
});
|
||||
dialog.showMessageBoxSync.mockReturnValue(0);
|
||||
dialog.showOpenDialogSync.mockReturnValue(['/old/data/path']);
|
||||
migrateMacAppStore();
|
||||
expect(fs.readFileSync).toHaveBeenCalledWith('/old/data/path/config.json');
|
||||
expect(fs.writeFileSync).toHaveBeenCalledWith('/path/to/data/config.json', 'config-data');
|
||||
expect(fs.readFileSync).not.toHaveBeenCalledWith('/old/data/path/allowedProtocols.json');
|
||||
expect(fs.writeFileSync).not.toHaveBeenCalledWith('/path/to/data/allowedProtocols.json', 'config-data');
|
||||
expect(updatePaths).toHaveBeenCalled();
|
||||
expect(migrationPrefs.setValue).toHaveBeenCalledWith('masConfigs', true);
|
||||
});
|
||||
dialog.showMessageBoxSync.mockReturnValue(0);
|
||||
dialog.showOpenDialogSync.mockReturnValue(['/old/data/path']);
|
||||
migrateMacAppStore();
|
||||
expect(fs.readFileSync).toHaveBeenCalledWith('/old/data/path/config.json');
|
||||
expect(fs.writeFileSync).toHaveBeenCalledWith('/path/to/data/config.json', 'config-data');
|
||||
expect(fs.readFileSync).not.toHaveBeenCalledWith('/old/data/path/allowedProtocols.json');
|
||||
expect(fs.writeFileSync).not.toHaveBeenCalledWith('/path/to/data/allowedProtocols.json', 'config-data');
|
||||
expect(updatePaths).toHaveBeenCalled();
|
||||
expect(migrationPrefs.setValue).toHaveBeenCalledWith('masConfigs', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import {app, Notification} from 'electron';
|
||||
|
||||
import Utils from 'common/utils/util';
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {app, Notification} from 'electron';
|
||||
|
||||
const assetsDir = path.resolve(app.getAppPath(), 'assets');
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {app, nativeImage, Tray, systemPreferences, nativeTheme} from 'electron';
|
||||
|
||||
import {UPDATE_TRAY} from 'common/communication';
|
||||
|
@@ -2,9 +2,10 @@
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {app, BrowserWindow} from 'electron';
|
||||
import path from 'path';
|
||||
|
||||
import {app, BrowserWindow} from 'electron';
|
||||
|
||||
import {Args} from 'types/args';
|
||||
|
||||
import {BACK_BAR_HEIGHT, PRODUCTION, TAB_BAR_HEIGHT} from 'common/utils/constants';
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
import path from 'path';
|
||||
|
||||
import {app, BrowserWindow, nativeImage, systemPreferences, ipcMain, IpcMainEvent, IpcMainInvokeEvent, desktopCapturer} from 'electron';
|
||||
import log from 'electron-log';
|
||||
|
||||
|
Reference in New Issue
Block a user