mapbox / mapbox/cpp

Docs on publishing of header-only C++ libs (include in node c++ modules)

オープン
#20 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
言語のデータがありません
スター
110
フォーク
17
PR マージ指標
30日以内にマージされた PR はありません

説明

## rational

We are increasingly working on small node C++ modules that depend on header-only C++ libs.
Node.js's [`Nan` module](https://github.com/nodejs/nan) has pioneered a best practice for how to include header only C++ libs in node C++ addons by simply adding a `package.json` and `include_dirs.js` file to the root of the project. I think we should follow the lead of how`Nan` does this and package all our C++ header only libs in npm as well as mason. I think publishing in two places is worth it because it makes including the libraries from node modules very easy and consistent with how JS modules work.

## method

Add:

- package.json
- include_dirs.js
- `files` parameter to `package.json` so that only the `include/` directory is included

Example:

```
{
"name": "@mapbox/geometry-hpp",
"version": "0.9.0",
"description": "A C++ header only geometry type library",
"main": "./include_dirs.js",
"repository" : {
"type" : "git",
"url" : "git://github.com/mapbox/geometry.hpp.git"
},
"files": [
"include"
]
}
```

Then test that only the right files are going to be packaged:

```
npm pack
tar -ztvf *tgz
```

^^ that should list just the headers and the default files npm includes like `README.md` and `package.json` etc

Examples:

- https://github.com/mapbox/protozero/pull/59
- https://github.com/osmcode/libosmium/pull/186

Example use case:

- https://github.com/springmeyer/node-osmium-count/blob/master/package.json#L17

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Locate the header-only C++ libraries in this repository and compare Nan's package.json and include_dirs.js pattern with the linked examples. Add the requested package metadata for each library, then run npm pack and inspect the tarball to confirm it contains the headers and npm's default files only.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, nodejs
領域
release, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。