nw 0.85.0-1 → 0.85.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.
package/README.md CHANGED
@@ -6,6 +6,14 @@ An npm installer for [NW.js](https://nwjs.io).
6
6
 
7
7
  ## Install
8
8
 
9
+ ### Latest version globally
10
+
11
+ ```shell
12
+ npm install -g nw
13
+ ```
14
+
15
+ You might run into issues installing globally. [Learn how to fix this](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally)
16
+
9
17
  ### Latest version of normal build flavor:
10
18
 
11
19
  ```shell
@@ -54,7 +62,7 @@ Set `nwjs_native_addon` in `.npmrc` or `NWJS_NATIVE_ADDON` environment variable
54
62
 
55
63
  ### Specify download URL:
56
64
 
57
- Set `nwjs_urlbase` in `.npmrc` or `NWJS_URLBASE` environment variable. Defaults to `https://dl.nwjs.io`. The file system (`file://`) is also supported.
65
+ Set `nwjs_urlbase` in `.npmrc`or `NWJS_URLBASE` environment variable. Defaults to `https://dl.nwjs.io`. The file system (`file://`) is also supported (for example, `file:///home/localghost/local_mirror`).
58
66
 
59
67
  ## Usage
60
68
 
@@ -103,6 +111,30 @@ import { findpath } from 'nw';
103
111
  var path = findpath('chromedriver');
104
112
  ```
105
113
 
114
+ ## Download specific versions independant of installer version
115
+
116
+ ```js
117
+ import { get } from 'nw';
118
+
119
+ await get({
120
+ // options
121
+ });
122
+ ```
123
+
124
+ Options:
125
+
126
+ | Name | Type | Default | Description |
127
+ | ---- | ------- | --------- | ----------- |
128
+ | version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
129
+ | flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
130
+ | platform | `"linux" \| "osx" \| "win"` | | Host platform |
131
+ | arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
132
+ | downloadUrl | `"https://dl.nwjs.io" \| "https://npm.taobao.org/mirrors/nwjs" \| https://npmmirror.com/mirrors/nwjs \| "https://github.com/corwin-of-amber/nw.js/releases/"` | `"https://dl.nwjs.io"` | Download server |
133
+ | cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
134
+ | cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. |
135
+ | ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
136
+ | nodeAddon | `false \| "gyp"` | `false` | Download Node headers |
137
+
106
138
  ## License
107
139
 
108
140
  [NW.js](https://github.com/nwjs/nw.js)'s code and this installer use the MIT license.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nw",
3
- "version": "0.85.0-1",
3
+ "version": "0.85.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/get.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import url from 'node:url';
3
4
 
4
5
  import decompress from "./decompress.js";
5
6
  import ffmpeg from "./ffmpeg.js";
@@ -14,7 +15,7 @@ import util from "./util.js";
14
15
  * @property {"normal" | "sdk"} [flavor = "normal"] Build flavor
15
16
  * @property {"linux" | "osx" | "win"} [platform] Target platform
16
17
  * @property {"ia32" | "x64" | "arm64"} [arch] Target arch
17
- * @property {string} [downloadUrl = "https://dl.nwjs.io"] Download server
18
+ * @property {string} [downloadUrl = "https://dl.nwjs.io"] Download server.
18
19
  * @property {string} [cacheDir = "./cache"] Cache directory
19
20
  * @property {boolean} [cache = true] If false, remove cache and redownload.
20
21
  * @property {boolean} [ffmpeg = false] If true, ffmpeg is not downloaded.
@@ -31,6 +32,13 @@ import util from "./util.js";
31
32
  */
32
33
  async function get(options) {
33
34
 
35
+ const uri = new url.URL(options.downloadUrl);
36
+
37
+ /* Download server is the cached directory. */
38
+ if (uri.protocol === 'file:') {
39
+ options.cacheDir = path.resolve(decodeURIComponent(options.downloadUrl.slice('file://'.length)));
40
+ }
41
+
34
42
  /**
35
43
  * If `options.cacheDir` exists, then `true`. Otherwise, it is `false`.
36
44
  *
package/src/index.js CHANGED
@@ -5,4 +5,5 @@ const { findpath } = util;
5
5
 
6
6
  export {
7
7
  findpath,
8
+ get,
8
9
  }