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

未关闭
#20 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp, nodejs
领域
release, tooling

调研方向

定位此仓库中的 header-only C++ 库,并将 Nan 的 package.json 和 include_dirs.js 模式与链接的示例进行比较。为每个库添加所请求的包元数据,然后运行 npm pack 并检查 tarball,以确认其中仅包含头文件和 npm 的默认文件。

由索引模型根据 Issue 内容生成。

描述

rational

We are increasingly working on small node C++ modules that depend on header-only C++ libs.
Node.js's Nan module 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 howNan 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:

Example use case:

主要语言
没有语言数据
星标
110
派生
17
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mapbox/cpp 的其他 Issue

查看 mapbox/cpp 的全部 Issue

相似的 Issue

更多 Release Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。