Skip to content

Commit

Permalink
GH-36025: [JS] Allow Node.js 18.14 or later in `verify-release-candid…
Browse files Browse the repository at this point in the history
…ate.sh` (#36089)

### Rationale for this change

In Node.js 18.14 or later, `gulp bundle:webpack` succeeds.
So we support running `verify-release-candidate.sh` with Node.js 18.14 or later.

### What changes are included in this PR?

Node.js version check allows 16, 18.14 or later.
Install Node.js LTS with `nvm`.

### Are these changes tested?

I have tested that `TEST_DEFAULT=0 TEST_JS=1 dev/release/verify-release-candidate.sh` succeeds in several environments.

* Node.js is not installed
    * v18.16.0 installed with `nvm` and `verify-release-candidate.sh` succeeded.
* Node.js 16.x installed
    *  Node.js 16.x is used and `verify-release-candidate.sh` succeeded.
* Node.js 18.13.0 installed
    * v18.16.0 installed  with `nvm` and `verify-release-candidate.sh` succeeded.
* Node.js 18.14.0 installed
    *  Node.js 18.14.0 is used and `verify-release-candidate.sh` succeeded.
* Node.js 20.x installed
    *  Node.js 20.x is used and `verify-release-candidate.sh` succeeded.

### Are there any user-facing changes?

* Closes: #36025

Authored-by: abetomo <abe@enzou.tokyo>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
abetomo committed Jun 15, 2023
1 parent 99dd998 commit 28884b2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,21 +315,21 @@ install_nodejs() {
return 0
fi

required_node_major_version=16
node_major_version=$(node --version 2>&1 | grep -o '^v[0-9]*' | sed -e 's/^v//g' || :)

if [ -n "${node_major_version}" ] && [ "${node_major_version}" -ge ${required_node_major_version} ]; then
show_info "Found NodeJS installation with major version ${node_major_version}"
node_minor_version=$(node --version 2>&1 | grep -o '^v[0-9]*\.[0-9]*' | sed -e 's/^v[0-9]*\.//g' || :)
if [[ -n "${node_major_version}" && -n "${node_minor_version}" &&
("${node_major_version}" -eq 16 ||
("${node_major_version}" -eq 18 && "${node_minor_version}" -ge 14) ||
"${node_major_version}" -ge 20) ]]; then
show_info "Found NodeJS installation with version v${node_major_version}.${node_minor_version}.x"
else
export NVM_DIR="`pwd`/.nvm"
export NVM_DIR="$(pwd)/.nvm"
mkdir -p $NVM_DIR
curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | \
curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | \
PROFILE=/dev/null bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# ARROW-18335: "gulp bundle" failed with Node.js 18.
# nvm install --lts
nvm install 16
nvm install --lts
show_info "Installed NodeJS $(node --version)"
fi

Expand Down Expand Up @@ -837,7 +837,7 @@ test_js() {
show_header "Build and test JavaScript libraries"

maybe_setup_nodejs || exit 1
maybe_setup_conda nodejs=16 || exit 1
maybe_setup_conda nodejs=18 || exit 1

if ! command -v yarn &> /dev/null; then
npm install yarn
Expand Down

0 comments on commit 28884b2

Please sign in to comment.