{"_id":"@mapbox/node-cpp-skel","_rev":"206-d6af24d26a7dab00d6757543be0ccad5","name":"@mapbox/node-cpp-skel","description":"Skeleton for bindings to C++ libraries for Node.js using N-API (node-addon-api)","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@mapbox/node-cpp-skel","version":"0.1.0","description":"Skeleton for bindings to C++ libraries for Node.js using NAN","url":"http://github.com/mapbox/node-cpp-skel","main":"./lib/index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/node-cpp-skel.git"},"scripts":{"test":"tape test/*.test.js","prepublish":"npm ls","install":"node-pre-gyp install --fallback-to-build","docs":"documentation build src/*.cpp src/standalone_async/*.cpp src/standalone/*.cpp --polyglot -f md -o API.md"},"author":{"name":"Mapbox"},"license":"ISC","dependencies":{"nan":"~2.5.1","node-pre-gyp":"~0.6.32"},"devDependencies":{"aws-sdk":"^2.4.7","tape":"^4.5.1"},"binary":{"module_name":"module","module_path":"./lib/binding/","host":"https://mapbox-node-binary.s3.amazonaws.com","remote_path":"./{name}/v{version}/{configuration}/{toolset}/","package_name":"{node_abi}-{platform}-{arch}.tar.gz"},"gitHead":"fc324fd4cb9a0246d34087e6311f80c5e119b1e4","bugs":{"url":"https://github.com/mapbox/node-cpp-skel/issues"},"homepage":"https://github.com/mapbox/node-cpp-skel#readme","bundleDependencies":["node-pre-gyp"],"_id":"@mapbox/node-cpp-skel@0.1.0","_shasum":"50d61cf984d30d3c28b01991b5d9a16a530e260c","_from":".","_npmVersion":"2.15.8","_nodeVersion":"4.4.7","_npmUser":{"name":"mapsam","email":"sam@mapbox.com"},"dist":{"shasum":"50d61cf984d30d3c28b01991b5d9a16a530e260c","tarball":"https://registry.npmjs.org/@mapbox/node-cpp-skel/-/node-cpp-skel-0.1.0.tgz","integrity":"sha512-EwARVXJBRFLoPOSzX3p7v3/MHxZaeh5l0o3AxQmKHBDU8Dym6msFv8Ohn3Hm1MNDFkb1Da5b6c/2JvpthJh/7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCLDF3ZfLP7Jy8iSKq7VICuqyBLWaPvkw1RzyeSKM2mtgIgEkU8ZEpTOcikYnGCIgXp8SJ3wmF1nXMkfez2/VNL3GQ="}]},"maintainers":[{"name":"mapsam","email":"sam@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-cpp-skel-0.1.0.tgz_1498504102034_0.2678367111366242"},"directories":{}},"0.2.0":{"name":"@mapbox/node-cpp-skel","version":"0.2.0","description":"Skeleton for bindings to C++ libraries for Node.js using N-API (node-addon-api)","url":"http://github.com/mapbox/node-cpp-skel","main":"./lib/index.js","repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/node-cpp-skel.git"},"scripts":{"test":"tape test/*.test.js","install":"node-pre-gyp install --fallback-to-build","docs":"documentation build src/standalone_async/*.cpp src/standalone/*.cpp src/object_sync/*.cpp src/object_async/*.cpp --polyglot -f md -o API.md"},"author":{"name":"Mapbox"},"license":"ISC","dependencies":{"@mapbox/mason-js":"^0.1.5","@mapbox/node-pre-gyp":"^1.0.0-alpha6","node-addon-api":"^3.1.0","node-pre-gyp":"^0.17.0"},"devDependencies":{"aws-sdk":"^2.840.0","bytes":"^3.1.0","d3-queue":"^3.0.7","minimist":"^1.2.5","tape":"^5.1.1"},"binary":{"module_name":"module","module_path":"./lib/binding/","host":"https://mapbox-node-binary.s3.amazonaws.com","remote_path":"./{name}/v{version}/{configuration}/{toolset}/","package_name":"{node_abi}-{platform}-{arch}.tar.gz"},"gitHead":"7de43a0464a74a4f9b31d518b1a806d68584dbfc","bugs":{"url":"https://github.com/mapbox/node-cpp-skel/issues"},"homepage":"https://github.com/mapbox/node-cpp-skel#readme","_id":"@mapbox/node-cpp-skel@0.2.0","_nodeVersion":"10.22.1","_npmVersion":"6.14.6","dist":{"integrity":"sha512-z5I+L0U8Lbytv/OZDlKC2LZhVOsVEFFOS3L7iLORgG52efnrSd9caXyvUvMehF3IASTz74AbQhNmOBGVFBCcGw==","shasum":"d50a4e8d3fc026f630a0e41e507e327a5747af49","tarball":"https://registry.npmjs.org/@mapbox/node-cpp-skel/-/node-cpp-skel-0.2.0.tgz","fileCount":53,"unpackedSize":1185947,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIr1pCRA9TVsSAnZWagAAwCMP/3SFhW24FYr3eKsWZosS\nNzjOVXfwf+WD9EURh12rsMlPe24zBI05jno/BMBmiOFvLKYk44N0DEDoCIZv\nkoGxbgr4sZdG1O3Gpu4sC6gF0dCOf4UA/kPQOQy/wc6M3iKwZpd3s221UR6w\nnJfi0qSF06Fh3gI8qqqj50d1sATVMMURjrKzUQ2OojtS13JFD66pugThs00O\nw5VFWK5feBXf3D9mmXD7ZT4svgAkrbgx9xiG/pF74NyeJp3RjBpWOM5lyntz\nz5m9aC2I6YvxWRSgRaqbKvZAT1d3xB1PUqfGSaxMJ/+0lyMJYl7zLbLkbk1k\nftvUCYLcWqNo2leCyFFlDWPZotOwepKda/dJ5GBIFaPF6FKCPoXwZfiIwU3i\nQUXs6JmwKHOq6pN6ri4BbBkr+6w0QhwoFydscW4KoXg5V8uEVwLptDVZeN1c\nsKYTRp0dypKuKKsD/nmtc0+5272mM5yabbdzl/XkXoSp7eqYajQAGj0z+UKB\nWnZ+BdV7AXX+2X9qZy1PhYfyZnUBpSyd6r97dqzgZXxbcFWevuelczhcGTef\nfnZTrPncDnD733BqF/rgqxCD77W+gPaQqojdddY4vy7a+Us3Wata5u4p5KJB\nPoK4Jmgj6v+rN1DvsYMvQ4jBDDDlx8x35k5A41s8Lliayd/1Dm9dWse6UYlw\np+T1\r\n=ke9C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFHKzzuEW7yWbrUMmvEL4Ta0hW2dYJ+2AYB6it1QPbtdAiBuy3VNHTuRo5JHqDJ1aBTVtJYwkoaF6CWluzgamvw7Yw=="}]},"_npmUser":{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},"directories":{},"maintainers":[{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},{"name":"mapbox-npm-07","email":"accounts+npmjs-07@mapbox.com"},{"name":"mapbox-npm-03","email":"accounts+npmjs-03@mapbox.com"},{"name":"mapbox-npm-04","email":"accounts+npmjs-04@mapbox.com"},{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},{"name":"mapbox-npm-05","email":"accounts+npmjs-05@mapbox.com"},{"name":"mapbox-npm-06","email":"accounts+npmjs-06@mapbox.com"},{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},{"name":"mapbox-npm-advanced-actions","email":"accounts+npmjs-advanced-actions@mapbox.com"},{"name":"mapbox-npm-ci","email":"accounts+npmjs-npm-ci@mapbox.com"},{"name":"mapbox-npm","email":"accounts+npmjs@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-cpp-skel_0.2.0_1612889448940_0.9503269149006517"},"_hasShrinkwrap":false}},"readme":"![dancing skel](https://raw.githubusercontent.com/mapbox/cpp/master/assets/node-cpp-skel-readme_blue.png)\n[![Build Status](https://travis-ci.com/mapbox/node-cpp-skel.svg?branch=master)](https://travis-ci.com/mapbox/node-cpp-skel)\n[![codecov](https://codecov.io/gh/mapbox/node-cpp-skel/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/node-cpp-skel)\n\nA skeleton for building a C++ addon for Node.js. This is a small, helper repository that generates simple `HelloWorld` Javascript example constructors. The examples have a number of methods to demonstrate different ways to use the Node C+ API for building particular types of functionality (i.e. asynchronous functions). Use this repo as both a template for your own code as well as a learning tool if you're just starting to develop Node/C++ Addons.\n\n**Why port C++ to Node.js?**. That's a great question! C++ is a high performance language that allows you to execute operations without clogging up the event loop. Node.js is single-threaded, which blocks execution. Even in highly optimized javascript code it may be impossible to improve performance. Passing heavy operations into C++ and subsequently into C++ workers can greatly improve the overall runtime of the code. Porting C++ code to Node.js is also referred to as creating an [\"Addon\"](https://github.com/mapbox/cpp/blob/master/node-cpp.md).\n\nMore examples of how to port C++ libraries to node can be found at [nodejs.org/api/addons.html](https://nodejs.org/api/addons.html).\n\n# What's in the box? :package:\n\nThis repository itself can be cloned and edited to your needs. The skeleton prepares a C++ port to Node.js and provides the following for quick development:\n\n* **Tests**: created with [Tape](https://github.com/substack/tape) in the `test/` directory. Travis CI file is prepared to build and test your project on every push.\n* **Documentation**: use this README as a template and customize for your own project. Also, this skeleton uses [documentation.js](http://documentation.js.org/) to generate API documentation from JSDOC comments in the `.cpp` files. Docs are located in `API.md`.\n* **[Benchmarking](./docs/benchmarking.md)**: Easily test the performance of your code using the built-in benchmark tests provided in this skeleton.\n* **Build system**: [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) generates binaries with the proper system architecture flags\n* **[Publishing](./docs/publishing-binaries.md)**: Structured as a node module with a `package.json` that can be deployed to NPM's registry.\n* **Learning resources**: Read the detailed inline comments within the example code to learn exactly what is happening behind the scenes. Also, check out the [extended tour](./docs/extended-tour.md) to learn more about Node/C++ Addon development, builds, Xcode, and more details about the configuration of this skeleton.\n\n# Installation\n\nEach `make` command is specified in [`Makefile`](./Makefile)\n\n```bash\ngit clone git@github.com:mapbox/node-cpp-skel.git\ncd node-cpp-skel\n\n# Build binaries. This looks to see if there were changes in the C++ code. This does not reinstall deps.\nmake\n\n# Run tests\nmake test\n\n# Cleans your current builds and removes potential cache\nmake clean\n\n# Build binaries in Debug mode (https://github.com/mapbox/cpp/blob/master/glossary.md#debug-build)\nmake debug\n\n# Cleans everything, including the things you download from the network in order to compile (ex: npm packages).\n# This is useful if you want to nuke everything and start from scratch.\n# For example, it's super useful for making sure everything works for Travis, production, someone else's machine, etc\nmake distclean\n\n# This skel uses documentation.js to auto-generate API docs.\n# If you'd like to generate docs for your code, you'll need to install documentation.js,\n# and then add your subdirectory to the docs command in package.json\nnpm install -g documentation@4.0.0\nnpm run docs\n```\n\nNOTE: we are pinned to `documentation@4.0.0` because 5.x removed C++ support: https://github.com/documentationjs/documentation/blob/master/CHANGELOG.md#500-2017-07-27\n\n### Customizing the compiler toolchain\n\nBy default we use `clang++` via [mason](https://github.com/mapbox/mason). The reason we do this is:\n\n - We want to run the latest and greatest compiler version, to catch the most bugs, provide the best developer experience, and trigger the most helpful warnings\n - We use clang-format to format the code and each version of clang-format formats code slightly differently. To avoid friction around this (and ensure all devs format the code the same) we default to using the same version of clang++ via mason.\n - We want to support [LTO](https://github.com/mapbox/cpp/blob/master/glossary.md#link-time-optimization) in the builds, which is difficult to do on linux unless you control the toolchain tightly.\n\nThe version of the clang++ binary (and related tools) is controlled by the [`mason-versions.ini`](./mason-versions.ini), and uses `mason-js` uses to install the toolchain.\n\nAll that said, it is still absolutely possible and encouraged to compile your module with another compiler toolchain. In fact we hope that modules based on node-cpp-skel do this!\n\nTo customize the toolchain you can override the defaults by setting these environment variables: CXX, CC, LINK, AR, NM. For example to use g++-6 you could do:\n\n\n```bash\nexport CXX=\"g++-6\"\nexport CC=\"gcc-6\"\nexport LINK=\"g++-6\"\nexport AR=\"ar\"\nexport NM=\"nm\"\nmake\n```\n\nThese environment variables will override the compiler toolchain defaults in `make_global_settings` in the [`binding.gyp`](./binding.gyp).\n\n\n### Warnings as errors\n\nBy default the build errors on compiler warnings. To disable this do:\n\n```\nWERROR=false make\n```\n\n### Sanitizers\n\nYou can run the [sanitizers](https://github.com/mapbox/cpp/blob/master/glossary.md#sanitizers), to catch additional bugs, by doing:\n\n```shell\nmake sanitize\n```\n\nThe sanitizers [are part of the compiler](https://github.com/mapbox/cpp/blob/master/glossary.md#sanitizers) and are also run in a specific job on Travis.\n\n# Add Custom Code\n\nDepending on your usecase, there are a variety of ways to start using this skeleton for your project.\n\n### Setup new project\nEasily use this skeleton as a starting off point for a _new_ custom project:\n\n```\n# Clone node-cpp-skel locally\n\ngit clone git@github.com:mapbox/node-cpp-skel.git\ncd node-cpp-skel/\n\n# Create your new repo on GitHub and have the remote repo url handy for liftoff\n# Then run the liftoff script from within your local node-cpp-skel root directory.\n#\n# This will:\n# - prompt you for the new name of your project and the new remote repo url\n# - automatically create a new directory for your new project repo\n# - create a new branch called \"node-cpp-skel-port\" within your new repo directory\n# - add, commit, and push that branch to your new repo\n\n./scripts/liftoff.sh\n\n```\n\n### Add your code\nOnce your project has ported node-cpp-skel, follow these steps to integrate your own code:\n\n- Create a dir in `./src` to hold your custom code. See the example code within `/src` for reference.\n- Add your new method or class to `./src/module.cpp`, and `#include` it at the top\n- Add your new file-to-be-compiled to the list of target sources in `./binding.gyp`\n- Run `make` and see what surprises await on your new journey :boat:\n\n### Adding dependencies\nWith updated versions of npm, a `package-lock.json` file is created, which is now included in node-cpp-skel. See [`npm-and-package-lock.md`](./docs/npm-and-package-lock.md) for more info on how to interact with this file and how to add new dependencies.\n\n### Interactive Debugging\n\n* [Debugging with VS Code](./docs/debugging-with-vs-code.md)\n\n# Code coverage\n\nCode coverage is critical for knowing how well your tests actually test all your code. To see code coverage you can view current results online at [![codecov](https://codecov.io/gh/mapbox/node-cpp-skel/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/node-cpp-skel) or you can build in a customized way and display coverage locally like:\n\n```\nmake coverage\n```\n\n**Note**\n\nUse [`// LCOV_EXCL_START` and `// LCOV_EXCL_STOP`](https://github.com/mapbox/vtvalidate/blob/master/src/vtvalidate.cpp#L70-L73) to ignore from [codecov](https://codecov.io/gh/mapbox/node-cpp-skel) _remotely_. However, this won't ignore when running coverage _locally_.\n\nFor more details about what `make coverage` is doing under the hood see https://github.com/mapbox/cpp#code-coverage.\n\n# Contributing and License\n\nContributors are welcome! :sparkles: This repo exists as a place to gather C++/Node Addon knowledge that will benefit the larger community. Please contribute your knowledge if you'd like.\n\nNode-cpp-skel is licensed under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/). Attribution is not required, but definitely welcome! If your project uses this skeleton, please add the node-cpp-skel badge to your readme so that others can learn about the resource.\n\n[![badge](https://mapbox.s3.amazonaws.com/cpp-assets/node-cpp-skel-badge_blue.svg)](https://github.com/mapbox/node-cpp-skel)\n\nTo include the badge, paste this into your README.md file:\n```\n[![badge](https://mapbox.s3.amazonaws.com/cpp-assets/node-cpp-skel-badge_blue.svg)](https://github.com/mapbox/node-cpp-skel)\n```\n\nSee [CONTRIBUTING](CONTRIBUTING.md) and [LICENSE](LICENSE.md) for more info.\n","maintainers":[{"email":"yannick.meeus+npm+production+ci@mapbox.com","name":"mbx-npm-ci-production"},{"email":"yannick.meeus+npm+staging+ci@mapbox.com","name":"mbx-npm-ci-staging"},{"email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-production"},{"email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com","name":"mbx-npm-advanced-actions-staging"},{"email":"yannick.meeus+npm+prod+09@mapbox.com","name":"mbx-npm-09-production"},{"email":"yannick.meeus+npm+prod+08@mapbox.com","name":"mbx-npm-08-production"},{"email":"yannick.meeus+npm+prod+07@mapbox.com","name":"mbx-npm-07-production"},{"email":"yannick.meeus+npm+prod+06@mapbox.com","name":"mbx-npm-06-production"},{"email":"yannick.meeus+npm+prod+05@mapbox.com","name":"mbx-npm-05-production"},{"email":"yannick.meeus+npm+prod+04@mapbox.com","name":"mbx-npm-04-production"},{"email":"yannick.meeus+npm+prod+03@mapbox.com","name":"mbx-npm-03-production"},{"email":"yannick.meeus+npm+prod+02@mapbox.com","name":"mbx-npm-02-production"},{"email":"yannick.meeus+npm+prod+01@mapbox.com","name":"mbx-npm-01-production"},{"email":"yannick.meeus@mapbox.com","name":"mbx-npm-02-staging"},{"email":"accounts+npmjs-01@mapbox.com","name":"mapbox-npm-01"},{"email":"accounts+npmjs-02@mapbox.com","name":"mapbox-npm-02"},{"email":"accounts+npmjs-07@mapbox.com","name":"mapbox-npm-07"},{"email":"accounts+npmjs-03@mapbox.com","name":"mapbox-npm-03"},{"email":"accounts+npmjs-04@mapbox.com","name":"mapbox-npm-04"},{"email":"accounts+npmjs-09@mapbox.com","name":"mapbox-npm-09"},{"email":"accounts+npmjs-05@mapbox.com","name":"mapbox-npm-05"},{"email":"accounts+npmjs-06@mapbox.com","name":"mapbox-npm-06"},{"email":"accounts+npmjs-08@mapbox.com","name":"mapbox-npm-08"},{"email":"accounts+npmjs-advanced-actions@mapbox.com","name":"mapbox-npm-advanced-actions"},{"email":"accounts+npmjs-npm-ci@mapbox.com","name":"mapbox-npm-ci"},{"email":"accounts+npmjs@mapbox.com","name":"mapbox-npm"},{"email":"accounts@mapbox.com","name":"mapbox-admin"},{"email":"accounts+npm-mapbox-machine-user@mapbox.com","name":"mapbox-machine-user"}],"time":{"modified":"2023-01-12T12:43:43.636Z","created":"2017-06-26T19:08:23.118Z","0.1.0":"2017-06-26T19:08:23.118Z","0.2.0":"2021-02-09T16:50:49.119Z"},"homepage":"https://github.com/mapbox/node-cpp-skel#readme","repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/node-cpp-skel.git"},"author":{"name":"Mapbox"},"bugs":{"url":"https://github.com/mapbox/node-cpp-skel/issues"},"license":"ISC","readmeFilename":"README.md"}