anvaka / ngraph.path

Path finding in a graph
https://anvaka.github.io/ngraph.path.demo/
MIT License
3.02k stars 185 forks source link

Adds a umd build in the dist directory #8

Closed erenard closed 5 years ago

erenard commented 5 years ago

Hello, I needed to use ngraph.path and ngraph.graph in a browser environment. In their current states theses libraries' sources are in the commonjs modules.

This PR adds webpack as a build system to produce an UMD version of the library. The next step would be to uploaded the UMD on a CDN.

You will find the same PR on ngraph.graph.

anvaka commented 5 years ago

Eric, thank you so much for the contribution!

I'd love to merge it but I'd like to ask for couple changes if I may:

  1. Please switch from webpack to browserify:
npm i browserify uglify-js --save-dev

The build script would be:

"build": "browserify -s ngraphPath ./index.js > dist/ngraph.path.js && uglifyjs dist/ngraph.path.js > dist/ngraph.path.min.js"

Main reason for this request is that node_modules with webpack has 108MB disk space usage, while browserify solution only takes 14MB. Also dependency tree of webpack has 337 nodes while browserify is only 138.

  1. You don't need to provide minified version of the scripts - I'll build it locally and publish to npm.

I'd love to see your name in the logs of this library, and hope you can make these changes here and in the ngraph.graph

Thank you!

erenard commented 5 years ago

Hello Andrei,

I replaced webpack by browserify and added dist to the .gitignore.

You should see the changes in the request.

One thing has almost driven me nutz: Browserify silently refused to bundle until I removed the "browser" entry from package.json.

Have a nice day and thank you.

Eric

anvaka commented 5 years ago

Thank you! This was published as v1.1.0