Comparing version 0.86.0 to 0.87.0-1-sdk
{ | ||
"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 @@ |
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
34836
5
829
126
32
+ Added@isaacs/cliui@8.0.2(transitive)
+ Added@isaacs/fs-minipass@4.0.1(transitive)
+ Added@pkgjs/parseargs@0.11.0(transitive)
+ Addedansi-regex@6.1.0(transitive)
+ Addedansi-styles@6.2.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedchownr@3.0.0(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@9.2.2(transitive)
+ Addedforeground-child@3.3.0(transitive)
+ Addedglob@10.4.5(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjackspeak@3.4.3(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedminimatch@9.0.5(transitive)
+ Addedminipass@7.1.2(transitive)
+ Addedminizlib@3.0.1(transitive)
+ Addedmkdirp@3.0.1(transitive)
+ Addedpackage-json-from-dist@1.0.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedrimraf@5.0.10(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedstring-width@5.1.2(transitive)
+ Addedstrip-ansi@7.1.0(transitive)
+ Addedtar@7.4.3(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwrap-ansi@8.1.0(transitive)
+ Addedyallist@5.0.0(transitive)
- Removedyargs@^17.7.2
- Removedchownr@2.0.0(transitive)
- Removedcliui@8.0.1(transitive)
- Removedescalade@3.2.0(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedy18n@5.0.8(transitive)
- Removedyallist@4.0.0(transitive)
- Removedyargs@17.7.2(transitive)
- Removedyargs-parser@21.1.1(transitive)
Updatedtar@^7.0.1