-
-
Notifications
You must be signed in to change notification settings - Fork 601
add CI and fix current build issue #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
34f8df1
bb05c28
9ab21e8
6d68d1a
d962031
2802418
80dd772
c2d7625
f642612
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| build/ | ||
| node_modules/ | ||
| Debug/ | ||
| Release/ | ||
| *.lock | ||
| *.log | ||
| npm-debug.log* | ||
|
|
||
| .idea/ | ||
| .vscode/ | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| language: node_js | ||
| node_js: | ||
| - "8" | ||
| - "10" | ||
| # - "12" enable this when fix issue on Node.js 12 | ||
| cache: | ||
| npm | ||
| before_script: | ||
| - npx envinfo | ||
| script: | ||
| - npm install | ||
| - npm test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "node-addon-examples", | ||
| "version": "1.0.0", | ||
| "description": "Node.js Addon Examples", | ||
| "main": "test_all.js", | ||
| "scripts": { | ||
| "test": "node test_all.js" | ||
| }, | ||
| "dependencies": { | ||
| "chalk": "^2.4.2", | ||
| "semver": "^6.3.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| const fs = require('fs') | ||
| const path = require('path') | ||
| const { execSync } = require('child_process') | ||
| const chalk = require('chalk') | ||
| const semver = require('semver') | ||
|
|
||
| const excludeFolder = ['node_modules'] | ||
|
|
||
| function getAllTests() { | ||
| return fs | ||
| .readdirSync('./') | ||
| .filter(i => { | ||
| return ( | ||
| !i.startsWith('.') && | ||
| fs.statSync(i).isDirectory() && | ||
| !excludeFolder.includes(i) | ||
| ) | ||
| }) | ||
| .map(i => { | ||
| const p = path.join(__dirname, i) | ||
| const tests = fs | ||
| .readdirSync(p) | ||
| .filter(j => fs.statSync(path.join(p, j)).isDirectory()) | ||
| .map(j => path.join(p, j)) | ||
| return tests | ||
| }) | ||
| } | ||
|
|
||
| getAllTests().map(tests => { | ||
| tests.map(i => { | ||
| console.log(chalk.green(`testing: ${i}`)) | ||
| const p = require(path.join(i, 'package.json')) | ||
| if (p.engines && p.engines.node) { | ||
| const currentNodeVersion = process.versions.node | ||
| const range = p.engines.node | ||
| const engineOk = semver.satisfies(currentNodeVersion, range) | ||
| if (!engineOk) { | ||
| console.warn( | ||
| chalk.yellow(`${i} require Node.js ${range}, current is ${currentNodeVersion}, skipping`) | ||
| ) | ||
| return | ||
| } | ||
| } | ||
| const stdout = execSync('npm install', { | ||
| cwd: i | ||
| }) | ||
| console.log(stdout.toString()) | ||
| }) | ||
| }) |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |||
| "dependencies": { | ||||
| "bindings": "~1.2.1" | ||||
| }, | ||||
| "engines": { | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as before, the real dependency is N-API version 4 which is supported by some version of 8.X as well. In any case this is still a good step.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mhdawson you're right and my recent experience push me to say that the most useful value to check if a feature is supported or not is the N-API version. The problem is that it's not possible to check if a Node.js version is greater than XXX because for example the 8.16.0 has
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering if we could specify multiple ranges maybe ">= 8.16.0 < 9.0.0 || >=10.6.0" but not sure if that is allowed by the syntax.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it's possible to specify multiple ranges. What is specified on the engines field has effect only if the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example failed on macOs Node.js 8.16.0, can you run it in other OS ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like no macro
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor Module Initialization to Should we do it ? cc @gabrielschulhof
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAPI_MODULE_INIT being missing on v8.x may be an oversight as we expect same code to work across all the LTS versions subject to the NAPI_VERSION supported. Having said that,. not sure we'll be able to get that into the last v8.x release. Also need @gabrielschulhof to comment on whether than even makes sense. For now if we can refactor, maybe with an #ifdef so the example still shows the way we would want people to do it post 8.x ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
| "node": ">= 10.6.0" | ||||
| }, | ||||
| "scripts": { | ||||
| "test": "node index.js" | ||||
| }, | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.