Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit a1c270f

Browse files
authored
Update node version to 14 (#1109)
* Prepare for node upgrade * Update node version to 14 * Fix node deprecation warnings * Update node version in webtransport.yaml * Update nan version * Update node version in scripts * Update node version in third party * Make QUIC addon compatible for higher version node * Fix syntax error * Use major version in install script
1 parent 4154f26 commit a1c270f

File tree

25 files changed

+97
-144
lines changed

25 files changed

+97
-144
lines changed

.github/workflows/webtransport.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
path: third_party/owt-client-javascript/
2121
- uses: actions/setup-node@v2
2222
with:
23-
node-version: "10"
23+
node-version: "14"
2424
- uses: actions/setup-python@v2
2525
with:
2626
python-version: '3.x'
@@ -79,4 +79,4 @@ jobs:
7979
name: log
8080
path: dist/logs
8181
retention-days: 1
82-
if: ${{ always() }}
82+
if: ${{ always() }}

scripts/installCommonDeps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ install_libsrtp2(){
369369
}
370370

371371
install_node() {
372-
local NODE_VERSION="v10.21.0"
372+
local NODE_VERSION="v14"
373373
echo -e "\x1b[32mInstalling nvm...\x1b[0m"
374374
NVM_DIR="${HOME}/.nvm"
375375

@@ -394,7 +394,7 @@ install_node_tools() {
394394
check_proxy
395395
npm install -g --loglevel error [email protected] grunt-cli underscore jsdoc
396396
pushd ${ROOT} >/dev/null
397-
npm install nan@2.11.1
397+
npm install nan@2.15.0
398398
pushd ${ROOT}/node_modules/nan >/dev/null
399399
patch -p1 < $PATHNAME/patches/nan.patch
400400
popd >/dev/null
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From facdec6ed7516d3c6273543c480aa00af7a81ad1 Mon Sep 17 00:00:00 2001
2+
From: Chen Li1 <[email protected]>
3+
Date: Thu, 4 Nov 2021 15:41:33 +0800
4+
Subject: [PATCH] Upgrade to node 14
5+
6+
---
7+
erizoAPI/IOThreadPool.cc | 4 ++--
8+
erizoAPI/ThreadPool.cc | 4 ++--
9+
2 files changed, 4 insertions(+), 4 deletions(-)
10+
11+
diff --git a/erizoAPI/IOThreadPool.cc b/erizoAPI/IOThreadPool.cc
12+
index 0144e6b1..41264ad3 100644
13+
--- a/erizoAPI/IOThreadPool.cc
14+
+++ b/erizoAPI/IOThreadPool.cc
15+
@@ -29,7 +29,7 @@ NAN_MODULE_INIT(IOThreadPool::Init) {
16+
Nan::SetPrototypeMethod(tpl, "close", close);
17+
Nan::SetPrototypeMethod(tpl, "start", start);
18+
19+
- constructor.Reset(tpl->GetFunction());
20+
+ constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
21+
Nan::Set(target, Nan::New("IOThreadPool").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked());
22+
}
23+
24+
@@ -38,7 +38,7 @@ NAN_METHOD(IOThreadPool::New) {
25+
Nan::ThrowError("Wrong number of arguments");
26+
}
27+
28+
- unsigned int num_workers = info[0]->IntegerValue();
29+
+ unsigned int num_workers = Nan::To<int32_t>(info[0]).FromJust();
30+
31+
IOThreadPool* obj = new IOThreadPool();
32+
obj->me.reset(new erizo::IOThreadPool(num_workers));
33+
diff --git a/erizoAPI/ThreadPool.cc b/erizoAPI/ThreadPool.cc
34+
index ddfdcfc9..478e2c37 100644
35+
--- a/erizoAPI/ThreadPool.cc
36+
+++ b/erizoAPI/ThreadPool.cc
37+
@@ -29,7 +29,7 @@ NAN_MODULE_INIT(ThreadPool::Init) {
38+
Nan::SetPrototypeMethod(tpl, "close", close);
39+
Nan::SetPrototypeMethod(tpl, "start", start);
40+
41+
- constructor.Reset(tpl->GetFunction());
42+
+ constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
43+
Nan::Set(target, Nan::New("ThreadPool").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked());
44+
}
45+
46+
@@ -38,7 +38,7 @@ NAN_METHOD(ThreadPool::New) {
47+
Nan::ThrowError("Wrong number of arguments");
48+
}
49+
50+
- unsigned int num_workers = info[0]->IntegerValue();
51+
+ unsigned int num_workers = Nan::To<int32_t>(info[0]).FromJust();
52+
53+
ThreadPool* obj = new ThreadPool();
54+
obj->me.reset(new erizo::ThreadPool(num_workers));
55+
--
56+
2.17.1
57+

scripts/release/install_node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ get_nvm_node() {
1919
${SUDO} apt-get update
2020
${SUDO} apt-get install wget -y
2121
fi
22-
local VERSION="v10.21.0"
22+
local VERSION="v14.18.1"
2323
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
2424
. ~/.nvm/nvm.sh
2525
nvm install ${VERSION}

scripts/release/package.mcu.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"version":"5.0.0",
44
"description": "Intel CS for WebRTC Conference Server",
55
"engine": {
6-
"node": "10.21.0"
6+
"node": "14.18.1"
77
}
88
}

source/agent/addons/quic/QuicTransportServer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ NAN_METHOD(QuicTransportServer::newInstance)
5252
if (info.Length() < 3) {
5353
return Nan::ThrowTypeError("No enough arguments are provided.");
5454
}
55-
int port = info[0]->IntegerValue();
56-
v8::String::Utf8Value pfxPath(Nan::To<v8::String>(info[1]).ToLocalChecked());
57-
v8::String::Utf8Value password(Nan::To<v8::String>(info[2]).ToLocalChecked());
55+
int port = Nan::To<int32_t>(info[0]).FromJust();
56+
Nan::Utf8String pfxPath(Nan::To<v8::String>(info[1]).ToLocalChecked());
57+
Nan::Utf8String password(Nan::To<v8::String>(info[2]).ToLocalChecked());
5858
QuicTransportServer* obj = new QuicTransportServer(port, *pfxPath, *password);
5959
owt_base::Utils::ZeroMemory(*password, password.length());
6060
obj->Wrap(info.This());

source/agent/addons/quic/QuicTransportStream.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ NAN_METHOD(QuicTransportStream::write)
153153
return;
154154
}
155155
QuicTransportStream* obj = Nan::ObjectWrap::Unwrap<QuicTransportStream>(info.Holder());
156-
uint8_t* buffer = (uint8_t*)node::Buffer::Data(info[0]->ToObject());
157-
unsigned int length = info[1]->Uint32Value();
156+
uint8_t* buffer = (uint8_t*)node::Buffer::Data(
157+
Nan::To<v8::Object>(info[0]).ToLocalChecked());
158+
unsigned int length = Nan::To<uint32_t>(info[1]).FromJust();
158159
auto written = obj->m_stream->Write(buffer, length);
159160
info.GetReturnValue().Set(Nan::New(static_cast<int>(written)));
160161
}
@@ -176,15 +177,16 @@ NAN_METHOD(QuicTransportStream::addDestination)
176177
std::string track = std::string(*param0);
177178
bool isNanDestination(false);
178179
if (info.Length() == 3) {
179-
isNanDestination = info[2]->ToBoolean(Nan::GetCurrentContext()).ToLocalChecked()->Value();
180+
isNanDestination = Nan::To<bool>(info[2]).FromJust();
180181
}
181182
owt_base::FrameDestination* dest(nullptr);
182183
if (isNanDestination) {
183-
NanFrameNode* param = Nan::ObjectWrap::Unwrap<NanFrameNode>(info[1]->ToObject());
184+
NanFrameNode* param = Nan::ObjectWrap::Unwrap<NanFrameNode>(
185+
Nan::To<v8::Object>(info[1]).ToLocalChecked());
184186
dest = param->FrameDestination();
185187
} else {
186188
::FrameDestination* param = node::ObjectWrap::Unwrap<::FrameDestination>(
187-
info[1]->ToObject(Nan::GetCurrentContext()).ToLocalChecked());
189+
Nan::To<v8::Object>(info[1]).ToLocalChecked());
188190
dest = param->dest;
189191
}
190192
if (track == "audio") {

source/agent/addons/quic/WebTransportFrameSource.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ NAN_METHOD(WebTransportFrameSource::newInstance)
5454
NAN_METHOD(WebTransportFrameSource::addInputStream)
5555
{
5656
WebTransportFrameSource* obj = Nan::ObjectWrap::Unwrap<WebTransportFrameSource>(info.Holder());
57-
NanFrameNode* inputStream = Nan::ObjectWrap::Unwrap<NanFrameNode>(info[0]->ToObject());
57+
NanFrameNode* inputStream = Nan::ObjectWrap::Unwrap<NanFrameNode>(
58+
Nan::To<v8::Object>(info[0]).ToLocalChecked());
5859
inputStream->FrameSource()->addDataDestination(obj);
5960
inputStream->FrameSource()->addAudioDestination(obj);
6061
inputStream->FrameSource()->addVideoDestination(obj);
@@ -71,15 +72,16 @@ NAN_METHOD(WebTransportFrameSource::addDestination)
7172
std::string track = std::string(*param0);
7273
bool isNanDestination(false);
7374
if (info.Length() == 3) {
74-
isNanDestination = info[2]->ToBoolean(Nan::GetCurrentContext()).ToLocalChecked()->Value();
75+
isNanDestination = Nan::To<bool>(info[2]).FromJust();
7576
}
7677
owt_base::FrameDestination* dest(nullptr);
7778
if (isNanDestination) {
78-
NanFrameNode* param = Nan::ObjectWrap::Unwrap<NanFrameNode>(info[1]->ToObject());
79+
NanFrameNode* param = Nan::ObjectWrap::Unwrap<NanFrameNode>(
80+
Nan::To<v8::Object>(info[1]).ToLocalChecked());
7981
dest = param->FrameDestination();
8082
} else {
8183
::FrameDestination* param = node::ObjectWrap::Unwrap<::FrameDestination>(
82-
info[1]->ToObject(Nan::GetCurrentContext()).ToLocalChecked());
84+
Nan::To<v8::Object>(info[1]).ToLocalChecked());
8385
dest = param->dest;
8486
}
8587
obj->addAudioDestination(dest);

source/agent/addons/quic/test/package.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,5 @@
1010
"chai-as-promised": "^7.1.1",
1111
"mocha": "^7.1.1",
1212
"node-gyp": "*"
13-
},
14-
"engine": {
15-
"node": "8.15.0"
16-
},
17-
"bin": "index.js",
18-
"pkg": {
19-
"assets": [
20-
"node_modules*"
21-
],
22-
"targets": [
23-
"node8"
24-
]
2513
}
2614
}

source/agent/analytics/package.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,5 @@
99
},
1010
"devDependencies": {
1111
"node-gyp": "*"
12-
},
13-
"engine": {
14-
"node": "8.15.0"
15-
},
16-
"bin": "index.js",
17-
"pkg": {
18-
"assets": [
19-
"node_modules*"
20-
],
21-
"targets": [
22-
"node8"
23-
]
2412
}
2513
}

0 commit comments

Comments
 (0)