wip readme
This commit is contained in:
parent
b985816b26
commit
aa800818ed
51
README.md
51
README.md
|
@ -7,7 +7,7 @@ This is a part of [Node3D](https://github.com/node-3d) project.
|
||||||
[](https://travis-ci.com/node-3d/addon-tools-raub)
|
[](https://travis-ci.com/node-3d/addon-tools-raub)
|
||||||
[](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
|
[](https://www.codefactor.io/repository/github/node-3d/addon-tools-raub)
|
||||||
|
|
||||||
> npm i -s addon-tools-raub
|
> npm i addon-tools-raub
|
||||||
|
|
||||||
|
|
||||||
## Synopsis
|
## Synopsis
|
||||||
|
@ -17,13 +17,14 @@ Helpers for Node.js **NAPI** addons and dependency packages:
|
||||||
* Supported platforms (x64): Windows, Linux, OSX.
|
* Supported platforms (x64): Windows, Linux, OSX.
|
||||||
* C++ helpers:
|
* C++ helpers:
|
||||||
* Macro shortcuts for NAPI.
|
* Macro shortcuts for NAPI.
|
||||||
* `consoleLog()` function.
|
|
||||||
* `eventEmit()` function.
|
* `eventEmit()` function.
|
||||||
* `getData()` function.
|
* `getData()` function.
|
||||||
|
* **Es5** class wrapper (like `Napi::ObjectWrap`, but Es5 functions).
|
||||||
* Module helpers:
|
* Module helpers:
|
||||||
* Crossplatform commands for GYP: `cp`, `rm`, `mkdir`.
|
* Crossplatform commands for GYP: `cp`, `rm`, `mkdir`.
|
||||||
* Deps unzip installer.
|
* Deps unzip installer.
|
||||||
* Url-to-buffer downloader.
|
* Url-to-buffer downloader.
|
||||||
|
* Binary copy helper.
|
||||||
|
|
||||||
Useful links: [N-API Docs](https://nodejs.org/api/n-api.html),
|
Useful links: [N-API Docs](https://nodejs.org/api/n-api.html),
|
||||||
[Napi Docs](https://github.com/nodejs/node-addon-api/blob/master/doc/setup.md),
|
[Napi Docs](https://github.com/nodejs/node-addon-api/blob/master/doc/setup.md),
|
||||||
|
@ -36,13 +37,17 @@ Useful links: [N-API Docs](https://nodejs.org/api/n-api.html),
|
||||||
[include/addon-tools.hpp](#includeaddon-toolshpp)
|
[include/addon-tools.hpp](#includeaddon-toolshpp)
|
||||||
|
|
||||||
[index.js](#indexjs)
|
[index.js](#indexjs)
|
||||||
|
[cpbin.js](#cpbinjs)
|
||||||
|
[download.js](#downloadjs)
|
||||||
|
[install.js](#installjs)
|
||||||
|
[writable-buffer.js](#writablebufferjs)
|
||||||
|
|
||||||
[Crossplatform commands](#crossplatform-commands)
|
[Crossplatform commands](#crossplatform-commands)
|
||||||
|
|
||||||
[Function consoleLog](#function-consolelog)
|
|
||||||
|
|
||||||
[Function eventEmit](#function-eventEmit)
|
[Function eventEmit](#function-eventEmit)
|
||||||
|
|
||||||
|
[Es5 class wrapper](#es5-class-wrapper)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,38 +62,11 @@ Useful links: [N-API Docs](https://nodejs.org/api/n-api.html),
|
||||||
'cp' : '<!(node -p "require(\'addon-tools-raub\').cp")',
|
'cp' : '<!(node -p "require(\'addon-tools-raub\').cp")',
|
||||||
'mkdir' : '<!(node -p "require(\'addon-tools-raub\').mkdir")',
|
'mkdir' : '<!(node -p "require(\'addon-tools-raub\').mkdir")',
|
||||||
},
|
},
|
||||||
|
...
|
||||||
|
'action': ['<(mkdir)', '-p', '<(binary)']
|
||||||
```
|
```
|
||||||
|
|
||||||
On both Windows and Unix those commands now have the same result:
|
On both Windows and Unix those commands now have the same result.
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
'target_name' : 'make_directory',
|
|
||||||
'type' : 'none',
|
|
||||||
'dependencies' : ['addon'],
|
|
||||||
'actions' : [{
|
|
||||||
'action_name' : 'Directory created.',
|
|
||||||
'inputs' : [],
|
|
||||||
'outputs' : ['build'],
|
|
||||||
'action': ['<(mkdir)', '-p', '<(binary)']
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'target_name' : 'copy_binary',
|
|
||||||
'type' : 'none',
|
|
||||||
'dependencies' : ['make_directory'],
|
|
||||||
'actions' : [{
|
|
||||||
'action_name' : 'Module copied.',
|
|
||||||
'inputs' : [],
|
|
||||||
'outputs' : ['binary'],
|
|
||||||
'action' : [
|
|
||||||
'<(cp)',
|
|
||||||
'build/Release/addon.node',
|
|
||||||
'<(binary)/addon.node'
|
|
||||||
],
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Addon binary directory
|
### Addon binary directory
|
||||||
|
@ -161,14 +139,13 @@ contain the final binaries. The tag of the release should be the same as in
|
||||||
`npm_package_config_install` - that is the way installer will find it.
|
`npm_package_config_install` - that is the way installer will find it.
|
||||||
|
|
||||||
* NOTE: You can publish your binaries to anywhere, not necessarily Github.
|
* NOTE: You can publish your binaries to anywhere, not necessarily Github.
|
||||||
Just tweak the **install.js** script as appropriate. The only limitation
|
Just tweak **YOUR install.js** script as appropriate. The only limitation
|
||||||
from **Addon Tools** is that it should be a zipped set of files/folders.
|
from **Addon Tools** is that it should be a zipped set of files/folders.
|
||||||
|
|
||||||
|
|
||||||
### Compiled addon
|
### Compiled addon
|
||||||
|
|
||||||
With the advent of N-API the focus of compiled addons shifted towards the
|
N-API ABI is compatible across Node.js versions, now addons
|
||||||
word "addons". Since ABI is now compatible across Node.js versions, now addons
|
|
||||||
are just plain DLLs. Therefore distribution of the binaries is covered in the
|
are just plain DLLs. Therefore distribution of the binaries is covered in the
|
||||||
previous section. But for an addon you have to provide a GYP compilation step.
|
previous section. But for an addon you have to provide a GYP compilation step.
|
||||||
N-API changes it's role to out-of-install compilation, so we can't/shouldnt
|
N-API changes it's role to out-of-install compilation, so we can't/shouldnt
|
||||||
|
|
Loading…
Reference in New Issue