Leaflet / Leaflet.markercluster

Marker Clustering plugin for Leaflet
MIT License
3.98k stars 1k forks source link

How to use the latest version as a node module? #1104

Closed eriknikulski closed 8 months ago

eriknikulski commented 8 months ago

When I use npm install 'Leaflet/Leaflet.markercluster', the repo is downloaded. But dist/ does not contain any js files, these need to be build. So I adapted the package.json to use prepare: jake, (here: https://github.com/eriknikulski/Leaflet.markercluster/tree/patch-2), this works in the sense that the build process is started, but jake aborts with the error:

npm ERR! [!] Error: [git-rev-sync] no git repository found
npm ERR! Error: [git-rev-sync] no git repository found
npm ERR!     at _getGitDirectory (/home/go/.npm/_cacache/tmp/git-clone1DaRXN/node_modules/git-rev-sync/index.js:47:11)
npm ERR! (See full trace by running task with --trace)

which is the result of the folder being not controlled by git.

How can I use a recent version of this package in my dependencies?

eriknikulski commented 8 months ago

Ok, I solved it for me. The solution is a bit hacky but works. For anyone looking to do something similar, just add

"prepare": "git init && git add . && git commit -m \"Initial commit\" && git pack-refs && jake",

to the "scripts" section of the package.json