mapbox / mapbox/cpp

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

Abierto
#20 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Sin datos de lenguaje
Estrellas
110
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## 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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp, nodejs
Área
release, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.