Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nw

Package Overview
Dependencies
Maintainers
4
Versions
673
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.86.0 to 0.87.0-1-sdk

13

package.json
{
"name": "nw",
"version": "0.86.0",
"version": "0.87.0-1-sdk",
"description": "An installer for nw.js",

@@ -17,3 +17,3 @@ "repository": {

"test": "vitest run",
"demo": "nw ./test/app"
"demo": "nw ./test/app --log-level=verbose"
},

@@ -40,4 +40,3 @@ "files": [

"semver": "^7.5.4",
"tar": "^6.2.1",
"yargs": "^17.7.2",
"tar": "^7.0.1",
"yauzl-promise": "^4.0.0"

@@ -58,5 +57,5 @@ },

"devDependencies": {
"selenium-webdriver": "^4.18.1",
"vitest": "^1.4.0"
"selenium-webdriver": "^4.20.0",
"vitest": "^1.5.2"
}
}
}

@@ -9,2 +9,4 @@ # nw

Please go through the [CHANGELOG](https://github.com/nwjs/npm-installer/blob/main/CHANGELOG.md) carefully and choose the appropriate version. Bug fixes and feature updates are pushed to the repo periodically.
### Latest version globally

@@ -11,0 +13,0 @@

@@ -15,8 +15,9 @@ #!/usr/bin/env node

program
.option('--version <string>')
.option('--flavor <flavor>')
.option('--platform <platform>')
.option('--arch <arch>')
.option('--cacheDir <cacheDir>')
.argument('<app>')
.argument('[app]', 'File path to project', '.')
.option('--version <string>', 'NW.js version')
.option('--flavor <flavor>', 'NW.js flavor')
.option('--platform <platform>', 'Host platform')
.option('--arch <arch>', 'Host architecture')
.option('--cacheDir <cacheDir>', 'File path to cache directory')
.allowUnknownOption() // this allows chromium and node options to be passed through to the nwjs binary
.parse(process.argv);

@@ -34,4 +35,5 @@

srcDir: program.args[0],
args: program.args.slice(1),
});
}

@@ -5,3 +5,3 @@ import fs from "node:fs";

import tar from "tar";
import * as tar from "tar";
import yauzl from "yauzl-promise";

@@ -8,0 +8,0 @@

import get from './get.js';
import run from './run';
import run from './run.js';
import util from './util.js';

@@ -4,0 +4,0 @@

@@ -0,6 +1,8 @@

import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import url from 'node:url';
import semver from 'semver';
import nodeManifest from '../package.json' assert { type: 'json' };
import util from '../src/util.js';

@@ -16,2 +18,3 @@

* @property {string} cacheDir Cache directory
* @property {string} srcDir Source directory
* @property {boolean} cache If false, remove cache and redownload.

@@ -29,2 +32,11 @@ * @property {boolean} ffmpeg If true, ffmpeg is not downloaded.

export default async function parse(options) {
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
/**
* @type {fs.PathLike}
*/
const nodeManifestPath = path.resolve(__dirname, '..', 'package.json');
/**
* @type {object}
*/
const nodeManifest = JSON.parse(await fs.promises.readFile(nodeManifestPath, { encoding: 'utf-8' }));
options.version = options.version ?? nodeManifest.version;

@@ -61,3 +73,4 @@ const parsedVersion = semver.parse(options.version);

options.downloadUrl = options.downloadUrl || process.env.npm_config_nwjs_urlbase || process.env.NWJS_URLBASE || 'https://dl.nwjs.io';
options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || '.';
options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || path.resolve(__dirname, '..');
options.srcDir = options.srcDir || process.cwd();
options.cache = options.cache || process.env.npm_config_nwjs_cache || process.env.NWJS_CACHE || true;

@@ -64,0 +77,0 @@ options.ffmpeg = options.ffmpeg || process.env.npm_config_nwjs_ffmpeg || process.env.NWJS_FFMPEG || false;

@@ -0,2 +1,5 @@

import fs from 'node:fs';
import process from 'node:process';
import path from 'node:path';
import url from 'node:url';

@@ -8,4 +11,2 @@ import semver from 'semver';

import nodeManifest from '../package.json' assert { type: 'json' };
await postinstall()

@@ -15,2 +16,4 @@ .catch((error) => {

console.error('Unable to create symlink since user did not run as Administrator.');
} else {
console.error(error)
}

@@ -20,2 +23,11 @@ });

async function postinstall() {
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
/**
* @type {fs.PathLike}
*/
const nodeManifestPath = path.resolve(__dirname, '..' ,'package.json');
/**
* @type {object}
*/
const nodeManifest = JSON.parse(await fs.promises.readFile(nodeManifestPath));
const parsedVersion = semver.parse(nodeManifest.version);

@@ -22,0 +34,0 @@ let version = [

@@ -16,2 +16,3 @@ import child_process from "node:child_process";

* @property {string} [cacheDir = "./cache"] Cache directory
* @property {string[]} [args = []] Command line arguments
*/

@@ -35,2 +36,3 @@

cacheDir = "./cache",
args = [],
}) {

@@ -51,3 +53,4 @@

path.resolve(nwDir, util.EXE_NAME[platform]),
[srcDir]
[srcDir, ...args],
{ detached: true, stdio: "ignore" },
);

@@ -59,2 +62,6 @@

nwProcess.on("message", (message) => {
console.log(message);
});
nwProcess.on("error", (error) => {

@@ -61,0 +68,0 @@ console.error(error);

@@ -6,2 +6,4 @@ import fs from 'node:fs';

import parse from './parse.js';
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));

@@ -47,6 +49,8 @@

* @param {'nwjs' | 'chromedriver'} executable Path to NW.js or Chromedriver executable.
* @return {string}
* @return {Promise<string>}
*/
function findpath(executable = 'nwjs') {
const nwDir = path.resolve(__dirname, '..', 'nwjs');
async function findpath(executable = 'nwjs', options = {}) {
options = await parse(options);
const nwDir = path.resolve(__dirname, '..', `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`);
/**

@@ -60,13 +64,6 @@ * File path to executable.

/**
* Host operating system
*
* @type {NodeJS.Platform}
*/
let hostOs = PLATFORM_KV[process.env.npm_config_nwjs_platform || process.env.NWJS_PLATFORM || process.platform];
/**
* Get the platform dependant path of the NW.js binary.
*/
function findNwjs() {
binPath = path.resolve(nwDir, EXE_NAME[hostOs]);
binPath = path.resolve(nwDir, EXE_NAME[options.platform]);
}

@@ -73,0 +70,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