Move Node.js package.json to platform/node (#2343)

Co-authored-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
Bart Louwers
2024-07-10 16:15:26 +02:00
committed by GitHub
parent a34817c4a7
commit 41ff7c3b0d
14 changed files with 137 additions and 456 deletions

View File

@@ -5,13 +5,14 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/module.cmake)
add_node_module(
mbgl-node
INSTALL_PATH ${PROJECT_SOURCE_DIR}/lib/{node_abi}/mbgl.node
INSTALL_PATH ${PROJECT_SOURCE_DIR}/platform/node/lib/{node_abi}/mbgl.node
NAN_VERSION 2.19.0
EXCLUDE_NODE_ABIS
46
47
48
51
127
)
if(WIN32)

View File

@@ -1,13 +1,17 @@
# Instructions for making a Node release
1. Change the version number in package.json. on the command line, in the package root directory, run the following command, replacing <update_type> with one of the semantic versioning release types (prerelease, prepatch, preminor, premajor, patch, minor, major):
1. Open a command prompt to 'platform/node'
cd platform/node
2. Change the version number in package.json. on the command line, in the package root directory, run the following command, replacing <update_type> with one of the semantic versioning release types (prerelease, prepatch, preminor, premajor, patch, minor, major):
npm version <update_type> --preid pre --no-git-tag-version
2. Update the changelog, which can be found in `platform/node/CHANGELOG.md`. The heading must match `## <VERSION>` exactly, or it will not be picked up. For example, for version 5.2.0:
3. Update the changelog, which can be found in `platform/node/CHANGELOG.md`. The heading must match `## <VERSION>` exactly, or it will not be picked up. For example, for version 5.2.0:
```
## 5.2.0
```
3. Commit and push the changes. On push the 'node-release' workflow will automaticlly check if the release has been published on npm. If the release has not yet been published, the workflow will build the node binaries and upload them to a new github release, then publish a new npm release.
4. Commit and push the changes. On push the 'node-release' workflow will automaticlly check if the release has been published on npm. If the release has not yet been published, the workflow will build the node binaries and upload them to a new github release, then publish a new npm release.

View File

@@ -59,7 +59,7 @@ function(add_node_module NAME)
set(_CACHE_DIR "${NODE_MODULE_CACHE_DIR}")
endif()
if (NOT _INSTALL_PATH)
set(_INSTALL_PATH "lib/{node_abi}/${NAME}.node")
set(_INSTALL_PATH "platform/node/lib/{node_abi}/${NAME}.node")
endif()
get_filename_component(_CACHE_DIR "${_CACHE_DIR}" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
if(_UNPARSED_ARGUMENTS)

View File

@@ -2,7 +2,7 @@
// Shim to wrap req.respond while preserving callback-passing API
var mbgl = require('../../lib/node-v' + process.versions.modules + '/mbgl');
var mbgl = require('./lib/node-v' + process.versions.modules + '/mbgl');
var constructor = mbgl.Map.prototype.constructor;
var Map = function(options) {

View File

@@ -0,0 +1,79 @@
{
"name": "@maplibre/maplibre-gl-native",
"version": "5.4.0",
"description": "Renders map tiles with MapLibre Native",
"keywords": [
"maplibre",
"gl"
],
"directories": {
"lib": "lib"
},
"files": [
"lib",
"index.d.ts"
],
"main": "index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/maplibre/maplibre-native.git"
},
"license": "BSD-2-Clause",
"dependencies": {
"@acalcutt/node-pre-gyp": "^1.0.14",
"@acalcutt/node-pre-gyp-github": "1.4.8",
"minimatch": "^9.0.4",
"npm-run-all": "^4.1.5"
},
"devDependencies": {
"@aws-sdk/client-device-farm": "^3.556.0",
"@aws-sdk/client-s3": "^3.556.0",
"@mapbox/flow-remove-types": "^2.0.0",
"@mapbox/mvt-fixtures": "3.10.0",
"@octokit/plugin-retry": "^7.1.0",
"@octokit/rest": "^20.1.0",
"@types/node": "^20.12.7",
"argparse": "^2.0.1",
"csscolorparser": "~1.0.3",
"d3-queue": "3.0.7",
"diff": "5.2.0",
"ejs": "^3.1.9",
"esm": "~3.2.25",
"express": "^4.19.2",
"json-stringify-pretty-compact": "^4.0.0",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"lodash.template": "4.5.0",
"mapbox-gl-styles": "2.0.2",
"pixelmatch": "^5.3.0",
"pngjs": "^7.0.0",
"pretty-bytes": "^6.1.1",
"request": "^2.88.0",
"semver": "^7.6.0",
"shuffle-seed": "1.1.6",
"st": "3.0.0",
"tape": "^5.7.5",
"typescript": "^5.4.5",
"xcode": "^3.0.1"
},
"engines": {
"node": ">=6"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build=false",
"test": "tape test/js/**/*.test.js",
"test-memory": "node --expose-gc test/memory.test.js",
"test-expressions": "node -r esm test/expression.test.js",
"test-render": "node -r esm test/render.test.js",
"test-query": "node -r esm test/query.test.js"
},
"gypfile": true,
"binary": {
"module_name": "mbgl",
"module_path": "./lib/{node_abi}",
"host": "https://github.com/maplibre/maplibre-native/releases/download/",
"remote_path": "node-v{version}",
"package_name": "{node_abi}-{platform}-{arch}-{configuration}.tar.gz"
}
}

View File

@@ -4,7 +4,7 @@ var fs = require('fs');
var path = require('path');
function readFixture(file) {
return fs.readFileSync(path.join('test/fixtures/resources', file));
return fs.readFileSync(path.join('../../test/fixtures/resources', file));
}
var style_raster = readFixture('style_raster.json').toString('utf8');