Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cpp-npm-package-boilerplate

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpp-npm-package-boilerplate

A boilerplate for creating a C++ npm package

  • 0.0.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

:package: cpp-npm-package-boilerplate

:package: cpp-npm-package-boilerplate

A boilerplate for creating a C++ npm package

Issues GitHub pull requests GitHub Downloads GitHub Total Downloads GitHub release

Report Bug Request Feature

Systems on which it has been tested:

Ubuntu

Did you like the project? Please, considerate a donation to help improve!

A boilerplate for creating a C++ npm package

Getting started

Vulnerabilities

Reliability Rating codecov

Lines of Code Code Smells

Node.js build and publish package

Running Code Coverage Bugs

TypeScript Nodejs C++

NPM Free. Built on open source. Runs everywhere. GitHub Actions

Installation(Example purposes)

Install with yarn or npm: yarn or npm:

# yarn
yarn add cpp-npm-package-boilerplate
# npm
npm i cpp-npm-package-boilerplate --save

Usage example

import { helloNative } from 'cpp-npm-package-boilerplate';

helloNative('World'); // Hello World

Note: This is example is a binding of the C++ function helloNative to the JavaScript function helloNative.

C++ function
#include <napi.h>

Napi::String hello(const Napi::CallbackInfo& info) {
    Napi::Env env = info.Env();
    Napi::String name = info[0].As<Napi::String>();
    return Napi::String::New(env, "Hello " + name.Utf8Value());
}

Napi::Object Init(Napi::Env env, Napi::Object exports) {
    exports.Set(Napi::String::New(env, "hello"), Napi::Function::New(env, hello));
    return exports;
}

NODE_API_MODULE(hello, Init)

JavaScript function
import bindings from 'bindings';
export const helloNative = bindings('hello.node').hello;
TypeScript implementation
import bindings from 'bindings';

type THelloNative = (string: string) => string;

export const helloNative: THelloNative = bindings('hello.node').hello;

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Or buy me a coffee 🙌🏾

📝 License

Copyright © 2022 Hebert F Barros.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 10 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc