Skip to content

Commit

Permalink
feat: support node-pre-gyp
Browse files Browse the repository at this point in the history
PR-URL: #43
  • Loading branch information
hyj1991 authored May 21, 2022
1 parent f2081ab commit 1b91cce
Show file tree
Hide file tree
Showing 21 changed files with 662 additions and 306 deletions.
30 changes: 30 additions & 0 deletions .autod.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

module.exports = {
write: true,
prefix: '^',
test: [
'test',
],
dep: [
'nan',
'@xprofiler/node-pre-gyp',
],
devdep: [
'autod',
'chai',
'clang-format',
'eslint',
'mocha',
],
exclude: [
'./build',
'./scripts',
'./test/fixtures',
'./demo.js',
'./lib/worker_threads.js'
],
semver: [
'mocha@5'
]
};
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.debug.js
*.min.js
node_modules/*
91 changes: 91 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
],
"strict": [
2,
"global"
],
"curly": 2,
"eqeqeq": 2,
"no-eval": 2,
"guard-for-in": 2,
"no-caller": 2,
"no-else-return": 2,
"no-eq-null": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-labels": 2,
"no-with": 2,
"no-loop-func": 1,
"no-native-reassign": 2,
"no-redeclare": [
2,
{
"builtinGlobals": true
}
],
"no-delete-var": 2,
"no-shadow-restricted-names": 2,
"no-undef-init": 2,
"no-use-before-define": 2,
"no-unused-vars": [
2,
{
"args": "none"
}
],
"no-undef": 2,
"callback-return": [
2,
[
"callback",
"cb",
"next"
]
],
"global-require": 0,
"no-console": 0,
"require-yield": 0,
"no-constant-condition": 1,
"max-len": [
"error",
{
"code": 120
}
]
},
"env": {
"es6": true,
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "script",
"ecmaFeatures": {
"jsx": true
}
},
"extends": "eslint:recommended"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ tmp
*.heapprofile
demo.js
*.log
config.gypi
release
37 changes: 33 additions & 4 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
'includes': [
'config.gypi'
],

'variables': {
'action_after_build': 'false'
},

'targets': [
{
'target_name': 'profiler',
Expand All @@ -17,8 +25,8 @@
'src/environment_data.cc'
],
'include_dirs' : [
"src",
"<!(node -e \"require('nan')\")"
'src',
'<!(node -e "require(\'nan\')")'
],
'conditions':[
['OS == "linux"', {
Expand All @@ -35,6 +43,27 @@
}
}],
]
}
]
},
],

'conditions': [
[
'action_after_build == "true"',
{
'targets': [
{
'target_name': 'action_after_build',
'type': 'none',
'dependencies': ['<(module_name)'],
'copies': [
{
'files': ['<(PRODUCT_DIR)/<(module_name).node'],
'destination': '<(module_path)'
}
]
},
]
}
]
],
}
Loading

0 comments on commit 1b91cce

Please sign in to comment.