djblue / portal

A clojure tool to navigate through your data.

Home Page:https://djblue.github.io/portal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

custom viewer as plugin(extension) idea

sg-qwt opened this issue · comments

Hi there,

I took a look at the plotlyjs viewer example in the repo the other day, this whole npm load approach feels very weird and not very intuitive to me. Just some of my thoughts on the custom viewer approach as a user's perspective, thanks!

Ideally, I'd like to have a same 'easy as breezy' install approach for custom viewers same as portal itself by just adding the relevant viewer plugin to deps.edn for example:

{:deps 
 {djblue/portal {:mvn/version "0.48.0"}
 djblue/portal-plotlyjs-viewer {:mvn/version "1.0.0"}
 djblue/portal-vega-viewer {:mvn/version "1.0.0"}}}
  1. that would not assume or need the user side of npm installed
  2. looks like the clerk using d3-require approach could be one way to do that, but with that approach, add more than one js libraries would still be difficult and awkward. Also pulling js stuff at runtime is not my cup of tea.
  3. even better, I'd like to avoid any runtime download from internet at all cost, all js stuff prebundled by the the viewer extension would be the best IMO
  4. that case, we could have a viewer plugin template for people to just start from that and build custom viewers for portal, that'd be nice to boost the portal ecosystem I guess.

Best

Hi @sg-qwt, I agree that the currently documented approach isn't optimized for end users. It was more for getting people quickly experimenting with building custom viewers that have npm dependencies. I think the problem of packaging and distribution is larger and more difficult to solve generally.

Currently, nothing is stopping viewer authors from pre-bundling their npm deps into their jars to provide such an experience since Portal will gladly load any arbitrary JS resolvable via the classpath. However, while this makes it a easier for end users, it does make it a bit more awkward for authors.

I haven't had time to experiment with what this type of workflow would look like. Is this something you would be interested in experimenting with?

Hi @djblue, thanks for getting back. How to packackge/bundle custom viewer is definitely something I'd like to explore. Unfortunately, I've been quiet busy lately that it's unlikely I'll poke around this issue in short future. For now, I'll close this, I'll report back if any experiment made with this in future. Again, thanks!