Skip to content

Commit

Permalink
refactor: Use stable Node-API instead of nan
Browse files Browse the repository at this point in the history
the Node-API is binary stable and compatible between node 10+ and
electron 3+.
  • Loading branch information
csett86 committed Nov 15, 2021
1 parent 8ae87a9 commit 4470679
Show file tree
Hide file tree
Showing 6 changed files with 310 additions and 235 deletions.
20 changes: 11 additions & 9 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
'targets': [{
'target_name': 'robotjs',
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
},
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
},
'include_dirs': [
"<!(node -e \"require('nan')\")"
],

'cflags': [
'-Wall',
'-Wparentheses',
'-Winline',
'-Wbad-function-cast',
'-Wdisabled-optimization'
'<!(node -p "require(\'node-addon-api\').include_dir")',
],

'conditions': [
['OS == "mac"', {
'include_dirs': [
'<!(node -p "require(\'node-addon-api\').include_dir")',
'System/Library/Frameworks/CoreFoundation.Framework/Headers',
'System/Library/Frameworks/Carbon.Framework/Headers',
'System/Library/Frameworks/ApplicationServices.framework/Headers',
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"test:darwin:linux": "jasmine test/**/*.js",
"test-keyboard": "node test/keyboard.js",
"test:win32": "jasmine test/**/*.js",
"install": "prebuild-install || node-gyp rebuild",
"install-debug": "prebuild-install || node-gyp rebuild --debug",
"prebuild": "prebuild --all"
"install": "prebuild-install --runtime napi || node-gyp rebuild",
"install-debug": "prebuild-install --runtime napi || node-gyp rebuild --debug",
"prebuild": "prebuild --all --runtime napi"
},
"repository": {
"type": "git",
Expand All @@ -37,19 +37,24 @@
"author": "Jason Stallings",
"license": "MIT",
"gypfile": true,
"binary": {
"napi_versions": [
3
]
},
"bugs": {
"url": "https://github.com/octalmage/robotjs/issues"
},
"homepage": "https://github.com/octalmage/robotjs",
"dependencies": {
"nan": "^2.14.2",
"node-addon-api": "^4.2.0",
"prebuild-install": "^5.3.3"
},
"devDependencies": {
"tape": "^4.8.0",
"jasmine": "^2.99.0",
"prebuild": "^9.1.1",
"run-script-os": "^1.0.3",
"tape": "^4.8.0",
"targetpractice": "0.0.7"
}
}
Loading

0 comments on commit 4470679

Please sign in to comment.