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

chore: downgrade node engine to 18 #2173

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
type: string

env:
NODE_JS: "20"
NODE_JS: "18"

jobs:
check:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

env:
NODE_JS: "20"
NODE_JS: "18"
EXAMPLE_TEMPLATE: "web-chat"
EXAMPLE_NAME: "example"
EXAMPLE_PORT: "8080"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
default: false

env:
NODE_JS: "20"
NODE_JS: "18"
# Ensure test type conditions remain consistent.
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
DEBUG: ${{ inputs.debug }}
Expand Down
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"packages/relay": "0.0.15",
"packages/sdk": "0.0.28",
"packages/discovery": "0.0.5",
"packages/react-native-polyfills": "0.0.1"
"packages/react-native-polyfills": "0.0.1",
"packages/custom-event-polyfill": "0.0.1"
}
43 changes: 32 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"type": "module",
"workspaces": [
"packages/custom-event-polyfill",
"packages/proto",
"packages/interfaces",
"packages/utils",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
},
"engines": {
"node": ">=20"
"node": ">=18"
},
"dependencies": {
"@libp2p/ping": "^1.1.2",
Expand All @@ -78,7 +78,8 @@
"it-length-prefixed": "^9.0.4",
"it-pipe": "^3.0.1",
"uint8arraylist": "^2.4.3",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"@waku/custom-event-polyfill": "0.0.1"
},
"devDependencies": {
"@multiformats/multiaddr": "^12.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "@waku/custom-event-polyfill";

export { createEncoder, createDecoder } from "./lib/message/version_0.js";
export type {
Encoder,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/lib/connection_manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@waku/custom-event-polyfill";
import type { Peer, PeerId, PeerInfo, PeerStore } from "@libp2p/interface";
import { CustomEvent, TypedEventEmitter } from "@libp2p/interface";
import { TypedEventEmitter } from "@libp2p/interface";
import {
ConnectionManagerOptions,
DiscoveryTrigger,
Expand Down Expand Up @@ -36,7 +37,7 @@
private options: ConnectionManagerOptions;
private libp2p: Libp2p;
private dialAttemptsForPeer: Map<string, number> = new Map();
private dialErrorsForPeer: Map<string, any> = new Map();

Check warning on line 40 in packages/core/src/lib/connection_manager.ts

View workflow job for this annotation

GitHub Actions / proto

Unexpected any. Specify a different type

Check warning on line 40 in packages/core/src/lib/connection_manager.ts

View workflow job for this annotation

GitHub Actions / check

Unexpected any. Specify a different type

private currentActiveParallelDialCount = 0;
private pendingPeerDialQueue: Array<PeerId> = [];
Expand Down Expand Up @@ -253,7 +254,7 @@
// Handle generic error
log.error(
`Error dialing peer ${peerId.toString()} - ${
(error as any).message

Check warning on line 257 in packages/core/src/lib/connection_manager.ts

View workflow job for this annotation

GitHub Actions / proto

Unexpected any. Specify a different type

Check warning on line 257 in packages/core/src/lib/connection_manager.ts

View workflow job for this annotation

GitHub Actions / check

Unexpected any. Specify a different type
}`
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "@waku/custom-event-polyfill";
import { Connection, Peer, PeerId, Stream } from "@libp2p/interface";
import { expect } from "chai";
import sinon from "sinon";
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/stream_manager/stream_manager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "@waku/custom-event-polyfill";
import type { Peer, PeerId, PeerUpdate, Stream } from "@libp2p/interface";
import type { Libp2p } from "@waku/interfaces";
import { Logger } from "@waku/utils";
Expand Down
6 changes: 6 additions & 0 deletions packages/custom-event-polyfill/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json"
}
};
10 changes: 10 additions & 0 deletions packages/custom-event-polyfill/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

## 0.0.1 (2024-04-09)


### Features

* Add react-native polyfills ([#1915](https://github.com/waku-org/js-waku/issues/1915)) ([9be942f](https://github.com/waku-org/js-waku/commit/9be942fc23e1e6c1ed5775e44e0d77ec7627b38c))

## Changelog
42 changes: 42 additions & 0 deletions packages/custom-event-polyfill/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@waku/custom-event-polyfill",
"version": "0.0.1",
"description": "CustomEvent polyfill for Waku",
"module": "./dist/index.js",
"exports": {
".": "./dist/index.js"
},
"type": "module",
"homepage": "https://github.com/waku-org/js-waku/tree/master/packages/custom-event-polyfill#readme",
"repository": {
"type": "git",
"url": "https://github.com/waku-org/js-waku.git"
},
"bugs": {
"url": "https://github.com/waku-org/js-waku/issues"
},
"license": "MIT OR Apache-2.0",
"keywords": [
"waku",
"custom-event",
"polyfill",
"web3"
],
"scripts": {
"build": "run-s build:**",
"build:esm": "tsc",
"check": "run-s check:*",
"check:tsc": "tsc -p tsconfig.dev.json",
"check:spelling": "cspell \"{README.md,src/**/*.ts}\"",
"prepublish": "npm run build"
},
"engines": {
"node": ">=18"
},
"dependencies": {},
"devDependencies": {},
"files": [
"dist"
],
"types": "dist/index.d.ts"
}
12 changes: 12 additions & 0 deletions packages/custom-event-polyfill/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if (typeof CustomEvent === "undefined") {
class CustomEvent<T = unknown> extends Event {
public detail: T;

public constructor(type: string, eventInitDict?: CustomEventInit<T>) {
super(type, eventInitDict);
this.detail = eventInitDict?.detail ?? (null as T);
}
}

(globalThis as Record<string, unknown>).CustomEvent = CustomEvent;
}
7 changes: 7 additions & 0 deletions packages/custom-event-polyfill/tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.dev.json",
"include": ["src/**/*", "src/**/*.d.ts"],
"compilerOptions": {
"outDir": "dist"
}
}
12 changes: 12 additions & 0 deletions packages/custom-event-polyfill/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "dist/",
"rootDir": "src",
"tsBuildInfoFile": "dist/.tsbuildinfo",
"declaration": true,
"declarationMap": true
},
"include": ["src/**/*", "src/**/*.d.ts"],
"exclude": ["src/**/*.spec.ts", "src/test_utils"]
}
5 changes: 3 additions & 2 deletions packages/discovery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"test:browser": "NODE_ENV=test karma start karma.conf.cjs"
},
"engines": {
"node": ">=20"
"node": ">=18"
},
"dependencies": {
"@waku/interfaces": "0.0.27",
Expand All @@ -59,7 +59,8 @@
"debug": "^4.3.4",
"dns-query": "^0.11.2",
"hi-base32": "^0.5.1",
"uint8arrays": "^5.0.1"
"uint8arrays": "^5.0.1",
"@waku/custom-event-polyfill": "0.0.1"
},
"devDependencies": {
"@libp2p/peer-id": "^4.2.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/discovery/src/dns/dns_discovery.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "@waku/custom-event-polyfill";

import {
CustomEvent,
PeerDiscovery,
Expand Down
Loading
Loading