New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nw

Package Overview
Dependencies
Maintainers
4
Versions
677
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nw - npm Package Compare versions

Comparing version 0.81.0 to 0.82.0-sdk

bin/nw.js

65

lib/findpath.js

@@ -1,20 +0,57 @@

var fs = require('fs');
var path = require('path');
var bindir = path.resolve(__dirname, '..', 'nwjs');
const { env, platform } = require('node:process');
const { join, resolve } = require('node:path');
module.exports = function() {
var bin = bindir;
var platform = process.env.npm_config_nwjs_platform || process.env.NWJS_PLATFORM || process.platform;
if (platform === 'darwin') {
if (fs.existsSync(path.join(bin, 'Contents'))) {
bin = path.join(bin, 'Contents', 'MacOS', 'nwjs');
/**
* Get the platform dependant path of the NW.js or ChromeDriver binary.
*
* @param {'nwjs' | 'chromedriver'} executable Path to NW.js or Chromedriver executable.
* @return {string}
*/
function findpath(executable = 'nwjs') {
const nwDir = resolve(__dirname, '..', 'nwjs');
/**
* File path to executable.
*
* @type {string}
*/
let binPath = '';
/**
* Host operating system
*
* @type {NodeJS.Platform}
*/
let hostOs = env.npm_config_nwjs_platform || env.NWJS_PLATFORM || platform;
/**
* Get the platform dependant path of the NW.js binary.
*/
function findNwjs() {
if (hostOs === 'darwin') {
binPath = join(nwDir, 'nwjs.app', 'Contents', 'MacOS', 'nwjs');
} else if (hostOs === 'win32') {
binPath = join(nwDir, 'nw.exe');
} else {
bin = path.join(bin, 'nwjs.app', 'Contents', 'MacOS', 'nwjs');
binPath = join(nwDir, 'nw');
}
} else if (platform === 'win32') {
bin = path.join(bin, 'nw.exe');
}
/**
* Get the platform dependant path of the ChromeDriver binary.
*/
function findChromeDriver() {
binPath = resolve(nwDir, `chromedriver${platform === "win32" ? ".exe" : ""}`);
}
if (executable === 'nwjs') {
findNwjs();
} else if (executable === 'chromedriver') {
findChromeDriver();
} else {
bin = path.join(bin, 'nw');
console.error(`[ ERROR ] Expected nwjs or chromedriver, got ${executable}.`);
}
return bin;
return binPath;
}
module.exports = { findpath };
{
"name": "nw",
"version": "0.81.0",
"version": "0.82.0-sdk",
"description": "A installer for nw.js",

@@ -9,36 +9,32 @@ "repository": {

},
"main": "index.js",
"main": "lib/findpath.js",
"bin": {
"nw": "bin/nw"
"nw": "bin/nw.js"
},
"scripts": {
"postinstall": "node scripts/install.js",
"test": "node --test-reporter=spec --test test/index.mjs"
"postinstall": "node lib/install.js",
"test": "node --test-reporter=spec --test test/index.js",
"dry-run": "nw ./test/app"
},
"files": [
"lib",
"bin",
"scripts",
"index.js"
"bin"
],
"author": "Kyle Robinson Young",
"author": {
"name": "Kyle Robinson Young",
"url": "https://github.com/shama"
},
"contributors": [
{
"name": "nwjs/npm-installer Contributors",
"url": "https://github.com/nwjs/npm-installer/graphs/contributors"
}
],
"license": "MIT",
"dependencies": {
"chalk": "~1.1.3",
"decompress": "^4.2.0",
"download": "^5.0.3",
"file-exists": "^2.0.0",
"merge": "^2.1.1",
"progress": "^2.0.3",
"rimraf": "^2.2.8",
"semver": "^5.1.0",
"cli-progress": "^3.12.0",
"compressing": "^1.10.0",
"semver": "^7.5.4",
"yargs": "^3.2.1"
},
"devDependencies": {
"request": "^2.53.0"
},
"engines": {
"node": "v20.5.0"
},
"packageManager": "npm@9.8.1",
"keywords": [

@@ -56,2 +52,2 @@ "nw",

]
}
}

@@ -106,2 +106,12 @@ # nw

## finding the path to the chromedriver binary
If you would like to programmatically retrieve the path to the chromedriver use:
``` js
var findpath = require('nw').findpath;
var chromedriver_path = findpath('chromedriver');
// chromedriver_path will equal the path to the binary depending on your environment
```
Then you can use that path to run NW.js programmatically. For example, to run in the current script's directory:

@@ -108,0 +118,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc