addon-tools-raub
Advanced tools
Comparing version 5.3.4 to 6.0.0
@@ -8,10 +8,10 @@ declare module "addon-tools-raub/download" { | ||
* | ||
* ``` | ||
* ``` | ||
* download(srcUrl).then(data => useData(data), err => emit('error', err)); | ||
* ``` | ||
* ``` | ||
* or | ||
* ``` | ||
* ``` | ||
* const data = await download(srcUrl); | ||
* useData(data); | ||
* ``` | ||
* ``` | ||
*/ | ||
@@ -18,0 +18,0 @@ const download: (url: string) => Promise<Buffer>; |
@@ -13,3 +13,2 @@ 'use strict'; | ||
module.exports = url => new Promise((res, rej) => { | ||
url = url.toLowerCase(); | ||
@@ -21,3 +20,2 @@ | ||
proto.get(url, response => { | ||
response.pipe(stream); | ||
@@ -27,5 +25,3 @@ | ||
response.on('error', err => rej(err)); | ||
}); | ||
}); |
24
index.js
'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', | ||
}; | ||
@@ -22,3 +28,3 @@ | ||
const napiInclude = napi.include.replace(/\\/g, '/'); | ||
const napiInclude = napi.include_dir.replace(/\\/g, '/'); | ||
const thisInclude = `${rootPath}/include`; | ||
@@ -31,3 +37,3 @@ const includePath = `${napiInclude} ${thisInclude}`; | ||
const bin = `${dir}/bin-${platformName}`; | ||
const bin = `${dir}/bin-${platformName}`; | ||
const include = `${dir}/include`; | ||
@@ -45,5 +51,5 @@ | ||
paths, | ||
bin : `bin-${platformName}`, | ||
platform : platformName, | ||
include : includePath, | ||
bin: `bin-${platformName}`, | ||
platform: platformName, | ||
include: includePath, | ||
}; |
'use strict'; | ||
const https = require('https'); | ||
const http = require('http'); | ||
const fs = require('fs'); | ||
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); | ||
} | ||
@@ -26,3 +31,2 @@ const { bin, platform } = require('.'); | ||
try { | ||
const proto = protocols[url.match(/^https?/)[0]]; | ||
@@ -68,3 +72,2 @@ | ||
} | ||
}; | ||
@@ -71,0 +74,0 @@ |
{ | ||
"author": "Luis Blanco <luisblanco1337@gmail.com>", | ||
"name": "addon-tools-raub", | ||
"version": "5.3.4", | ||
"version": "6.0.0", | ||
"description": "Helpers for Node.js addons and dependency packages", | ||
@@ -39,4 +39,4 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=14.16.0", | ||
"npm": ">=6.14.1" | ||
"node": ">=16.17.0", | ||
"npm": ">=8.15.0" | ||
}, | ||
@@ -70,13 +70,19 @@ "scripts": { | ||
}, | ||
"dependencies": { | ||
"adm-zip": "0.5.4", | ||
"node-addon-api": "3.1.0" | ||
"peerDependencies": { | ||
"adm-zip": "^0.5.9", | ||
"node-addon-api": "^5.0.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"adm-zip": { "optional": true }, | ||
"node-addon-api": { "optional": true } | ||
}, | ||
"devDependencies": { | ||
"eslint": "7.23.0", | ||
"eslint-plugin-jest": "24.3.3", | ||
"eslint-plugin-node": "11.1.0", | ||
"jest": "26.6.3", | ||
"typescript": "4.2.4" | ||
"adm-zip": "^0.5.9", | ||
"eslint-plugin-jest": "^27.0.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint": "^8.24.0", | ||
"jest": "^29.0.3", | ||
"node-addon-api": "^5.0.0", | ||
"typescript": "^4.8.3" | ||
} | ||
} |
@@ -12,5 +12,2 @@ # Addon Tools | ||
## Synopsis | ||
This module contains numerous helpers for Node.js **NAPI** | ||
@@ -21,3 +18,3 @@ addons and dependency packages. On this page, helper scripts | ||
**Go to**: | ||
**Docs**: | ||
@@ -37,2 +34,4 @@ * [include/addon-tools.hpp](doc/addon-tools.md) | ||
> NOTE: peer dependency `node-addon-api` is required for this helper. | ||
Main exports for cross-platform addon configuration. | ||
@@ -56,2 +55,4 @@ See [TypeScript definitions](/index.d.ts) with comments. | ||
> NOTE: peer dependency `adm-zip` is required for this helper. | ||
Downloads and unzips the platform specific binary for the calling package. | ||
@@ -58,0 +59,0 @@ See [TypeScript definitions](/install.d.ts) with comments. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48522
525
69
7
+ Addedadm-zip@0.5.16(transitive)
+ Addednode-addon-api@5.1.0(transitive)
- Removedadm-zip@0.5.4
- Removednode-addon-api@3.1.0
- Removedadm-zip@0.5.4(transitive)
- Removednode-addon-api@3.1.0(transitive)