mstefaniuk / graph-viz-d3-js

Graphviz web D3.js renderer
MIT License
313 stars 38 forks source link

Publish to NPM #18

Open akinnee-gl opened 8 years ago

akinnee-gl commented 8 years ago

It would be awesome if this were published to NPM!

mstefaniuk commented 8 years ago

It is published in Bower. Could you convince me to publish to NPM in addition?

akinnee-gl commented 8 years ago

I had to do a lot of extra work to get it working in Browserify or Webpack. Lots of developers use those tools. Also, NPM is the largest module repository.

mstefaniuk commented 8 years ago

It looks not so complicated. Now dependencies of the component are managed by Bower and they are:

  "dependencies": {
    "requirejs": "2.1.15",
    "d3": "3.5.3",
    "requirejs-web-workers": "~1.0.1",
    "viz.js": "~1.3.0"
  }

Should I put these in package.json? As I checked there is no require.js worker plugin so some changes may be needed.

akinnee-gl commented 8 years ago

Installing those via npm should work. I also had to use a worker loader to make it work in webpack instead of the requirejs loader you have in your repo. https://www.npmjs.com/package/worker-loader

mstefaniuk commented 8 years ago

Could you create a pull request for that?

akinnee-gl commented 8 years ago

Worker-loader is something the developer would add to their build process. Would you like me to add that to the documentation?

mstefaniuk commented 8 years ago

My component uses worker plugin to load parsing and rendering WebWorker. Do you suggest to replace one plugin with another by component end developer?

akinnee-gl commented 8 years ago

Yes. You are using the requirejs web worker plugin. Webpack and Browserify have a similar module called worker-loader.

Here is a list of the changes I had to make to get this module working with Webpack:

After these changes, no dependency paths need to be added to a config file.

mstefaniuk commented 8 years ago

Do it, please. Current build and test process relies on Bower so take it also into account.

quiasmo commented 8 years ago

Hey, an NPM package to use with webpack sounds good to me too. @akinnee-gl Is there anything you need besides encouragmenent to get that pull request? Perhaps you could share your branch?

akinnee-gl commented 8 years ago

Actually, because this doesn't support all of the functionality of Viz.js, I ended up just using Viz.js directly.

tedwong commented 8 years ago

@akinnee-gl Would you kindly share your webpack.config.js? I have a hand time on deploy it using webpack. Thanks.

akinnee-gl commented 8 years ago

Personally I would recommend you just use Viz.js. It's less complicated and it's already on npm. If you really need to animate your svg, you can still do that using D3 separately.