nw 0.86.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw",
3
- "version": "0.86.0",
3
+ "version": "0.87.0",
4
4
  "description": "An installer for nw.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "scripts": {
15
15
  "postinstall": "node src/postinstall.js",
16
16
  "test": "vitest run",
17
- "demo": "nw ./test/app"
17
+ "demo": "nw ./test/app --log-level=verbose"
18
18
  },
19
19
  "files": [
20
20
  "bin",
@@ -36,8 +36,7 @@
36
36
  "axios": "^1.6.8",
37
37
  "commander": "^12.0.0",
38
38
  "semver": "^7.5.4",
39
- "tar": "^6.2.1",
40
- "yargs": "^17.7.2",
39
+ "tar": "^7.0.1",
41
40
  "yauzl-promise": "^4.0.0"
42
41
  },
43
42
  "keywords": [
@@ -54,6 +53,6 @@
54
53
  ],
55
54
  "devDependencies": {
56
55
  "selenium-webdriver": "^4.18.1",
57
- "vitest": "^1.4.0"
56
+ "vitest": "^1.5.0"
58
57
  }
59
58
  }
package/src/cli.js CHANGED
@@ -17,7 +17,8 @@ async function cli() {
17
17
  .option('--platform <platform>')
18
18
  .option('--arch <arch>')
19
19
  .option('--cacheDir <cacheDir>')
20
- .argument('<app>')
20
+ .argument('[app]')
21
+ .allowUnknownOption()
21
22
  .parse(process.argv);
22
23
 
23
24
  let options = program.opts();
package/src/decompress.js CHANGED
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import stream from "node:stream";
4
4
 
5
- import tar from "tar";
5
+ import * as tar from "tar";
6
6
  import yauzl from "yauzl-promise";
7
7
 
8
8
  import util from "./util.js";
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import get from './get.js';
2
- import run from './run';
2
+ import run from './run.js';
3
3
  import util from './util.js';
4
4
 
5
5
  const { findpath } = util;
package/src/parse.js CHANGED
@@ -1,3 +1,4 @@
1
+ import path from 'node:path';
1
2
  import process from 'node:process';
2
3
 
3
4
  import semver from 'semver';
@@ -56,7 +57,7 @@ export default async function parse(options) {
56
57
  options.platform = options.platform || util.PLATFORM_KV[process.env.npm_config_nwjs_platform || process.env.NWJS_PLATFORM || process.platform];
57
58
  options.arch = options.arch || util.ARCH_KV[process.env.npm_config_nwjs_process_arch || process.env.NWJS_ARCH || process.arch];
58
59
  options.downloadUrl = options.downloadUrl || process.env.npm_config_nwjs_urlbase || process.env.NWJS_URLBASE || 'https://dl.nwjs.io';
59
- options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || '.';
60
+ options.cacheDir = options.npm_config_nwjs_urlbase || process.env.npm_config_nwjs_cache_dir || process.env.NWJS_CACHE_DIR || path.resolve('.', 'node_modules', 'nw');
60
61
  options.cache = options.cache || process.env.npm_config_nwjs_cache || process.env.NWJS_CACHE || true;
61
62
  options.ffmpeg = options.ffmpeg || process.env.npm_config_nwjs_ffmpeg || process.env.NWJS_FFMPEG || false;
62
63
  options.nativeAddon = options.nativeAddon || process.env.npm_config_nwjs_native_addon || process.env.NWJS_NATIVE_ADDON || false;
package/src/util.js CHANGED
@@ -3,6 +3,8 @@ import path from 'node:path';
3
3
  import process from 'node:process';
4
4
  import url from 'node:url';
5
5
 
6
+ import parse from './parse.js';
7
+
6
8
  const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
7
9
 
8
10
  /**
@@ -43,10 +45,12 @@ const EXE_NAME = {
43
45
  * Get the platform dependant path of the NW.js or ChromeDriver binary.
44
46
  *
45
47
  * @param {'nwjs' | 'chromedriver'} executable Path to NW.js or Chromedriver executable.
46
- * @return {string}
48
+ * @return {Promise<string>}
47
49
  */
48
- function findpath(executable = 'nwjs') {
49
- const nwDir = path.resolve(__dirname, '..', 'nwjs');
50
+ async function findpath(executable = 'nwjs', options = {}) {
51
+ options = await parse(options);
52
+ const nwDir = path.resolve(__dirname, '..', `nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}`);
53
+
50
54
  /**
51
55
  * File path to executable.
52
56
  *
@@ -54,18 +58,11 @@ function findpath(executable = 'nwjs') {
54
58
  */
55
59
  let binPath = '';
56
60
 
57
- /**
58
- * Host operating system
59
- *
60
- * @type {NodeJS.Platform}
61
- */
62
- let hostOs = PLATFORM_KV[process.env.npm_config_nwjs_platform || process.env.NWJS_PLATFORM || process.platform];
63
-
64
61
  /**
65
62
  * Get the platform dependant path of the NW.js binary.
66
63
  */
67
64
  function findNwjs() {
68
- binPath = path.resolve(nwDir, EXE_NAME[hostOs]);
65
+ binPath = path.resolve(nwDir, EXE_NAME[options.platform]);
69
66
  }
70
67
 
71
68
  /**