Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed now unnecessary version checking #4815

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
"build": "vite build --config ./config/vite.config.js",
"test": "npm run test-backend && npm run test-e2e",
"test-with-build": "npm run build && npm test",
"test-backend": "node test/backend-test-entry.js",
"test-backend:14": "cross-env TEST_BACKEND=1 NODE_OPTIONS=\"--experimental-abortcontroller --no-warnings\" node--test test/backend-test",
"test-backend:18": "cross-env TEST_BACKEND=1 node --test test/backend-test",
"test-backend": "cross-env TEST_BACKEND=1 node --test test/backend-test",
"test-e2e": "playwright test --config ./config/playwright.config.js",
"test-e2e-ui": "playwright test --config ./config/playwright.config.js --ui --ui-port=51063",
"playwright-codegen": "playwright codegen localhost:3000 --save-storage=./private/e2e-auth.json",
Expand Down
11 changes: 1 addition & 10 deletions server/notification-providers/nostr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { log } = require("../../src/util");

Check warning on line 1 in server/notification-providers/nostr.js

View workflow job for this annotation

GitHub Actions / check-linters

'log' is assigned a value but never used
const NotificationProvider = require("./notification-provider");
const {
relayInit,
Expand All @@ -12,16 +12,7 @@
// polyfills for node versions
const semver = require("semver");
const nodeVersion = process.version;
if (semver.lt(nodeVersion, "16.0.0")) {
log.warn("monitor", "Node <= 16 is unsupported for nostr, sorry :(");
} else if (semver.lt(nodeVersion, "18.0.0")) {
// polyfills for node 16
global.crypto = require("crypto");
global.WebSocket = require("isomorphic-ws");
if (typeof crypto !== "undefined" && !crypto.subtle && crypto.webcrypto) {
crypto.subtle = crypto.webcrypto.subtle;
}
} else if (semver.lt(nodeVersion, "20.0.0")) {
if (semver.lt(nodeVersion, "20.0.0")) {
// polyfills for node 18
global.crypto = require("crypto");
global.WebSocket = require("isomorphic-ws");
Expand Down
2 changes: 1 addition & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const nodeVersion = process.versions.node;

// Get the required Node.js version from package.json
const requiredNodeVersions = require("../package.json").engines.node;
const bannedNodeVersions = " < 14 || 20.0.* || 20.1.* || 20.2.* || 20.3.* ";
const bannedNodeVersions = " < 18 || 20.0.* || 20.1.* || 20.2.* || 20.3.* ";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attached to the v2.0 milestone due to this bugfix ^^

console.log(`Your Node.js version: ${nodeVersion}`);

const semver = require("semver");
Expand Down
20 changes: 0 additions & 20 deletions test/backend-test-entry.js

This file was deleted.

20 changes: 2 additions & 18 deletions test/backend-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ Create a test file in this directory with the name `*.js`.
## Template

```js
const semver = require("semver");
let test;
const nodeVersion = process.versions.node;
if (semver.satisfies(nodeVersion, ">= 18")) {
test = require("node:test");
} else {
test = require("test");
}

const test = require("node:test");
const assert = require("node:assert");

test("Test name", async (t) => {
Expand All @@ -25,14 +17,6 @@ test("Test name", async (t) => {

## Run

Node.js >=18

```bash
npm run test-backend:18
```

Node.js < 18

```bash
npm run test-backend:14
npm run test-backend
```
10 changes: 1 addition & 9 deletions test/backend-test/test-uptime-calculator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
const semver = require("semver");
let test;
const nodeVersion = process.versions.node;
// Node.js version >= 18
if (semver.satisfies(nodeVersion, ">= 18")) {
test = require("node:test");
} else {
test = require("test");
}
const test = require("node:test");

const assert = require("node:assert");
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
const { UptimeCalculator } = require("../../server/uptime-calculator");
Expand Down
Loading