nw 0.86.0-2 → 0.86.0-3-sdk

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/util.js +8 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw",
3
- "version": "0.86.0-2",
3
+ "version": "0.86.0-3-sdk",
4
4
  "description": "An installer for nw.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,4 +55,4 @@
55
55
  "selenium-webdriver": "^4.18.1",
56
56
  "vitest": "^1.4.0"
57
57
  }
58
- }
58
+ }
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
  /**