Code Monkey home page Code Monkey logo

any-prebuilt's Introduction

logomakr_3dkn9b

Build Status codecov npm GitHub license Maintenance Donate

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
  1. Add this package as dependency
npm install any-prebuilt --save
  1. Create postinstall.js file with content:
require('any-prebuilt').install(require('./package.json').prebuilt)
  1. Create index.js file with content:
var anyPrebuilt = require('any-prebuilt')
anyPrebuilt.initialize(__dirname, require('./package.json').prebuilt)
module.exports.path = anyPrebuilt.path
  1. 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": <string>, // Target architecture (supported: `ia32` / `x64`. Default value: machine's architecture)
    "platform": <string>, //Target platform (supported: `win` / `osx` / `linux`. Default value: machine's platform)
    "version": <string>, //Target version (format: `vX.Y.Z`. Default value: latest)
    "targetDir": <string>, //Target directory (where to install the binaries. Default value: `./bin`)
    "targetBin": <string>, //Target binary (the precompiled binary to be required in node. No default value)
    "user": <string>, // user or Organization (format: string. Is `required`)
    "repo": <string>, //Origin repo (format: string. Is `required`)
    "token": <string> //Github token (format: string. `required` if private repo)
  }
  1. 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

any-prebuilt's People

Contributors

github-actions[bot] avatar yukinying avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

yukinying

any-prebuilt's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.