Comparing version 0.85.0 to 0.86.0-1
{ | ||
"name": "nw", | ||
"version": "0.85.0", | ||
"description": "A installer for nw.js", | ||
"version": "0.86.0-1", | ||
"description": "An installer for nw.js", | ||
"repository": { | ||
@@ -9,14 +9,16 @@ "type": "git", | ||
}, | ||
"main": "lib/findpath.js", | ||
"type": "module", | ||
"main": "src/index.js", | ||
"bin": { | ||
"nw": "bin/nw.js" | ||
"nw": "src/cli.js" | ||
}, | ||
"scripts": { | ||
"postinstall": "node lib/install.js", | ||
"test": "node --test-reporter=spec --test test/index.js", | ||
"dry-run": "nw ./test/app" | ||
"postinstall": "node src/postinstall.js", | ||
"test": "vitest run", | ||
"demo": "nw ./test/app" | ||
}, | ||
"files": [ | ||
"bin", | ||
"lib", | ||
"bin" | ||
"src" | ||
], | ||
@@ -35,6 +37,8 @@ "author": { | ||
"dependencies": { | ||
"cli-progress": "^3.12.0", | ||
"compressing": "^1.10.0", | ||
"axios": "^1.6.8", | ||
"commander": "^12.0.0", | ||
"semver": "^7.5.4", | ||
"yargs": "^17.7.2" | ||
"tar": "^6.2.1", | ||
"yargs": "^17.7.2", | ||
"yauzl-promise": "^4.0.0" | ||
}, | ||
@@ -52,3 +56,7 @@ "keywords": [ | ||
"application" | ||
] | ||
], | ||
"devDependencies": { | ||
"selenium-webdriver": "^4.18.1", | ||
"vitest": "^1.4.0" | ||
} | ||
} |
192
README.md
# nw | ||
An installer for [NW.js](https://nwjs.io). | ||
An npm installer for [NW.js](https://nwjs.io). | ||
> NW.js is a runtime-environment based on Chromium and Node.js. It is used to build desktop applications that run on Windows, OSX, and Linux. | ||
[![npm](https://img.shields.io/npm/v/nw)](https://www.npmjs.com/package/nw) | ||
[![npm](https://img.shields.io/npm/v/nw.svg?style=flat)](https://www.npmjs.com/package/nw) | ||
## Install | ||
## usage | ||
Install locally to your project with: `npm install nw` and then in your `package.json` add a script: | ||
### Latest version globally | ||
```json | ||
{ | ||
"scripts": { | ||
"start": "nw" | ||
} | ||
} | ||
```shell | ||
npm install -g nw | ||
``` | ||
Now it will run your local project when you type `npm start`. | ||
You might run into issues installing globally. [Learn how to fix this](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally) | ||
If your project is in another folder, add the path to the project `"start": "nw path/to/app"`. | ||
### Latest version of normal build flavor: | ||
You could also call `nw` directly from `node_modules/.bin/nw` instead of adding to your `package.json`. | ||
```shell | ||
npm install --save-dev nw | ||
``` | ||
### global | ||
You can also install globally with `npm install nw -g` and then in any project type `nw` to run the project. Installing locally is recommended though as each project can have its own dependent version of nw.js. | ||
### Specific version with changes to installer: | ||
## example | ||
If you want a really quick example try this: | ||
```shell | ||
npm install --save-dev nw@0.85.0-1 | ||
``` | ||
1. `git clone https://github.com/zcbenz/nw-sample-apps && cd nw-sample-apps` | ||
2. `npm init` | ||
3. `npm install nw` | ||
4. `"node_modules/.bin/nw" file-explorer` | ||
> You may use `npm view nw versions` to view the list of available versions. | ||
and now you should see a file explorer demo app. | ||
### Specify build flavor: | ||
## command line options | ||
There are a few (platform-specific) arguments you can pass to the `nw` executable to | ||
customize your nw.js application: | ||
```shell | ||
npm install --save-dev nw@sdk | ||
``` | ||
* `--mac_plist <path-to-plist-file>`: (OS X only) Copies the given file to Info.plist in the app | ||
bundle. This lets you do things like change your app's name and point to a different icon. | ||
> Optionally set `nwjs_build_type=sdk` in `.npmrc` or `NWJS_BUILD_TYPE=sdk` environment variable. | ||
* `--mac_icon <path-to-icns-file>`: (OS X only) Copies the given .icns file to the Resources/ dir | ||
in the app bundle. You will need to point to the file with a custom plist file as well (see | ||
`--mac_list`) | ||
### Specify platform: | ||
**NOTE**: These options will keep the copied files in the app bundle for as long as the bundle is | ||
on the filesystem (they're not deleted between app invocations). As a result, they're not | ||
recommended if you installed nw globally using `-g`. Also note that | ||
[OS X caches these files](http://proteo.me.uk/2011/08/mac-application-bundle-caching/), | ||
so you may need to manually clear these cached files during development. | ||
Set `nwjs_platform` in `.npmrc` or `NWJS_PLATFORM` environment variable. Defaults to `process.platform`. | ||
## install a specific version of nw.js | ||
### Specify architecture: | ||
To install a specific version of nw.js use npm with the specific version: `npm install nw@0.12.0` | ||
Set `nwjs_arch` in `.npmrc` or `NWJS_ARCH` environment variable. Defaults to `process.arch`. | ||
> *Please note:* This npm package version tracks the version of nw.js that will be installed, with an additional build number that is used for revisions to the installer. As such `0.12.0-1` and `0.12.0-2` will both install `nw.js@0.12.0` but the latter has newer changes to the installer. | ||
### Specify cache directory: | ||
You may use `npm view nw versions` to view the list of available versions. | ||
Set `nwjs_cache_dir` in `.npmrc` or `NWJS_ARCH` environment variable. Defaults to `./node_modules/nw`. | ||
## install a specific build type of nw.js | ||
### Specify cache flag: | ||
nw.js has three build types: `normal`, `sdk` and `nacl`. To install a specific build type you may set npm config property `nwjs_build_type`, environment variable `NWJS_BUILD_TYPE` or pass command line option `--nwjs_build_type`: | ||
Set `nwjs_cache` in `.npmrc` or `NWJS_ARCH` environment variable to keep or delete cached binaries. Defaults to `true`. | ||
``` shell | ||
npm install nw --nwjs_build_type=sdk | ||
``` | ||
### Specify ffmpeg flag: | ||
Setting option in `.npmrc` file (https://www.npmjs.org/doc/files/npmrc.html): | ||
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`. | ||
``` | ||
nwjs_build_type=sdk | ||
``` | ||
### Specify Native Addon flag: | ||
Setting environment variable `NWJS_BUILD_TYPE`: | ||
Set `nwjs_native_addon` in `.npmrc` or `NWJS_NATIVE_ADDON` environment variable to toggle downloading NW.js Node headers. Defaults to `false`. | ||
``` shell | ||
export NWJS_BUILD_TYPE=sdk | ||
``` | ||
### Specify download URL: | ||
You can alternatively install `sdk` build by specifying `-sdk` suffix in version: | ||
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`). | ||
``` shell | ||
npm install nw@0.13.3-sdk | ||
``` | ||
## Usage | ||
You can also run `npm install nw@sdk` to get the latest of published SDK versions. (Note: that may be a beta version.) | ||
Add a script in your `package.json`: | ||
## install a specific architecture | ||
```json | ||
{ | ||
"scripts": { | ||
"start": "nw /path/to/app" | ||
} | ||
} | ||
``` | ||
You may use the environment variable `npm_config_nwjs_process_arch` to override the default architecture (`process.arch`) and to download NW.js built for some other architecture. | ||
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`. | ||
## finding the path to the nw.js binary | ||
## APIs | ||
If you would like to programmatically retrieve the path to the nw.js binary use: | ||
### Find path to the NW.js binary: | ||
``` js | ||
var findpath = require('nw').findpath; | ||
var nwpath = findpath(); | ||
// nwpath will equal the path to the binary depending on your environment | ||
import { findpath } from 'nw'; | ||
var path = findpath(); | ||
``` | ||
## finding the path to the chromedriver binary | ||
## Find the path to the chromedriver binary | ||
If you would like to programmatically retrieve the path to the chromedriver use: | ||
``` js | ||
var findpath = require('nw').findpath; | ||
var chromedriver_path = findpath('chromedriver'); | ||
// chromedriver_path will equal the path to the binary depending on your environment | ||
import { findpath } from 'nw'; | ||
var path = findpath('chromedriver'); | ||
``` | ||
Then you can use that path to run NW.js programmatically. For example, to run in the current script's directory: | ||
## Download specific versions independant of installer version | ||
```js | ||
require('child_process').spawn( | ||
require('nw').findpath(), | ||
['.'].concat( process.argv.slice(2) ), | ||
{ | ||
cwd: __dirname, | ||
detached: true, | ||
stdio: 'ignore' | ||
} | ||
).unref(); | ||
``` | ||
import { get } from 'nw'; | ||
## retrieve binaries from custom download location or file path | ||
The installer attempts to download binaries from the default location of `https://dl.nwjs.io/v`. You can override this by setting the npm config property `nwjs_urlbase` on the command line by passing the `--nwjs_urlbase` option: | ||
``` shell | ||
npm install nw --nwjs_urlbase=http://my.own.location/somewhere | ||
await get({ | ||
// options | ||
}); | ||
``` | ||
or adding it to your `.npmrc` file (https://www.npmjs.org/doc/files/npmrc.html): | ||
Options: | ||
``` | ||
nwjs_urlbase=http://my.own.location/somewhere | ||
``` | ||
| Name | Type | Default | Description | | ||
| ---- | ------- | --------- | ----------- | | ||
| version | `string \| "latest" \| "stable"` | `"latest"` | Runtime version | | ||
| flavor | `"normal" \| "sdk"` | `"normal"` | Runtime flavor | | ||
| platform | `"linux" \| "osx" \| "win"` | | Host platform | | ||
| arch | `"ia32" \| "x64" \| "arm64"` | | Host architecture | | ||
| 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 | | ||
| cacheDir | `string` | `"./cache"` | Directory to cache NW binaries | | ||
| cache | `boolean` | `true`| If true the existing cache is used. Otherwise it removes and redownloads it. | | ||
| ffmpeg | `boolean` | `false`| If true the chromium ffmpeg is replaced by community version with proprietary codecs. | | ||
| nodeAddon | `false \| "gyp"` | `false` | Download Node headers | | ||
You can alternatively set an environment variable `NWJS_URLBASE`: | ||
## License | ||
``` shell | ||
export NWJS_URLBASE=http://my.own.location/somewhere | ||
``` | ||
The installer supports `file://` URLs to retrieve files from the local filesystem: | ||
``` shell | ||
export NWJS_URLBASE=file:///home/bilbo/my/own/mirror | ||
``` | ||
## using a proxy with or without authentication | ||
If you are behind a proxy server you have to set an environment variable `http_proxy` with proxy servers url: | ||
``` | ||
export http_proxy="http://username:password@myproxy.com:8080" | ||
``` | ||
or | ||
``` | ||
export http_proxy="http://myproxy.com:8080" | ||
``` | ||
(However, if the environment variable `https_proxy` is set, then it will be preferred, as [programmed](https://github.com/kevva/get-proxy/blob/master/index.js) in the `get-proxy` package.) | ||
## license | ||
[nw.js](https://github.com/nwjs/nw.js)'s code and this installer use the MIT license. | ||
[NW.js](https://github.com/nwjs/nw.js)'s code and this installer use the MIT license. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 16 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
33192
19
799
Yes
6
2
124
34
1
+ Addedaxios@^1.6.8
+ Addedcommander@^12.0.0
+ Addedtar@^6.2.1
+ Addedyauzl-promise@^4.0.0
+ Added@babel/runtime@7.26.0(transitive)
+ Added@emnapi/core@1.3.1(transitive)
+ Added@emnapi/runtime@1.3.1(transitive)
+ Added@emnapi/wasi-threads@1.0.1(transitive)
+ Added@napi-rs/wasm-runtime@0.2.6(transitive)
+ Added@node-rs/crc32@1.10.6(transitive)
+ Added@node-rs/crc32-android-arm-eabi@1.10.6(transitive)
+ Added@node-rs/crc32-android-arm64@1.10.6(transitive)
+ Added@node-rs/crc32-darwin-arm64@1.10.6(transitive)
+ Added@node-rs/crc32-darwin-x64@1.10.6(transitive)
+ Added@node-rs/crc32-freebsd-x64@1.10.6(transitive)
+ Added@node-rs/crc32-linux-arm-gnueabihf@1.10.6(transitive)
+ Added@node-rs/crc32-linux-arm64-gnu@1.10.6(transitive)
+ Added@node-rs/crc32-linux-arm64-musl@1.10.6(transitive)
+ Added@node-rs/crc32-linux-x64-gnu@1.10.6(transitive)
+ Added@node-rs/crc32-linux-x64-musl@1.10.6(transitive)
+ Added@node-rs/crc32-wasm32-wasi@1.10.6(transitive)
+ Added@node-rs/crc32-win32-arm64-msvc@1.10.6(transitive)
+ Added@node-rs/crc32-win32-ia32-msvc@1.10.6(transitive)
+ Added@node-rs/crc32-win32-x64-msvc@1.10.6(transitive)
+ Added@tybys/wasm-util@0.9.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.9(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@12.1.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedfs-minipass@2.1.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedis-it-type@5.1.2(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminipass@3.3.65.0.0(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedsimple-invariant@2.0.1(transitive)
+ Addedtar@6.2.1(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedyallist@4.0.0(transitive)
+ Addedyauzl-promise@4.0.0(transitive)
- Removedcli-progress@^3.12.0
- Removedcompressing@^1.10.0
- Removed@eggjs/yauzl@2.11.0(transitive)
- Removedbl@1.2.3(transitive)
- Removedbuffer-alloc@1.2.0(transitive)
- Removedbuffer-alloc-unsafe@1.1.0(transitive)
- Removedbuffer-crc32@0.2.13(transitive)
- Removedbuffer-fill@1.0.0(transitive)
- Removedcli-progress@3.12.0(transitive)
- Removedcompressing@1.10.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedfd-slicer2@1.2.0(transitive)
- Removedflushwritable@1.0.0(transitive)
- Removedfs-constants@1.0.0(transitive)
- Removedget-ready@1.0.0(transitive)
- Removediconv-lite@0.5.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedonce@1.4.0(transitive)
- Removedpend@1.2.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedstreamifier@0.1.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtar-stream@1.6.2(transitive)
- Removedto-buffer@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedxtend@4.0.2(transitive)
- Removedyazl@2.5.1(transitive)