mdaines / viz-js

Graphviz in your browser
https://viz-js.com/
MIT License
4.06k stars 350 forks source link

Question: Why isn't viz-lite packaged with npm? #112

Closed amilajack closed 6 years ago

mdaines commented 6 years ago

It should be, however the README doesn't explicitly state that it is, so I'll change that. Are you running into a problem requiring or bundling it?

It's in the files list in package.json: https://github.com/mdaines/viz.js/blob/590d73e3bda0955810a18f912a603f92ab58523c/package.json#L16

This is how you'd require it from Node.js:

require('viz.js/viz-lite.js');

For example:

~/viz-test$ yarn init
yarn init v1.5.1
warning ../package.json: No license field
question name (viz-test): 
question version (1.0.0): 
question description: 
question entry point (index.js): 
question repository url: 
question author: 
question license (MIT): 
question private: 
success Saved package.json
✨  Done in 6.80s.
~/viz-test$ yarn add viz.js
yarn add v1.5.1
warning ../package.json: No license field
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ viz.js@1.8.1
info All dependencies
└─ viz.js@1.8.1
✨  Done in 0.49s.
~/viz-test$ cat index.js
const Viz = require('viz.js/viz-lite.js');

console.log(Viz('digraph { a -> b; }'));
~/viz-test$ node index
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
 -->
[...]

~/viz-test$ 
amilajack commented 6 years ago

Ahh never mind. I'm using graphql-voyager which uses this package as a dep. That version that is used does not include the lite version.