diff --git a/.github/workflows/build-electron-app.yml b/.github/workflows/build-electron-app.yml index 36891625..1fb34b59 100644 --- a/.github/workflows/build-electron-app.yml +++ b/.github/workflows/build-electron-app.yml @@ -27,7 +27,7 @@ env: jobs: linux-win-docker-builder: timeout-minutes: 90 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3 @@ -110,7 +110,7 @@ jobs: echo "IS_BFX_API_STAGING=1" >> $GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: 16.20.0 + node-version: 18.15.0 - name: Cache Electron binaries id: electron-cache uses: actions/cache@v3 diff --git a/Dockerfile.linux-builder b/Dockerfile.linux-builder index 2ce7c4ad..63c6a8a4 100644 --- a/Dockerfile.linux-builder +++ b/Dockerfile.linux-builder @@ -1,6 +1,6 @@ -FROM electronuserland/builder:16 +FROM electronuserland/builder:18 -ARG NODE_VERSION="16.20.0" +ARG NODE_VERSION="18.15.0" ENV IS_BFX_API_STAGING=${IS_BFX_API_STAGING:-0} ENV IS_DEV_ENV=${IS_DEV_ENV:-0} diff --git a/Dockerfile.mac-builder b/Dockerfile.mac-builder index 8cb3d781..0e524f91 100644 --- a/Dockerfile.mac-builder +++ b/Dockerfile.mac-builder @@ -1,6 +1,6 @@ -FROM electronuserland/builder:16 +FROM electronuserland/builder:18 -ARG NODE_VERSION="16.20.0" +ARG NODE_VERSION="18.15.0" ENV IS_BFX_API_STAGING=${IS_BFX_API_STAGING:-0} ENV IS_DEV_ENV=${IS_DEV_ENV:-0} diff --git a/Dockerfile.ui-builder b/Dockerfile.ui-builder index 58a5e0d4..5f193211 100644 --- a/Dockerfile.ui-builder +++ b/Dockerfile.ui-builder @@ -1,6 +1,6 @@ -FROM electronuserland/builder:16 +FROM electronuserland/builder:18 -ARG NODE_VERSION="16.20.0" +ARG NODE_VERSION="18.17.1" ENV IS_BFX_API_STAGING=${IS_BFX_API_STAGING:-0} ENV IS_DEV_ENV=${IS_DEV_ENV:-0} diff --git a/Dockerfile.win-builder b/Dockerfile.win-builder index 7f4b0b79..7ca0c7fc 100644 --- a/Dockerfile.win-builder +++ b/Dockerfile.win-builder @@ -1,6 +1,6 @@ -FROM electronuserland/builder:16-wine +FROM electronuserland/builder:18-wine -ARG NODE_VERSION="16.20.0" +ARG NODE_VERSION="18.15.0" ENV IS_BFX_API_STAGING=${IS_BFX_API_STAGING:-0} ENV IS_DEV_ENV=${IS_DEV_ENV:-0} diff --git a/README.md b/README.md index bb197f0b..19b70f6b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Download the correspondent binary according your operating system. Available the ## Setup -Functionality has been tested on `Ubuntu 20.04 LTS` +Functionality has been tested on `Ubuntu 22.04 LTS` ### Main Structure @@ -24,7 +24,7 @@ To simplify setup/build/publish processes the following bash scripts are provide - `./scripts/setup.sh` - CLI as an easy way to get through the setup process. It will launch `./scripts/sync-repo.sh` script and then setup the development environment - `./scripts/sync-repo.sh` - CLI to fetch the last changes of the repository/sub-modules from the main remote repo -- `./scripts/launch.sh` - CLI to launch docker-compose services to build releases and publish executable artifacts of the electron app with the last fetched changes +- `./scripts/launch.sh` - CLI to launch Docker Compose services to build releases and publish executable artifacts of the electron app with the last fetched changes Additional bash scripts: @@ -37,14 +37,14 @@ Additional bash scripts: The setup was tested with the following dependencies: -- Docker version 20.10.12 -- docker-compose version 1.29.2 +- Docker version 24.0.6 +- Docker Compose version 2.21.0 - git version 2.24.1 -To install `Docker`/`docker-compose` check the corresponding sections of the official docs: +To install `Docker`/`Docker Compose` check the corresponding sections of the official docs: - [install Docker](https://docs.docker.com/engine/install) -- [install docker-compose](https://docs.docker.com/compose/install) +- [install Docker Compose](https://docs.docker.com/compose/install) Compose V2 is included with all currently supported versions of Docker Desktop - if you don’t want to preface the docker command with sudo, create a Unix group called docker and add users to it, [check the doc](https://docs.docker.com/engine/install/linux-postinstall) ### Setup electron app @@ -121,7 +121,7 @@ export IS_AUTO_UPDATE_BEING_TESTED=true For doing builds for other platforms please have [Multi Platform Build](https://www.electron.build/multi-platform-build) in consideration -To launch docker-compose services to build releases and publish executable artifacts of the electron app available the `./scripts/launch.sh` bash script. +To launch Docker Compose services to build releases and publish executable artifacts of the electron app available the `./scripts/launch.sh` bash script. Available the following arguments: ```console diff --git a/docker-compose.yaml b/docker-compose.yaml index d77f06bf..71f96c1b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '3.7' - services: ui-builder: container_name: ui-builder diff --git a/package.json b/package.json index 34ec6401..b466458a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "author": "bitfinex.com", "main": "index.js", "engine": { - "node": ">=14.16.0" + "node": ">=18.15.0" }, "license": "Apache-2.0", "dependencies": { @@ -19,7 +19,7 @@ "cron-validate": "1.4.3", "ed25519-supercop": "2.0.1", "electron-alert": "0.1.20", - "electron-log": "4.4.1", + "electron-log": "4.4.8", "electron-root-path": "1.0.16", "electron-updater": "5.3.0", "extract-zip": "2.0.1", @@ -36,7 +36,7 @@ "devDependencies": { "@mapbox/node-pre-gyp": "1.0.6", "app-builder-bin": "4.1.0", - "electron": "21.3.3", + "electron": "25.8.1", "electron-builder": "23.6.0", "mocha": "10.2.0", "standard": "16.0.4" diff --git a/scripts/helpers/install-backend-deps.sh b/scripts/helpers/install-backend-deps.sh index 2e2c5dc6..6742d30d 100755 --- a/scripts/helpers/install-backend-deps.sh +++ b/scripts/helpers/install-backend-deps.sh @@ -42,7 +42,7 @@ function installBackendDeps { cd "$ROOT" echo -e "\n${COLOR_BLUE}Installing the main dev deps...${COLOR_NORMAL}" rm -rf ./node_modules - npm i --development --no-audit --progress=false + npm i --development --no-audit --progress=false --force npm ls --depth=0 --only=dev 1<&- export npm_config_target_platform="$targetPlatform" @@ -55,7 +55,7 @@ function installBackendDeps { export npm_config_disturl="$DIST_URL" echo -e "\n${COLOR_BLUE}Installing the main prod deps...${COLOR_NORMAL}" - npm i --production --include=dev --no-audit --progress=false + npm i --production --include=dev --no-audit --progress=false --force rm -rf "$ROOT/node_modules/ed25519-supercop/build" checkNodeModulesDir "$ROOT" depsErr=$(npm ls --depth=0 --only=prod 2>&1 >/dev/null | grep -E -v "missing: eslint|--omit=dev" || [[ $? == 1 ]]) diff --git a/scripts/helpers/install-nodejs.sh b/scripts/helpers/install-nodejs.sh index 47dddcc2..b4948797 100755 --- a/scripts/helpers/install-nodejs.sh +++ b/scripts/helpers/install-nodejs.sh @@ -13,7 +13,7 @@ script as required NodeJS version!${COLOR_NORMAL}" >&2 exit 1 fi -version="${1:-"16.20.0"}" +version="${1:-"18.15.0"}" echo -e "\n${COLOR_BLUE}Installing the NodeJS v$version...${COLOR_NORMAL}" @@ -25,11 +25,7 @@ unlink /usr/local/CHANGELOG.md unlink /usr/local/LICENSE unlink /usr/local/README.md -# https://github.com/npm/npm/issues/4531 -npm config set unsafe-perm true - npm cache clear --force -npm install --global node-gyp@9.1.0 -npm config set node_gyp $(npm prefix -g)/lib/node_modules/node-gyp/bin/node-gyp.js +npm install --global node-gyp@9.4.0 echo -e "\n${COLOR_GREEN}The NodeJS has been installed successful${COLOR_NORMAL}" diff --git a/scripts/launch.sh b/scripts/launch.sh index 7403b352..fb5e3151 100755 --- a/scripts/launch.sh +++ b/scripts/launch.sh @@ -133,7 +133,7 @@ if [ $syncSubModules == 1 ]; then source "$ROOT/scripts/sync-repo.sh" "-wue" fi -docker-compose up $composeCommonFlags $uiBuilderService \ +docker compose up $composeCommonFlags $uiBuilderService \ $linuxBuilderService $winBuilderService $macBuilderService if [ $buildLinux == 1 ]; then diff --git a/src/auto-updater/bfx.mac.updater.js b/src/auto-updater/bfx.mac.updater.js index cb1390f2..0709539f 100644 --- a/src/auto-updater/bfx.mac.updater.js +++ b/src/auto-updater/bfx.mac.updater.js @@ -2,6 +2,7 @@ const path = require('path') const fs = require('fs') +const fsPromises = require('fs/promises') const { spawn } = require('child_process') const { MacUpdater } = require('electron-updater') const extract = require('extract-zip') @@ -54,7 +55,7 @@ class BfxMacUpdater extends MacUpdater { const dist = path.join(root, '..') const exec = path.join(root, 'Contents/MacOS/Bitfinex Report') - await fs.promises.rmdir(root, { recursive: true }) + await fsPromises.rm(root, { recursive: true }) await extract( downloadedFilePath, diff --git a/src/change-reports-folder.js b/src/change-reports-folder.js index 30855c47..59f2f0d1 100644 --- a/src/change-reports-folder.js +++ b/src/change-reports-folder.js @@ -1,6 +1,6 @@ 'use strict' -const electron = require('electron') +const { dialog, BrowserWindow } = require('electron') const { CSV_PATH_VERSION } = require('./const') @@ -14,10 +14,8 @@ const relaunch = require('./relaunch') const { getConfigsKeeperByName } = require('./configs-keeper') module.exports = ({ pathToUserDocuments }) => { - const dialog = electron.dialog || electron.remote.dialog - return async () => { - const win = electron.BrowserWindow.getFocusedWindow() + const win = BrowserWindow.getFocusedWindow() try { const { diff --git a/src/export-db.js b/src/export-db.js index b099eba7..07aeefd5 100644 --- a/src/export-db.js +++ b/src/export-db.js @@ -1,7 +1,7 @@ 'use strict' const path = require('path') -const electron = require('electron') +const { dialog, BrowserWindow } = require('electron') const { InvalidFilePathError } = require('./errors') const { zip } = require('./archiver') @@ -23,8 +23,6 @@ module.exports = ({ pathToUserData, pathToUserDocuments }) => { - const dialog = electron.dialog || electron.remote.dialog - const _timestamp = (new Date()).toISOString().split('.')[0] const timestamp = _timestamp.replace(/[:]/g, '-') const defaultPath = path.join( @@ -37,7 +35,7 @@ module.exports = ({ const secretKeyPath = path.join(pathToUserData, SECRET_KEY_FILE_NAME) return async () => { - const win = electron.BrowserWindow.getFocusedWindow() + const win = BrowserWindow.getFocusedWindow() try { const { diff --git a/src/helpers/manage-window.js b/src/helpers/manage-window.js index f63a7a0d..9bb72617 100644 --- a/src/helpers/manage-window.js +++ b/src/helpers/manage-window.js @@ -1,6 +1,6 @@ 'use strict' -const electron = require('electron') +const { screen } = require('electron') const hideWindow = (win, opts) => { return new Promise((resolve, reject) => { @@ -74,7 +74,6 @@ const showWindow = (win, opts) => { } const centerWindow = (win, workArea) => { - const screen = electron.screen || electron.remote.screen const { getCursorScreenPoint, getDisplayNearestPoint diff --git a/src/import-db.js b/src/import-db.js index 6ce2e894..c41b09ca 100644 --- a/src/import-db.js +++ b/src/import-db.js @@ -1,6 +1,6 @@ 'use strict' -const electron = require('electron') +const { dialog, BrowserWindow } = require('electron') const { InvalidFilePathError, @@ -38,10 +38,8 @@ module.exports = ({ pathToUserData, pathToUserDocuments }) => { - const dialog = electron.dialog || electron.remote.dialog - return async () => { - const win = electron.BrowserWindow.getFocusedWindow() + const win = BrowserWindow.getFocusedWindow() try { const { diff --git a/src/relaunch.js b/src/relaunch.js index e46561f0..e9531ea5 100644 --- a/src/relaunch.js +++ b/src/relaunch.js @@ -3,8 +3,6 @@ const electron = require('electron') module.exports = () => { - const app = electron.app || electron.remote.app - const options = { args: process.argv.slice(1).concat(['--relaunch']) } @@ -14,6 +12,6 @@ module.exports = () => { options.args.unshift('--appimage-extract-and-run') } - app.relaunch(options) - app.exit(0) + electron.app.relaunch(options) + electron.app.exit(0) } diff --git a/src/show-message-modal-dialog.js b/src/show-message-modal-dialog.js index 2529f1a0..7e691fb1 100644 --- a/src/show-message-modal-dialog.js +++ b/src/show-message-modal-dialog.js @@ -1,12 +1,11 @@ 'use strict' -const electron = require('electron') +const { dialog, BrowserWindow } = require('electron') module.exports = async (win, opts = {}) => { - const dialog = electron.dialog || electron.remote.dialog const _win = win && typeof win === 'object' ? win - : electron.BrowserWindow.getFocusedWindow() + : BrowserWindow.getFocusedWindow() const { response: btnId, diff --git a/src/window-creators.js b/src/window-creators.js index 2e620aba..461eb16f 100644 --- a/src/window-creators.js +++ b/src/window-creators.js @@ -129,7 +129,8 @@ const _createWindow = async ( } if (!pathname) { - await createLoadingWindow() + const props = await createLoadingWindow() + props.win.setAlwaysOnTop(true) return res } diff --git a/src/window-state-keeper.js b/src/window-state-keeper.js index 557588d8..73bd1e78 100644 --- a/src/window-state-keeper.js +++ b/src/window-state-keeper.js @@ -1,12 +1,10 @@ 'use strict' -const electron = require('electron') +const { screen } = require('electron') const { getConfigsKeeperByName } = require('./configs-keeper') module.exports = (options) => { - const screen = electron.screen || electron.remote.screen - let state = null let winRef = null let stateChangeTimer = null @@ -33,8 +31,8 @@ module.exports = (options) => { } const resetStateToDefault = () => { - const point = electron.screen.getCursorScreenPoint() - const displayBounds = electron.screen.getDisplayNearestPoint(point) + const point = screen.getCursorScreenPoint() + const displayBounds = screen.getDisplayNearestPoint(point) state = { width: config.defaultWidth || 800, @@ -49,7 +47,7 @@ module.exports = (options) => { const { maxWidth, maxHeight - } = electron.screen.getAllDisplays().reduce(( + } = screen.getAllDisplays().reduce(( { maxWidth, maxHeight }, { workAreaSize: { width, height } } ) => {