1.0.0 • Published 6 years ago

create-node-addon v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Create Node Addon

create-node-addon is a CLI tool for bootstrapping Node Addons with node-gyp. It applies nan as a source of abstraction between Node and direct V8 APIs.

Prerequisites

Install node-gyp then configurations will be done automatically. Run:

  • Check the complete guide to this step here.
$ npm install -g node-gyp
  • For Windows, you can find the latest release of MSVC++ build tools here.

Setup

Install create-node-addon by running:

$ npm install -g create-node-addon
# Or with Yarn
$ yarn global add create-node-addon

Bootstrapping a project

To create a new addon project, execute:

$ create-node-addon <addon-name> [--options]

Where <addon-name> is the name of your Native Addon and is required. Space-separated values can be used to create multiple addons. If <addon-name> is equivalent to the character ., then templates will be created in the current working directory of the host.

After this, you'll see a folder with all project requirements in a package.json. Execute npm run build:release or yarn build:release to compile the C++ source files with node-gyp. Then run npm start or yarn start to run your Native Addon in node.

Run create-node-addon --help for more details on what options are available. If you encounter any bug or related issue, file an issue.

If you liked this tool, please consider supporting my work!