Skip to content

Commit

Permalink
[PM-358] Bump electron to 24 and node to 18 (#5205)
Browse files Browse the repository at this point in the history
Upgrade Electron to version 24, node to 18 and npm to 9. Electron changed to using node 18 in 23, with node 18 using npm 9 as default.

There doesn't seem to be any breaking changes except the deprecation of Windows 7, 8.1, and Server 2012. A somewhat undocumented breaking change was that elements in the title bar are now draggable which broke the account switching selector. Resolved by adding a no-drag css rule.

- electronjs.org/blog/electron-22-0
- electronjs.org/blog/electron-23-0
- electronjs.org/blog/electron-24-0
  • Loading branch information
Hinton committed May 1, 2023
1 parent 3c42178 commit 9a41d5d
Show file tree
Hide file tree
Showing 18 changed files with 276 additions and 1,581 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Install node-gyp
run: |
Expand Down Expand Up @@ -253,7 +253,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Print environment
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
_WIN_PKG_FETCH_VERSION: 16.16.0
_WIN_PKG_FETCH_VERSION: 18.5.0
_WIN_PKG_VERSION: 3.4
steps:
- name: Checkout repo
Expand All @@ -92,7 +92,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Install node-gyp
run: |
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
_WIN_PKG_FETCH_VERSION: 16.16.0
_WIN_PKG_FETCH_VERSION: 18.5.0
_WIN_PKG_VERSION: 3.4
steps:
- name: Checkout repo
Expand All @@ -166,7 +166,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Install node-gyp
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -266,7 +266,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Expand Down Expand Up @@ -479,7 +479,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -631,7 +631,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -828,7 +828,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -1017,7 +1017,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Run linter
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release-desktop-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Expand Down Expand Up @@ -415,7 +415,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -544,7 +544,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down Expand Up @@ -746,7 +746,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Set Node options
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
node-version: '18'

- name: Print environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.13.1
v18
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build:prod": "cross-env NODE_ENV=production webpack",
"build:prod:watch": "cross-env NODE_ENV=production webpack --watch",
"package": "npm run package:win && npm run package:mac && npm run package:lin",
"package:win": "pkg . --targets win-x64 --output ./dist/windows/bw.exe --build",
"package:win": "pkg . --targets win-x64 --output ./dist/windows/bw.exe",
"package:mac": "pkg . --targets macos-x64 --output ./dist/macos/bw",
"package:lin": "pkg . --targets linux-x64 --output ./dist/linux/bw",
"debug": "node --inspect ./build/bw.js",
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"**/node_modules/@bitwarden/desktop-native/index.js",
"**/node_modules/@bitwarden/desktop-native/desktop_native.${platform}-${arch}*.node"
],
"electronVersion": "21.3.1",
"electronVersion": "24.1.1",
"generateUpdatesFilesForAllChannels": true,
"publish": {
"provider": "generic",
Expand Down
5 changes: 0 additions & 5 deletions apps/desktop/src/auth/lock.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,4 @@
</div>
</div>
</div>
<ng-container *ngIf="oldOs">
<app-callout type="warning" class="os-deprecated">
{{ (deprecated ? "windows8Deprecated" : "windows8SoonDeprecated") | i18n }}
</app-callout>
</ng-container>
</form>
18 changes: 0 additions & 18 deletions apps/desktop/src/auth/lock.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as os from "os";

import { Component, NgZone } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { ipcRenderer } from "electron";
Expand Down Expand Up @@ -33,8 +31,6 @@ const BroadcasterSubscriptionId = "LockComponent";
export class LockComponent extends BaseLockComponent {
private deferFocus: boolean = null;
protected biometricReady = false;
protected oldOs = false;
protected deprecated = false;

constructor(
router: Router,
Expand Down Expand Up @@ -74,20 +70,6 @@ export class LockComponent extends BaseLockComponent {
policyService,
passwordGenerationService
);

if (process.platform === "win32") {
try {
const release = os.release();
const majorVersion = parseInt(release.split(".")[0], 10);

this.oldOs = majorVersion < 10;
if (new Date() > new Date("2023-05-31")) {
this.deprecated = true;
}
} catch (e) {
this.logService.error(e);
}
}
}

async ngOnInit() {
Expand Down
6 changes: 0 additions & 6 deletions apps/desktop/src/auth/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@
</div>
</ng-template>
</div>

<ng-container *ngIf="oldOs">
<app-callout type="warning" class="os-deprecated">
{{ (deprecated ? "windows8Deprecated" : "windows8SoonDeprecated") | i18n }}
</app-callout>
</ng-container>
</form>
</div>
<ng-template #environment></ng-template>
18 changes: 0 additions & 18 deletions apps/desktop/src/auth/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as os from "os";

import { Component, NgZone, OnDestroy, ViewChild, ViewContainerRef } from "@angular/core";
import { FormBuilder } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
Expand Down Expand Up @@ -39,8 +37,6 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy {
showingModal = false;

private deferFocus: boolean = null;
protected oldOs = false;
protected deprecated = false;

get loggedEmail() {
return this.formGroup.value.email;
Expand Down Expand Up @@ -93,20 +89,6 @@ export class LoginComponent extends BaseLoginComponent implements OnDestroy {
super.onSuccessfulLogin = () => {
return syncService.fullSync(true);
};

if (process.platform === "win32") {
try {
const release = os.release();
const majorVersion = parseInt(release.split(".")[0], 10);

this.oldOs = majorVersion < 10;
if (new Date() > new Date("2023-05-31")) {
this.deprecated = true;
}
} catch (e) {
this.logService.error(e);
}
}
}

async ngOnInit() {
Expand Down
8 changes: 0 additions & 8 deletions apps/desktop/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2251,13 +2251,5 @@
},
"windowsBiometricUpdateWarningTitle": {
"message": "Recommended Settings Update"
},
"windows8SoonDeprecated": {
"message": "The operating system you are using will no longer be supported after the 2023.5.0 release. Upgrade to a supported operating system. Continuing without updating your operating system may result in unexpected behavior or security risks.",
"description": "Windows 8, 8.1 and Server 2012 R2 are no longer supported by Electron & Chromium. Show a notice on the login and lock screen while 2023.4.0 is the active version."
},
"windows8Deprecated": {
"message": "The operating system you are using is no longer supported. Continuing without updating your operating system may result in unexpected behavior.",
"description": "Windows 8, 8.1 and Server 2012 R2 are no longer supported by Electron & Chromium. Show a notice on the login and lock screen after 2023.5.0 is released."
}
}
3 changes: 3 additions & 0 deletions apps/desktop/src/scss/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
}

app-account-switcher {
// Electron will mark elements in the title bar as draggable so that the window can be moved. This
// disables the click events. To restore the click functionality, we mark this element as no-drag.
-webkit-app-region: no-drag;
justify-self: end;
height: 100%;
}
Expand Down
10 changes: 0 additions & 10 deletions apps/desktop/src/scss/pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,3 @@
}
}
}

// TODO: Remove after 2023.4 release
.os-deprecated {
margin-top: 20px;
width: 500px;
}

#lock-page {
flex-direction: column;
}
Loading

0 comments on commit 9a41d5d

Please sign in to comment.