graph-viz-d3-js icon indicating copy to clipboard operation
graph-viz-d3-js copied to clipboard

Publish to NPM

Open akinnee-gl opened this issue 9 years ago • 13 comments
trafficstars

It would be awesome if this were published to NPM!

akinnee-gl avatar Jun 06 '16 17:06 akinnee-gl

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

mstefaniuk avatar Jun 06 '16 20:06 mstefaniuk

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.

akinnee-gl avatar Jun 06 '16 20:06 akinnee-gl

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.

mstefaniuk avatar Jun 07 '16 07:06 mstefaniuk

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

akinnee-gl avatar Jun 07 '16 13:06 akinnee-gl

Could you create a pull request for that?

mstefaniuk avatar Jun 07 '16 14:06 mstefaniuk

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

akinnee-gl avatar Jun 07 '16 14:06 akinnee-gl

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

mstefaniuk avatar Jun 07 '16 16:06 mstefaniuk

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:

  • change all require statements to relative paths
  • install dependencies via npm: d3, viz.js, worker-loader

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

akinnee-gl avatar Jun 10 '16 16:06 akinnee-gl

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

mstefaniuk avatar Jun 10 '16 18:06 mstefaniuk

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?

quiasmo avatar Jun 19 '16 21:06 quiasmo

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

akinnee-gl avatar Jun 20 '16 17:06 akinnee-gl

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

tedwong avatar Oct 25 '16 17:10 tedwong

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.

akinnee-gl avatar Oct 25 '16 17:10 akinnee-gl