Skip to content

Commit

Permalink
Add support for Node 12
Browse files Browse the repository at this point in the history
  • Loading branch information
Prior99 committed Feb 10, 2020
1 parent e65fee6 commit 85afaaa
Show file tree
Hide file tree
Showing 6 changed files with 2,335 additions and 2,007 deletions.
89 changes: 34 additions & 55 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,54 @@ language: node_js
compiler: gcc
env:
global:
- NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI=true
- NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI=true
- secure: Gcpp1pwnwTJ/UmTF0VZtex9q8q4asJAoNImXNUbDkBaJMLn3rdHYdiiXErmVcx8924GuDeCcxTH0KS1owVmnaEMbOmhTLlh7ywNPviXkHRpr45TMsnhj0sKuCFNVy4G0GP+Edu6eOEBzCa5vOJ1B2ptj9whi1v1P032GXShzbWKOgtJR1J21EwvnhHjTxdCc39hCbtodqeHjTcczMClP8o50gjMdzAyNRjcMI2MARMIrgMPqbUzPHrcEoE3DBC+i+AWpcLY5iRyXo/RwcJxYjy2hUmSQMzlNmxExO8+cFVo8yQA3QU3qOTNL+c55OoARU+IwpeVsSFXRfhlKWFFCIlP02GoDU9K9CLNOR5Sx5NDkjldGz1KYUMDWTSMhVhH0XqyziM4fKHw+bmbZ2Z9qqZRgnLFunCiaM2L8RC7tzGo/voPsaHZB9SlBWVkPpvuF32IQl9cqYWgbiVOIHvPZ0EdlF9MHBKST8xc7FyFnMtsWkr05SPp7dg1ZCCI/2XbnP49Y4MiWeiQq8rno/OTUEaZCQVJuCqbx4/sBER1aHff6DP2Peu7wGPECcX6lickU9otvtGnMfM1U6Ig3q82mF8UHkcqWel0bB2BHEZMT1sfZI+kV/P7GLylFEfIuKBMAUXCZAWRWyLq1AcmkLM5na0nql43qLhs+EJAJCGxF2vU=
jobs:
include:
- stage: build
node_js: "6"
os: linux
- stage: build
node_js: "7"
os: linux
- stage: build
node_js: "8"
os: linux
- stage: build
node_js: "9"
os: linux
- stage: build
node_js: "10"
os: linux
- stage: build
node_js: "11"
os: linux
- stage: build
node_js: "6"
os: osx
- stage: build
node_js: "7"
os: osx
- stage: build
node_js: "8"
os: osx
- stage: build
node_js: "9"
os: osx
- stage: build
node_js: "10"
os: osx
- stage: build
node_js: "11"
os: osx
- stage: build
node_js: '10'
os: linux
- stage: build
node_js: '11'
os: linux
- stage: build
node_js: '12'
os: linux
- stage: build
node_js: '10'
os: osx
- stage: build
node_js: '11'
os: osx
- stage: build
node_js: '12'
os: osx
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- gcc-7
- g++-7
- make
- git
- gcc-7
- g++-7
- make
- git
before_install:
- npm install -g yarn
- if [ $TRAVIS_OS_NAME == "linux" ]; then
export CC="gcc-7";
export CXX="g++-7";
export LINK="gcc-7";
export LINKXX="g++-7";
fi
- node --version
- yarn --version
- npm install -g yarn
- if [ $TRAVIS_OS_NAME == "linux" ]; then export CC="gcc-7"; export CXX="g++-7"; export
LINK="gcc-7"; export LINKXX="g++-7"; fi
- node --version
- yarn --version
script:
- make
- make
after_script:
- "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
- cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
cache: yarn
deploy:
provider: releases
api_key:
secure: "K/B2fhueAOvTx71V26l1TtUYFr/FXKyb50CgNjRw+VboU/j4GoByQzJCrmyeIFvxs+u+Id4bPCNtkr/kpsK7o9m249nkmlYd3p3OoYzMLTCELvzMuCUFq7Rqzxjo+bZYvA7AS7gqsAh0CfdLlb33ahsF5NU/6ye3kTZka9n3CujMDZm/L8pGwhFuzkodE8dNQT2Qtiu1/LvffK8zCLt47+qnNSKbIah9S961UF0DPWuO7xte0QxPLPKQVlEvpEcVJHb+nIwPGzaQnj4AkA951mMhIf1Xg22u0es//zHkTHuLG908nAiHrbe8smYdgy/IkiIK1JOBrNMI/Cy9NgXFUWlTSyTdcOc61VCP/js3sIPBoc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tags: true
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ This is a native Addon to NodeJS which delivers prebuilt binaries. Only some env
| Node Version | Windows 64-Bit | Windows 32-Bit | Linux 64-Bit | Linux 32-Bit | OSX |
|--------------------|--------------------|--------------------|--------------------|--------------|--------------------|
| Earlier ||||||
| Node 6 *(Abi 48)* ||||||
| Node 7 *(Abi 51)* ||||||
| Node 8 *(Abi 57)* ||||||
| Node 9 *(Abi 59)* ||||||
| Node 10 *(Abi 64)* ||||||
| Node 11 *(Abi 67)* ||||||
| Node 12 *(Abi 72)* ||||||

## Usage

