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

Update Node.js to version 20.x #672

Open
wants to merge 4 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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ FROM ubuntu:22.04 as production
ARG TIMEZONE=UTC

### UPDATE ###
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
RUN apt update

### INSTALL APT-GET LIBS ###
Expand Down Expand Up @@ -68,4 +68,4 @@ RUN mv wptagent.py wptagent_starter.py
COPY wptagent_debug.py wptagent.py

### SETTING PRODUCTION BUILD AS DEFAULT ###
FROM production
FROM production
2 changes: 1 addition & 1 deletion centos_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ until python3 -m pip install --user -r .github/workflows/requirements.txt
do
sleep 1
done
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
curl --silent --location https://rpm.nodesource.com/setup_20.x | sudo bash -
until sudo yum -y install nodejs
do
sleep 1
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ wptagent currently supports Windows, Linux and OSX for desktop browsers as well
## For lighthouse testing
* NodeJS
* Ubuntu/Debian:
* ```curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -```
* ```curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -```
* ```sudo apt-get install -y nodejs```
* The lighthouse npm module
* ```sudo npm install -g lighthouse```
Expand Down
2 changes: 1 addition & 1 deletion ubuntu_install.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ do
done

# Prepare Node for install
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -

# Install all of the binary dependencies
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
Expand Down
12 changes: 6 additions & 6 deletions wptagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,16 @@ def startup(self, detected_browsers):
except Exception:
pass

# Check for Node 16+
if self.get_node_version() < 16.0:
# Check for Node 18+
if self.get_node_version() < 18.0:
if platform.system() == "Linux":
# This only works on debian-based systems
logging.debug('Updating Node.js to 16.x')
logging.debug('Updating Node.js to 20.x')
subprocess.call('sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates', shell=True)
subprocess.call('curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -', shell=True)
subprocess.call('curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -', shell=True)
subprocess.call(['sudo', 'apt-get', 'install', '-y', 'nodejs'])
if self.get_node_version() < 16.0:
logging.warning("Node.js 16 or newer is required for Lighthouse testing")
if self.get_node_version() < 18.0:
logging.warning("Node.js 18 or newer is required for Lighthouse testing")

# Force lighthouse 11.4.0
if self.get_lighthouse_version() != '11.4.0':
Expand Down