nw 0.85.0-1 → 0.85.0-2
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 +25 -1
- package/package.json +1 -1
- package/src/get.js +9 -1
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ Set `nwjs_native_addon` in `.npmrc` or `NWJS_NATIVE_ADDON` environment variable
|
|
|
54
54
|
|
|
55
55
|
### Specify download URL:
|
|
56
56
|
|
|
57
|
-
Set `nwjs_urlbase` in `.npmrc`
|
|
57
|
+
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
58
|
|
|
59
59
|
## Usage
|
|
60
60
|
|
|
@@ -103,6 +103,30 @@ import { findpath } from 'nw';
|
|
|
103
103
|
var path = findpath('chromedriver');
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## Download specific versions independant of installer version
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import { get } from 'nw';
|
|
110
|
+
|
|
111
|
+
await get({
|
|
112
|
+
// options
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Options:
|
|
117
|
+
|
|
118
|
+
| Name | Type | Default | Description |
|
|
119
|
+
| ---- | ------- | --------- | ----------- |
|
|
120
|
+
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
|
|
121
|
+
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
|
|
122
|
+
| platform | `"linux" \| "osx" \| "win"` | | Host platform |
|
|
123
|
+
| arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
|
|
124
|
+
| 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 |
|
|
125
|
+
| cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
|
|
126
|
+
| cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. |
|
|
127
|
+
| ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
|
|
128
|
+
| nodeAddon | `false \| "gyp"` | `false` | Download Node headers |
|
|
129
|
+
|
|
106
130
|
## License
|
|
107
131
|
|
|
108
132
|
[NW.js](https://github.com/nwjs/nw.js)'s code and this installer use the MIT license.
|
package/package.json
CHANGED
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
|
*
|