addon-tools-raub
Advanced tools
Comparing version 6.1.1 to 6.2.0
@@ -9,3 +9,3 @@ declare module "addon-tools-raub" { | ||
* Path to binaries | ||
* Platform binary directory absolute path | ||
* Platform binary directory absolute path for this `dir` | ||
*/ | ||
@@ -15,22 +15,23 @@ bin: string; | ||
* Path to include | ||
* Include directory for this dir | ||
* Include directory for this `dir` | ||
*/ | ||
include: string; | ||
}>; | ||
type TPlatformName = 'windows' | 'linux' | 'osx' | 'aarch64'; | ||
type TPlatformDir = `bin-${TPlatformName}`; | ||
/** | ||
* Binary folder name | ||
* Platform-dependent binary directory name | ||
*/ | ||
export const bin: string; | ||
export const bin: TPlatformDir; | ||
export const platform: TPlatformName; | ||
/** | ||
* Platform name | ||
* One of: 'windows', 'linux', 'osx' | ||
*/ | ||
export const platform: string; | ||
/** | ||
* Main include directories | ||
* Both 'addon-tools-raub' and 'node-addon-api' include paths. | ||
* Use with node -p through list context command expansion <!@(...). | ||
* For binding.gyp: `'<!@(node -p "require(\'addon-tools-raub\').include")'` | ||
*/ | ||
export const include: string; | ||
} |
16
index.js
@@ -10,15 +10,19 @@ 'use strict'; | ||
const nameWindows = 'windows'; | ||
const nameArch = `${process.platform}-${process.arch}`; | ||
const platformNames = { | ||
win32: 'windows', | ||
win32: nameWindows, | ||
linux: 'linux', | ||
darwin: 'osx', | ||
'linux-arm64': 'aarch64', | ||
}; | ||
const platformName = platformNames[process.platform]; | ||
const isWindows = process.platform === 'win32'; | ||
const platformName = ( | ||
platformNames[process.platform] || | ||
platformNames[nameArch] || | ||
nameArch | ||
); | ||
if (!platformName) { | ||
console.log(`Error: UNKNOWN PLATFORM "${process.platform}"`); | ||
} | ||
const isWindows = platformName === nameWindows; | ||
@@ -25,0 +29,0 @@ const rootPath = __dirname.replace(/\\/g, '/'); |
{ | ||
"author": "Luis Blanco <luisblanco1337@gmail.com>", | ||
"name": "addon-tools-raub", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "Helpers for Node.js addons and dependency packages", | ||
@@ -70,3 +70,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"adm-zip": "^0.5.9", | ||
"adm-zip": "^0.5.10", | ||
"node-addon-api": "^5.0.0" | ||
@@ -79,10 +79,10 @@ }, | ||
"devDependencies": { | ||
"adm-zip": "^0.5.9", | ||
"eslint-plugin-jest": "^27.1.6", | ||
"adm-zip": "^0.5.10", | ||
"eslint-plugin-jest": "^27.1.7", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint": "^8.29.0", | ||
"eslint": "^8.30.0", | ||
"jest": "^29.3.1", | ||
"node-addon-api": "^5.0.0", | ||
"typescript": "^4.9.3" | ||
"typescript": "^4.9.4" | ||
} | ||
} |
50203
543