From 3833d35348b86ef6d006b4be37228dd482f3b0a0 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 13 Jun 2022 17:17:19 +0200 Subject: [PATCH] chore(crypto-nodejs): Drop Node.js v12.17. There is a segfault with `napi-rs` and Node.js in v12.17. It's an old version, it may be fair to drop its support for now. Let's see if people would need it in the future, we may work on `napi-rs` to fix this bug in case it's really necessary. --- .github/workflows/ci.yml | 2 +- crates/matrix-sdk-crypto-nodejs/README.md | 6 +++--- crates/matrix-sdk-crypto-nodejs/tests/machine.test.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10053774f..1a58e55f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: strategy: fail-fast: true matrix: - node-version: [12.17, 14.0, 15.0, 16.0] + node-version: [14.0, 15.0, 16.0] include: - node-version: 16.0 build-doc: true diff --git a/crates/matrix-sdk-crypto-nodejs/README.md b/crates/matrix-sdk-crypto-nodejs/README.md index 289945546..a7b8d8f9f 100644 --- a/crates/matrix-sdk-crypto-nodejs/README.md +++ b/crates/matrix-sdk-crypto-nodejs/README.md @@ -19,10 +19,10 @@ Node.js and npm Page](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). The binding is using NAPIĀ 6 (Node API versionĀ 6), which means that is -compatible with Node.js versions 12.17.0, 14.0.0, 15.0.0 and 16.0.0 -(see [the full Node API version +compatible with Node.js versions 14.0.0, 15.0.0 and 16.0.0 (see [the +full Node API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix)) -(we do not support the version 10.20). +(we do not support the versions 10.20 and 12.17.0). Once the Rust compiler, Node.js and npm are installed, you can run the following commands: diff --git a/crates/matrix-sdk-crypto-nodejs/tests/machine.test.js b/crates/matrix-sdk-crypto-nodejs/tests/machine.test.js index 61fea40b5..47cf62483 100644 --- a/crates/matrix-sdk-crypto-nodejs/tests/machine.test.js +++ b/crates/matrix-sdk-crypto-nodejs/tests/machine.test.js @@ -1,7 +1,7 @@ const { OlmMachine, UserId, DeviceId, RoomId, DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest, KeysClaimRequest, EncryptionSettings, DecryptedRoomEvent, VerificationState } = require('../'); const path = require('path'); const os = require('os'); -const fs = require('fs'); +const fs = require('fs/promises'); describe(OlmMachine.name, () => { test('cannot be instantiated with the constructor', () => { @@ -14,13 +14,13 @@ describe(OlmMachine.name, () => { describe('can be instantiated with a store', () => { test('with no passphrase', async () => { - const temp_directory = fs.mkdtempSync(path.join(os.tmpdir(), 'matrix-sdk-crypto--')); + const temp_directory = await fs.mkdtemp(path.join(os.tmpdir(), 'matrix-sdk-crypto--')); expect(await OlmMachine.initialize(new UserId('@foo:bar.org'), new DeviceId('baz'), temp_directory)).toBeInstanceOf(OlmMachine); }); test('with a passphrase', async () => { - const temp_directory = fs.mkdtempSync(path.join(os.tmpdir(), 'matrix-sdk-crypto--')); + const temp_directory = await fs.mkdtemp(path.join(os.tmpdir(), 'matrix-sdk-crypto--')); expect(await OlmMachine.initialize(new UserId('@foo:bar.org'), new DeviceId('baz'), temp_directory, 'hello')).toBeInstanceOf(OlmMachine); });