Add peer meta

This commit is contained in:
Luis Blanco 2022-09-25 12:44:26 +04:00
parent f9fe9f0124
commit 9857670794
6 changed files with 34 additions and 21 deletions

View File

@ -3,6 +3,7 @@
There is a C++ header file, `addon-tools.hpp`, shipped with this package. It
introduces several useful macros and utilities. Also it includes **Napi**
implicitly, so you can replace:
```
#include <napi.h>
```

View File

@ -31,7 +31,6 @@ public:
JS_DECLARE_METHOD(ClassName, ClassName, destroy);
bool _isDestroyed;
};
```
@ -62,13 +61,10 @@ void ClassName::init(Napi::Env env, Napi::Object exports) {
}
ClassName::ClassName(const Napi::CallbackInfo &info) { NAPI_ENV;
super(info);
_isDestroyed = false;
// ...
}
ClassName::~ClassName() {

View File

@ -73,12 +73,12 @@ directory. E.g. on Windows it will be **bin-windows**.
```
Publishing binaries is done by attaching a zipped platform folder to the Github
Publishing binaries is done by attaching a zipped platform folder to the GitHub
release. Zip file must NOT contain platform folder as a subfolder, but rather
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.
> NOTE: You can publish your binaries to anywhere, not necessarily Github.
> NOTE: You can publish your binaries to anywhere, not necessarily GitHub.
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.
@ -87,9 +87,9 @@ from **Addon Tools** is that it should be a zipped set of files/folders.
```
'variables': {
'bin' : '<!(node -p "require(\'addon-tools-raub\').bin")',
'DEPS_include' : '<!(node -p "require(\'DEPS\').include")',
'DEPS_bin' : '<!(node -p "require(\'DEPS\').bin")',
'bin': '<!(node -p "require(\'addon-tools-raub\').bin")',
'DEPS_include': '<!(node -p "require(\'DEPS\').include")',
'DEPS_bin': '<!(node -p "require(\'DEPS\').bin")',
},
```

View File

@ -1,12 +1,18 @@
'use strict';
const napi = require('node-addon-api');
let napi = null;
try {
napi = require('node-addon-api');
} catch (ex) {
console.error('To build addons, `node-addon-api` module is required.');
process.exit(1);
}
const platformNames = {
win32 : 'windows',
linux : 'linux',
darwin : 'osx',
win32: 'windows',
linux: 'linux',
darwin: 'osx',
};
const platformName = platformNames[process.platform];
@ -40,7 +46,7 @@ const paths = dir => {
module.exports = {
paths,
bin : `bin-${platformName}`,
platform : platformName,
include : includePath,
bin: `bin-${platformName}`,
platform: platformName,
include: includePath,
};

View File

@ -1,10 +1,16 @@
'use strict';
const https = require('https');
const http = require('http');
const fs = require('fs');
const AdmZip = require('adm-zip');
let AdmZip = null;
try {
AdmZip = require('adm-zip');
} catch (ex) {
console.error('The `install` script requires `adm-zip` module to be installed.');
process.exit(1);
}
const { bin, platform } = require('.');
const { mkdir, rm } = require('./utils');

View File

@ -70,6 +70,10 @@
"adm-zip": "^0.5.9",
"node-addon-api": "^5.0.0"
},
"peerDependenciesMeta": {
"adm-zip": { "optional": true },
"node-addon-api": { "optional": true }
},
"devDependencies": {
"adm-zip": "^0.5.9",
"eslint-plugin-jest": "^27.0.4",