diff --git a/doc/addon-tools.md b/doc/addon-tools.md index 23cebf0..b6848d7 100644 --- a/doc/addon-tools.md +++ b/doc/addon-tools.md @@ -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 ``` diff --git a/doc/class-wrapping.md b/doc/class-wrapping.md index 5051686..6e15b95 100644 --- a/doc/class-wrapping.md +++ b/doc/class-wrapping.md @@ -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() { diff --git a/doc/snippets.md b/doc/snippets.md index d4af7ec..00bff00 100644 --- a/doc/snippets.md +++ b/doc/snippets.md @@ -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' : ' { dir = dir.replace(/\\/g, '/'); - const bin = `${dir}/bin-${platformName}`; + const bin = `${dir}/bin-${platformName}`; const include = `${dir}/include`; if (isWindows) { @@ -40,7 +46,7 @@ const paths = dir => { module.exports = { paths, - bin : `bin-${platformName}`, - platform : platformName, - include : includePath, + bin: `bin-${platformName}`, + platform: platformName, + include: includePath, }; diff --git a/install.js b/install.js index 48f6a37..52f8d60 100644 --- a/install.js +++ b/install.js @@ -1,10 +1,16 @@ 'use strict'; - const https = require('https'); -const http = require('http'); -const fs = require('fs'); -const AdmZip = require('adm-zip'); +const http = require('http'); +const fs = require('fs'); + +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'); diff --git a/package.json b/package.json index 05a6e58..8acddfa 100644 --- a/package.json +++ b/package.json @@ -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",