Expand Down
26 changes: 7 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,15 @@
environment:
NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI: true
matrix:
- nodejs_version: 6
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 7
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 8
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 9
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 10
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 11
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 12
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
install:
- git submodule update --init --recursive
- ps: Install-Product node $env:nodejs_version $env:platform
Expand All @@ -63,7 +54,7 @@
- provider: GitHub
artifact: native-image-diff
auth_token:
secure: Htgsldchc4IoQuPj7BS3OPPEitbBCEDHPJbkukIgHMhEU23J2wHJdFxHl2K8Pu0W
secure: bfQKa+eRJfn0xsBUu2bo+OeY7eEdfOlrkJBImk2GY22aLeS512AA3VoC1f4JA2I8
draft: false
prerelease: false
on:
Expand Down Expand Up @@ -93,16 +84,13 @@
environment:
NATIVE_IMAGE_DIFF_SKIP_BINARY_DOWNLOAD_FOR_CI: true
matrix:
- nodejs_version: 6
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 8
- nodejs_version: 10
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 9
- nodejs_version: 11
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- nodejs_version: 10
- nodejs_version: 12
GYP_MSVS_VERSION: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
install:
Expand Down
16 changes: 8 additions & 8 deletions native/image-diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ NAN_METHOD(imageDiff) {
auto firstLength = Buffer::Length(firstBuffer);
auto *firstData = reinterpret_cast<uint8_t*>(Buffer::Data(firstBuffer));
// 2nd Parameter: The first image's width.
const auto firstWidth = static_cast<uint32_t>(info[1]->NumberValue());
const auto firstWidth = static_cast<uint32_t>(Nan::To<uint32_t>(info[1]).ToChecked());
// 3rd Parameter: The first image's height.
const auto firstHeight = static_cast<uint32_t>(info[2]->NumberValue());
const auto firstHeight = static_cast<uint32_t>(Nan::To<uint32_t>(info[2]).ToChecked());
// 4th Parameter: The second image's buffer.
Local<Object> secondBuffer = Local<Object>::Cast(info[3]);
auto secondLength = Buffer::Length(secondBuffer);
auto *secondData = reinterpret_cast<uint8_t*>(Buffer::Data(secondBuffer));
// 5th Parameter: The second image's width.
const auto secondWidth = static_cast<uint32_t>(info[4]->NumberValue());
const auto secondWidth = static_cast<uint32_t>(Nan::To<uint32_t>(info[4]).ToChecked());
// 6th Parameter: The second image's height.
const auto secondHeight = static_cast<uint32_t>(info[5]->NumberValue());
const auto secondHeight = static_cast<uint32_t>(Nan::To<uint32_t>(info[5]).ToChecked());
// 7th Parameter: The color threshold per pixel.
const auto colorThreshold = static_cast<float>(info[6]->NumberValue());
const auto colorThreshold = static_cast<float>(Nan::To<double>(info[6]).ToChecked());
// 8th Parameter: Whether to check for antialiasing.
const auto checkAntialiasing = static_cast<bool>(info[7]->BooleanValue());
const auto checkAntialiasing = static_cast<bool>(Nan::To<bool>(info[7]).ToChecked());
// 9th Parameter: Whether to generate an output image.
const auto generateDiffImage = static_cast<bool>(info[8]->BooleanValue());
const auto generateDiffImage = static_cast<bool>(Nan::To<bool>(info[8]).ToChecked());
// Computed values.
const uint32_t firstBytesPerPixel = firstLength / (firstWidth * firstHeight);
const uint32_t secondBytesPerPixel = secondLength / (secondWidth * secondHeight);
Expand Down Expand Up @@ -125,5 +125,5 @@ NAN_METHOD(imageDiff) {
}

NAN_MODULE_INIT(InitImageDiff) {
target->Set(Nan::New("__native_imageDiff").ToLocalChecked(), Nan::New<FunctionTemplate>(imageDiff)->GetFunction());
target->Set(Nan::New("__native_imageDiff").ToLocalChecked(), Nan::GetFunction(Nan::New<FunctionTemplate>(imageDiff)).ToLocalChecked());
}
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"comparison",
"visual"
],
"version": "0.1.8",
"version": "0.1.9",
"description": "A simple library for comparing two images using a native C++ binding.",
"main": "dist/index.js",
"author": "Frederick Gnodtke",
Expand Down Expand Up @@ -61,27 +61,26 @@
"node_modules",
"src"
],
"mapCoverage": true,
"coverageReporters": [
"text",
"lcov"
]
},
"devDependencies": {
"@types/jest": "^21.1.7",
"@types/node": "^9.6.2",
"coveralls": "^3.0.0",
"cross-env": "^5.1.4",
"jest": "^21.2.1",
"nan": "^2.10.0",
"node-gyp": "^3.6.2",
"node-libpng": "^0.2.7",
"ts-jest": "^21.2.3",
"tslint": "^5.8.0",
"typedoc": "^0.11.1",
"typescript": "^2.6.1"
"@types/jest": "^25.1.2",
"@types/node": "^13.7.0",
"coveralls": "^3.0.9",
"cross-env": "^7.0.0",
"jest": "^25.1.0",
"nan": "^2.14.0",
"node-gyp": "^6.1.0",
"node-libpng": "^0.2.13",
"ts-jest": "^25.2.0",
"tslint": "^6.0.0",
"typedoc": "^0.16.9",
"typescript": "^3.7.5"
},
"dependencies": {
"request": "^2.85.0"
"request": "^2.88.0"
}
}
Loading

0 comments on commit 85afaaa

Please sign in to comment.