https://github.com/alvarolorentedev/any-prebuilt
wrapper for prebuilt packages
https://github.com/alvarolorentedev/any-prebuilt
prebuilt prebuilt-packages
Last synced: over 1 year ago
JSON representation
wrapper for prebuilt packages
- Host: GitHub
- URL: https://github.com/alvarolorentedev/any-prebuilt
- Owner: alvarolorentedev
- License: mit
- Created: 2017-01-24T11:38:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T00:11:42.000Z (about 2 years ago)
- Last Synced: 2024-04-13T19:31:19.497Z (about 2 years ago)
- Topics: prebuilt, prebuilt-packages
- Language: JavaScript
- Size: 1.54 MB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 
[](https://travis-ci.org/kanekotic/any-prebuilt)
[](https://codecov.io/gh/kanekotic/any-prebuilt)
[](https://github.com/kanekotic/any-prebuilt)
[](https://github.com/kanekotic/any-prebuilt/blob/master/LICENSE)
[](https://GitHub.com/kanekotic/any-prebuilt/graphs/commit-activity)
[](https://www.paypal.me/kanekotic/)
# Mission
Easy generator or integration of prebuilt packages for use with `npm` or `yarn`. It helps fetchs prebuilt binaries from github releases that will be bind as part of your package.
# Generate a prebuilt package
1. Create new project
```
npm init
```
2. Add this package as dependency
```
npm install any-prebuilt --save
```
3. Create `postinstall.js` file with content:
```js
require('any-prebuilt').install(require('./package.json').prebuilt)
```
4. Create `index.js` file with content:
```js
var anyPrebuilt = require('any-prebuilt')
anyPrebuilt.initialize(__dirname, require('./package.json').prebuilt)
module.exports.path = anyPrebuilt.path
```
5. On the `package.json` add a prebuilt element (you can also add this to any other file that provides a jason object to both index and postinstall.js).
```
"prebuilt": {
"arch": , // Target architecture (supported: `ia32` / `x64`. Default value: machine's architecture)
"platform": , //Target platform (supported: `win` / `osx` / `linux`. Default value: machine's platform)
"version": , //Target version (format: `vX.Y.Z`. Default value: latest)
"targetDir": , //Target directory (where to install the binaries. Default value: `./bin`)
"targetBin": , //Target binary (the precompiled binary to be required in node. No default value)
"user": , // user or Organization (format: string. Is `required`)
"repo": , //Origin repo (format: string. Is `required`)
"token": //Github token (format: string. `required` if private repo)
}
```
6. In your `package .json` add the next script:
```
"scripts": {
"postinstall": "node postinstall.js"
}
```
As seen before this can be configured using a json object but also can be configured or overrided using the next enviroment variables `PREBUILT_ARCH`, `PREBUILT_PLATFORM`, `PREBUILT_VERSION`, `PREBUILT_BINARY`, `PREBUILT_TOKEN`, `PREBUILT_REPO`, `PREBUILT_USER` and `PREBUILT_TARGET_DIR` environment variables.
### Logo
Hours graphic by Freepik from Flaticon is licensed under CC BY 3.0. Made with Logo Maker