Skip to content

Commit 5ee1a2f

Browse files
authored
Point users towards prebuildify (#150)
1 parent 97ff071 commit 5ee1a2f

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

README.md

+24-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11
# prebuild-install
22

3-
> A command line tool to easily install prebuilt binaries for multiple version of node/iojs on a specific platform.
3+
> **A command line tool to easily install prebuilt binaries for multiple versions of Node.js & Electron on a specific platform.**
4+
> By default it downloads prebuilt binaries from a GitHub release.
45
56
[![npm](https://img.shields.io/npm/v/prebuild-install.svg)](https://www.npmjs.com/package/prebuild-install)
67
![Node version](https://img.shields.io/node/v/prebuild-install.svg)
78
[![Test](https://github.com/prebuild/prebuild-install/actions/workflows/test.yml/badge.svg)](https://github.com/prebuild/prebuild-install/actions/workflows/test.yml)
89
[![david](https://david-dm.org/prebuild/prebuild-install.svg)](https://david-dm.org/prebuild/prebuild-install)
910
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
1011

11-
`prebuild-install` supports installing prebuilt binaries from GitHub by default.
12+
## Note
13+
14+
**Instead of [`prebuild`](https://github.com/prebuild/prebuild) paired with [`prebuild-install`](https://github.com/prebuild/prebuild-install), we recommend [`prebuildify`](https://github.com/prebuild/prebuildify) paired with [`node-gyp-build`](https://github.com/prebuild/node-gyp-build).**
15+
16+
With `prebuildify`, all prebuilt binaries are shipped inside the package that is published to npm, which means there's no need for a separate download step like you find in `prebuild`. The irony of this approach is that it is faster to download all prebuilt binaries for every platform when they are bundled than it is to download a single prebuilt binary as an install script.
17+
18+
Upsides:
19+
20+
1. No extra download step, making it more reliable and faster to install.
21+
2. Supports changing runtime versions locally and using the same install between Node.js and Electron. Reinstalling or rebuilding is not necessary, as all prebuilt binaries are in the npm tarball and the correct one is simply picked on runtime.
22+
3. The `node-gyp-build` runtime dependency is dependency-free and will remain so out of principle, because introducing dependencies would negate the shorter install time.
23+
4. Prebuilt binaries work even if npm install scripts are disabled.
24+
5. The npm package checksum covers prebuilt binaries too.
25+
26+
Downsides:
27+
28+
1. The installed npm package is larger on disk. Using [Node-API](https://nodejs.org/api/n-api.html) alleviates this because Node-API binaries are runtime-agnostic and forward-compatible.
29+
2. Publishing is mildly more complicated, because `npm publish` must be done after compiling and fetching prebuilt binaries (typically in CI).
1230

1331
## Usage
1432

15-
Change your package.json install script to:
33+
Use [`prebuild`](https://github.com/prebuild/prebuild) to create and upload prebuilt binaries. Then change your package.json install script to:
1634

1735
```json
1836
{
@@ -22,10 +40,6 @@ Change your package.json install script to:
2240
}
2341
```
2442

25-
### Requirements
26-
27-
You need to provide prebuilds made by [`prebuild`](https://github.com/prebuild/prebuild).
28-
2943
### Help
3044

3145
```
@@ -46,9 +60,9 @@ prebuild-install [options]
4660
--version (print prebuild-install version and exit)
4761
```
4862

49-
When `prebuild-install` is run via an `npm` script, options
50-
`--build-from-source`, `--debug`, `--download`, `--target`, `--runtime`, `--arch` and `--platform` may be passed through via
51-
arguments given to the `npm` command. Alternatively you can set environment variables `npm_config_build_from_source=true`, `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
63+
When `prebuild-install` is run via an `npm` script, options `--build-from-source`, `--debug`, `--download`, `--target`, `--runtime`, `--arch` and `--platform` may be passed through via arguments given to the `npm` command.
64+
65+
Alternatively you can set environment variables `npm_config_build_from_source=true`, `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
5266

5367
### Private Repositories
5468

0 commit comments

Comments
 (0)