livebook-dev / vega_lite

Elixir bindings for Vega-Lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong local path to find npm bin

revati opened this issue · comments

Currently needed npm pacakges are searched in wrong local directory. Missing assets prefix (it is default standard setup in phoenix).

This is crude soluton. It might break it for others:

+local_bin = npm_bin(npm_path, ["--prefix", "./assets"])
-local_bin = npm_bin(npm_path)
global_bin = npm_bin(npm_path, ["--global"])

Probably better solution would be to provide some configuration options.

Instead of hardcoding, we should support a prefix option. A PR is welcome!

Which options would be better

config :vega_lite, prefix: "assets"
# or
config :vega_lite, local_npm_options: ["--prefix", "assets"]

First one seems cleaner, but second one provides much more versatility. Im not sure it is even needed there tho.

Could we pass those as actual options to the VegaLite.Export functions? If so, I would go with local_npm_prefix: "assets". :)

Can you please look at PR. I changed config parameter name, but i probably didn't do it as you wanted.

Yes, we shouldn't use config files. Instead we should pass those as options to the functions in VegaLite.Export. :) Like they will support options like opts \\ [] and we will pass those options downstream to the node functions.