-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for rebuilding scoped native modules
- Loading branch information
1 parent
64aea85
commit d84d91e
Showing
8 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "native-app", | ||
"productName": "Native App", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"start": "electron-forge start" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"config": { | ||
"forge": "./forge.config.js" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.10", | ||
"@scoped/native-addon": "1.2.3", | ||
"ffi-napi": "2.4.5" | ||
}, | ||
"dependencies": { | ||
"@newrelic/native-metrics": "5.3.0", | ||
"farmhash": "3.2.1", | ||
"level": "6.0.0", | ||
"native-hello-world": "2.0.0", | ||
"ref-napi": "1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "hello", | ||
"sources": [ "hello.c" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <assert.h> | ||
#include <node_api.h> | ||
|
||
static napi_value Method(napi_env env, napi_callback_info info) { | ||
napi_status status; | ||
napi_value world; | ||
status = napi_create_string_utf8(env, "world", 5, &world); | ||
assert(status == napi_ok); | ||
return world; | ||
} | ||
|
||
#define DECLARE_NAPI_METHOD(name, func) \ | ||
{ name, 0, func, 0, 0, 0, napi_default, 0 } | ||
|
||
static napi_value Init(napi_env env, napi_value exports) { | ||
napi_status status; | ||
napi_property_descriptor desc = DECLARE_NAPI_METHOD("hello", Method); | ||
status = napi_define_properties(env, exports, 1, &desc); | ||
assert(status == napi_ok); | ||
return exports; | ||
} | ||
|
||
NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const addon = require('./build/Release/hello.node'); | ||
console.log(addon.hello()); // 'world' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"name": "@scoped/native-addon", | ||
"version": "1.2.3", | ||
"main": "index.js", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"workspaces": [ | ||
"native-addon", | ||
"app" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters