Skip to content

Commit fd4d1d1

Browse files
chore(docs): simplify docs
1 parent 8cf5987 commit fd4d1d1

File tree

1 file changed

+23
-55
lines changed

1 file changed

+23
-55
lines changed

README.md

+23-55
Original file line numberDiff line numberDiff line change
@@ -25,50 +25,12 @@ npm install --save-dev nw
2525
### Specific version with changes to installer:
2626

2727
```shell
28-
npm install --save-dev nw@0.85.0-1
28+
npm install --save-dev nw@0.94.1-1
2929
```
3030

3131
> You may use `npm view nw versions` to view the list of available versions.
3232
33-
### Specify build flavor:
34-
35-
```shell
36-
npm install --save-dev nw@sdk
37-
```
38-
39-
Or set `nwjs_build_type=sdk` in `.npmrc` or `NWJS_BUILD_TYPE=sdk` environment variable.
40-
41-
### Specify platform:
42-
43-
Set `nwjs_platform` in `.npmrc` or `NWJS_PLATFORM` environment variable. Defaults to `process.platform`.
44-
45-
### Specify architecture:
46-
47-
Set `nwjs_arch` in `.npmrc` or `NWJS_ARCH` environment variable. Defaults to `process.arch`.
48-
49-
### Specify cache directory:
50-
51-
Set `nwjs_cache_dir` in `.npmrc` or `NWJS_ARCH` environment variable. Defaults to `./node_modules/nw`.
52-
53-
### Specify cache flag:
54-
55-
Set `nwjs_cache` in `.npmrc` or `NWJS_ARCH` environment variable to keep or delete cached binaries. Defaults to `true`.
56-
57-
### Specify ffmpeg flag:
58-
59-
Set `nwjs_ffmpeg` in `.npmrc` or `NWJS_ARCH` environment variable to toggle downloading [community FFmpeg binaries](https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt). Defaults to `false`.
60-
61-
### Specify Native Addon flag:
62-
63-
Set `nwjs_native_addon` in `.npmrc` or `NWJS_NATIVE_ADDON` environment variable to toggle downloading NW.js Node headers. Defaults to `false`.
64-
65-
### Specify download URL:
66-
67-
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`).
68-
69-
### Specify unref flag
70-
71-
Set `nwjs_unref` in `.npmrc` or `NWJS_UNREF` environment variable. Default to `false`. This is useful if you're using `nw` package to call the executable and want to prevent zombie processes eating up memory.
33+
For more options, see the Options table below.
7234

7335
## Usage
7436

@@ -82,7 +44,7 @@ Add a script in your `package.json`:
8244
}
8345
```
8446

85-
Executing `npm start` runs the NW.js app. Omitting the file path makes NW.js check for valid project in current working directory. You can also call `nw` directly from `node_modules/.bin/nw`.
47+
Executing `npm start` runs the NW.js app. Omitting the file path makes NW.js check for valid project in current working directory. You can also call `nw` directly from `./node_modules/.bin/nw`.
8648

8749
## APIs
8850

@@ -106,23 +68,29 @@ let path = await findpath('chromedriver', { flavor: 'sdk' });
10668
import { get } from 'nw';
10769

10870
await get({
109-
// options
71+
version: '0.14.7'
72+
// other options
11073
});
11174
```
11275

113-
Options:
114-
115-
| Name | Type | Default | Description |
116-
| ---- | ------- | --------- | ----------- |
117-
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version |
118-
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor |
119-
| platform | `"linux" \| "osx" \| "win"` | | Host platform |
120-
| arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture |
121-
| 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 |
122-
| cacheDir | `string` | `"./cache"` | Directory to cache NW binaries |
123-
| cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. |
124-
| ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. |
125-
| nodeAddon | `false \| "gyp"` | `false` | Download Node headers |
76+
## Options:
77+
78+
| Name | Type | Default | Description | CLI Usage | .npmrc Usage | .env Usage | Module Usage |
79+
| ---- | ------- | --------- | ----------- | --------- | ------------ | ---------- | ------------ |
80+
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version | `npm install --save-dev nw` | `` | `` | `get({ version: "latest" })` |
81+
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor | `npm install --save-dev nw@sdk` | `nwjs_build_type=sdk` | `export NWJS_BUILD_TYPE=sdk` | `get({ flavor: "sdk" })` |
82+
| platform | `"linux" \| "osx" \| "win"` | `<defaults to host platform>` | Host platform | `npm install --save-dev --nwjs-platform nw` | `nwjs_platform=linux` | `NWJS_PLATFORM=linux` | `get({ platform: "linux" })` |
83+
| arch | `"ia32" \| "x64" \| "arm64"` | `<defaults to architecture platform>` | Host architecture | `npm install --save-dev --nwjs-arch nw` | `nwjs_arch=x64` | `NWJS_ARCH=x64` | `get({ arch: "x64"})` |
84+
| 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/ nw"` | `"https://dl.nwjs.io"` | Download server (https and file system is supported, for eg `file:///home/user/nwjs_cache`) | `npm install --save-dev --nwjs-urlbase=https://dl.nwjs.io` | `nwjs_urlbase=https://dl.nwjs.io` | `NWJS_URLBASE=https://dl.nwjs.io` | `get({ downloadUrl: "https://dl.nwjs.io"})` |
85+
| cacheDir | `string` | `./node_modules/nw` | Directory to cache NW binaries | `npm install --save-dev --nwjs-cache-dir ./cache nw` | `nwjs_cache_dir=./cache` | `NWJS_CACHE_DIR=./cache` | `get({ cacheDir: "./cache" })` |
86+
| sirDir | `string` | `.` | File path to NW.js project | `nw .` | `` | `` | `get({ srcDir: "." })` |
87+
| cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. | `npm install --save-dev --nwjs-cache=true nw` | `nwjs_cache=true` | `NWJS_CACHE=true` | `get({ cache: true })` |
88+
| ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by [community version](https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt) with proprietary codecs. | `npm install --save-dev --nwjs-ffmpeg=true nw` | `nwjs_ffmpeg=true` | `NWJS_FFMPEG=true` | `get({ ffmpeg: true })` |
89+
| nodeAddon | `false \| "gyp"` | `false` | Download Node headers | `npm install --save-dev --nwjs-native-addon=true nw` | `nwjs_native_addon=true` | `NWJS_NATIVE_ADDON=true` | `get({ nativeAddon: true })` |
90+
| unref | `boolean` | `false` | [Prevent the parent process from waiting for a given subprocess](https://nodejs.org/api/child_process.html#subprocessunref). This is useful if you're using `nw` package to call the executable and want to prevent zombie processes eating up memory. | `npm install --save-dev --nwjs-unref=true nw` | `nwjs_unref=true` | `NWJS_UNREF=true` | `get({ unref: true })` |
91+
shaSum | `boolean` | `true` | If true, then shasums are verified. Otherwise, it is ignored. | `npm install --save-dev --nwjs-shasum=true nw` | `nwjs_shasum=true` | `NWJS_SHASUM=true` | `get({ shaSum: true })` |
92+
93+
> Note: While using the CLI interface, /path/to/project refers to options.srcDir in the JavaScript API or JSON object.
12694
12795
## License
12896

0 commit comments

Comments
 (0)