Docs on publishing of header-only C++ libs (include in node c++ modules)
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 110
- Fork
- 17
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
## 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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp, nodejs
- Lĩnh vực
- release, tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100