From 6d7a5ace6b0c910d2ad087dc0db8b786fb47b3a5 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 10 Jun 2021 20:19:39 +0100 Subject: [PATCH] Drop support for Node.js 10, upgrade to Node-API v5 --- .github/workflows/ci.yml | 19 +++++-------------- .travis.yml | 29 ++--------------------------- README.md | 2 +- appveyor.yml | 5 ++--- binding.gyp | 8 +++++--- docs/changelog.md | 4 +++- package.json | 14 +++++++------- 7 files changed, 25 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d119bfa1..6db02916 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,43 +11,34 @@ jobs: include: - os: ubuntu-20.04 container: centos:7 - nodejs_version: 10 + nodejs_version: 12 coverage: true prebuild: true - - os: ubuntu-20.04 - container: centos:7 - nodejs_version: 12 - os: ubuntu-20.04 container: centos:7 nodejs_version: 14 - os: ubuntu-20.04 container: centos:7 nodejs_version: 16 - - os: ubuntu-20.04 - container: node:10-alpine3.11 - prebuild: true - os: ubuntu-20.04 container: node:12-alpine3.11 + prebuild: true - os: ubuntu-20.04 container: node:14-alpine3.11 - os: ubuntu-20.04 container: node:14-alpine3.13 - os: ubuntu-20.04 container: node:16-alpine3.11 - - os: macos-10.15 - nodejs_version: 10 - prebuild: true - os: macos-10.15 nodejs_version: 12 + prebuild: true - os: macos-10.15 nodejs_version: 14 - os: macos-10.15 nodejs_version: 16 - - os: windows-2019 - nodejs_version: 10 - prebuild: true - os: windows-2019 nodejs_version: 12 + prebuild: true - os: windows-2019 nodejs_version: 14 - os: windows-2019 @@ -86,4 +77,4 @@ jobs: if: matrix.prebuild && startsWith(github.ref, 'refs/tags/') env: prebuild_upload: ${{ secrets.GITHUB_TOKEN }} - run: npx prebuild --runtime napi --target 3 + run: npx prebuild --runtime napi --target 5 diff --git a/.travis.yml b/.travis.yml index b2d74d58..10976582 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,5 @@ jobs: include: - - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 10" - arch: arm64 - os: linux - dist: bionic - language: shell - before_install: - - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp arm64v8/debian:bullseye - - sudo docker exec sharp sh -c "apt-get update && apt-get install -y build-essential git python3 curl" - - sudo docker exec sharp sh -c "curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -" - - sudo docker exec sharp sh -c "echo 'deb https://deb.nodesource.com/node_10.x sid main' >/etc/apt/sources.list.d/nodesource.list" - - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs=10.*" - install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm" - script: sudo docker exec sharp sh -c "npm test" - after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 3\"" - - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 12" arch: arm64 os: linux @@ -28,6 +13,7 @@ jobs: - sudo docker exec sharp sh -c "apt-get update && apt-get install -y nodejs" install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm" script: sudo docker exec sharp sh -c "npm test" + after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 5\"" - name: "Linux ARM64v8 (Debian 11, glibc 2.29) - Node.js 14" arch: arm64 @@ -58,18 +44,6 @@ jobs: install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm" script: sudo docker exec sharp sh -c "npm test" - - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 10" - arch: arm64 - os: linux - dist: focal - language: shell - before_install: - - sudo docker run -dit --name sharp --volume "${PWD}:/mnt/sharp" --workdir /mnt/sharp node:10-alpine3.11 - - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache" - install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm" - script: sudo docker exec sharp sh -c "npm test" - after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 3\"" - - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 12" arch: arm64 os: linux @@ -80,6 +54,7 @@ jobs: - sudo docker exec sharp sh -c "apk add build-base git python3 --update-cache" install: sudo docker exec sharp sh -c "npm install --build-from-source --unsafe-perm" script: sudo docker exec sharp sh -c "npm test" + after_success: "[[ -n $TRAVIS_TAG ]] && sudo docker exec --env prebuild_upload sharp sh -c \"npx prebuild --runtime napi --target 5\"" - name: "Linux ARM64v8 (Alpine 3.11, musl 1.1.24) - Node.js 14" arch: arm64 diff --git a/README.md b/README.md index 22d73586..facdb6c8 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ A [guide for contributors](https://github.com/lovell/sharp/blob/master/.github/C covers reporting bugs, requesting features and submitting code changes. [![Test Coverage](https://coveralls.io/repos/lovell/sharp/badge.svg?branch=master)](https://coveralls.io/r/lovell/sharp?branch=master) -[![N-API v3](https://img.shields.io/badge/N--API-v3-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix) +[![Node-API v5](https://img.shields.io/badge/Node--API-v5-green.svg)](https://nodejs.org/dist/latest/docs/api/n-api.html#n_api_n_api_version_matrix) ## Licensing diff --git a/appveyor.yml b/appveyor.yml index cc9202f7..793ad35f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,9 +4,8 @@ build: off platform: x86 environment: matrix: - - nodejs_version: "10" - prebuild: true - nodejs_version: "12" + prebuild: true - nodejs_version: "14" - nodejs_version: "16" install: @@ -15,4 +14,4 @@ install: test_script: - npm test on_success: - - if [%prebuild%] == [true] if [%APPVEYOR_REPO_TAG%] == [true] npx prebuild --runtime napi --target 3 + - if [%prebuild%] == [true] if [%APPVEYOR_REPO_TAG%] == [true] npx prebuild --runtime napi --target 5 diff --git a/binding.gyp b/binding.gyp index b3443dc6..20f94f91 100644 --- a/binding.gyp +++ b/binding.gyp @@ -37,6 +37,7 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'ExceptionHandling': 1, + 'Optimization': 1, 'WholeProgramOptimization': 'true' }, 'VCLibrarianTool': { @@ -67,7 +68,7 @@ }, { 'target_name': 'sharp', 'defines': [ - 'NAPI_VERSION=3' + 'NAPI_VERSION=5' ], 'dependencies': [ '= 12.13.0. + ## v0.28 - *bijou* Requires libvips v8.10.6 diff --git a/package.json b/package.json index 47a74ac1..41fc5213 100644 --- a/package.json +++ b/package.json @@ -123,8 +123,8 @@ "dependencies": { "color": "^3.1.3", "detect-libc": "^1.0.3", - "node-addon-api": "^3.2.0", - "prebuild-install": "^6.1.2", + "node-addon-api": "^3.2.1", + "prebuild-install": "^6.1.3", "semver": "^7.3.5", "simple-get": "^3.1.0", "tar-fs": "^2.1.1", @@ -138,8 +138,8 @@ "exif-reader": "^1.0.3", "icc": "^2.0.0", "license-checker": "^25.0.1", - "mocha": "^8.4.0", - "mock-fs": "^4.14.0", + "mocha": "^9.0.0", + "mock-fs": "^5.0.0", "nyc": "^15.1.0", "prebuild": "^10.0.1", "rimraf": "^3.0.2", @@ -149,17 +149,17 @@ "config": { "libvips": "8.11.0-rc1", "runtime": "napi", - "target": 3 + "target": 5 }, "engines": { - "node": ">=10" + "node": ">=12.13.0" }, "funding": { "url": "https://opencollective.com/libvips" }, "binary": { "napi_versions": [ - 3 + 5 ] }, "semistandard": {