Skip to content

Commit

Permalink
Added support for Node.js 21.
Browse files Browse the repository at this point in the history
CLIENT-2751
Added support for Node.js 21.
  • Loading branch information
DomPeliniAerospike committed Jan 13, 2024
1 parent 55ad64d commit 49e2e22
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ All notable changes to this project will be documented in this file.

* **New Features**
* [CLIENT-2672] - Added support for MacOS 14.
* [CLIENT-2751] - Added support for Node.js 21.

* **Bug Fixes**
* [CLIENT-2599] - Added documentation to avoid build issues on Windows with Python 3.12.
* [CLIENT-2709] - The C Client submodule now marks node’s partitions for retry on the next scan/query page when a node returns records records that are discarded due to exceeding maxRecords.
* [CLIENT-2709] - The C Client submodule now marks node’s partitions for retry on the next scan/query page when a node returns records that are discarded due to exceeding maxRecords.
* [CLIENT-2749] - Added missing BOOL enumeration to Aerospike.exp.type. In scan/query with maxRecords set, mark node's partitions for retry on next scan/query page when that node returns records that are discarded due to exceeding maxRecords.
* [CLIENT-2750] - Changed npm-run-all from a dev-dependency to a dependency.

Expand Down
12 changes: 11 additions & 1 deletion README_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ PowerShell's execution policy prevents you from running the client's installatio

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process

For further information, please refer to the PowerShell documentation [About Execution Policies](https://docs.microsoft.com/en-sg/powershell/module/microsoft.powershell.core/about/about_execution_policies).
For further information, please refer to the PowerShell documentation [About Execution Policies](https://docs.microsoft.com/en-sg/powershell/module/microsoft.powershell.core/about/about_execution_policies).

#### Distutils has been removed from Python 3.12, which causes my node-gyp build to fail. How can I fix this?

Since Distutils is no longer include in Python after 3.12, it is necessary to install them yourself if using Python 3.12 or above.

The following command should allow you to build with Python 3.12:

python3 -m pip install packaging

For more information on this topic, see [here.](https://github.com/nodejs/node-gyp/issues/2869)
7 changes: 7 additions & 0 deletions scripts/build-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.pdb
Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.ipdb
Remove-Item .\lib\binding\node-v115-win32-x64\aerospike.iobj

build_nodejs_client v21
Copy-Item -Recurse build\release\* lib\binding\node-v120-win32-x64
Remove-Item -Recurse .\lib\binding\node-v120-win32-x64\obj
Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.pdb
Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.ipdb
Remove-Item .\lib\binding\node-v120-win32-x64\aerospike.iobj

nvm use v18.12.1
1 change: 1 addition & 0 deletions scripts/build-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ rm -rf ${AEROSPIKE_NODEJS_RELEASE_HOME}/node-*-${OS_FLAVOR}-*

build_nodejs_client v18
build_nodejs_client v20
build_nodejs_client v21

nvm use v20

Expand Down
14 changes: 11 additions & 3 deletions scripts/prebuiltBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,48 @@ const rm = util.promisify(fs.rm)
const arch = await os.arch()

if (platform === 'darwin') {
rm('lib/binding/node-v120-win32-x64', { recursive: true, force: true })
rm('lib/binding/node-v115-win32-x64', { recursive: true, force: true })
rm('lib/binding/node-v108-win32-x64', { recursive: true, force: true })
if (arch === 'x64') {
rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
} else {
rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })
}
await rm('lib/binding/openssl@3', { recursive: true, force: true })
await rm('lib/binding/openssl@1', { recursive: true, force: true })
} else if (platform === 'win32') {
rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })
await rm('lib/binding/openssl@3', { recursive: true, force: true })
await rm('lib/binding/openssl@1', { recursive: true, force: true })
} else {
rm('lib/binding/node-v120-win32-x64', { recursive: true, force: true })
rm('lib/binding/node-v115-win32-x64', { recursive: true, force: true })
rm('lib/binding/node-v108-win32-x64', { recursive: true, force: true })
rm('lib/binding/node-v120-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-arm64', { recursive: true, force: true })
rm('lib/binding/node-v120-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v115-darwin-x64', { recursive: true, force: true })
rm('lib/binding/node-v108-darwin-x64', { recursive: true, force: true })

const output = await exec('openssl version')
const version = output.stdout
const openssl = version.split(' ')[1].slice(0, 1)
const openssl = process.versions.openssl.at(0)

if (arch === 'x64') {
await rename('lib/binding/openssl@' + openssl + '/node-v120-linux-x64', 'lib/binding/node-v120-linux-x64')
await rename('lib/binding/openssl@' + openssl + '/node-v115-linux-x64', 'lib/binding/node-v115-linux-x64')
await rename('lib/binding/openssl@' + openssl + '/node-v108-linux-x64', 'lib/binding/node-v108-linux-x64')
} else {
await rename('lib/binding/openssl@' + openssl + '/node-v120-linux-arm64', 'lib/binding/node-v120-linux-arm64')
await rename('lib/binding/openssl@' + openssl + '/node-v115-linux-arm64', 'lib/binding/node-v115-linux-arm64')
await rename('lib/binding/openssl@' + openssl + '/node-v108-linux-arm64', 'lib/binding/node-v108-linux-arm64')
}
Expand Down

0 comments on commit 49e2e22

Please sign in to comment.