explorable-viz / fluid

Data-linked visualisations
http://f.luid.org
MIT License
36 stars 2 forks source link

`fluid` command-line tool #1057

Open rolyp opened 2 months ago

rolyp commented 2 months ago

N.B. When testing the hosted webpage, go to 127.0.0.1/fluid Completed/Dropped:

See also:

rolyp commented 2 months ago

Hi @ColinC-UoE:

rolyp commented 2 months ago

Hi @ColinC-UoE. Do you want to start capturing some new subtasks above? I think it might be worth posting a question about purescript-optparse to the PureScript discourse, so let’s add that as a potential to do (we can decide later whether to bother). Then it’s probably worth experimenting with commander (although maybe do a very quick look at alternatives to check that this is the best option). There doesn’t seem to be a PureScript wrapper for commander, so we can write our own – i.e. a Commander.js and Commander.purs that exports just the method(s) we initially need, and simplifying where appropriate/feasible.

Btw, how did you get on with testing the command-line after yarn install fluid into a fresh repo?

ColinC-UoE commented 2 months ago

Hi @ColinC-UoE. Do you want to start capturing some new subtasks above? I think it might be worth posting a question about purescript-optparse to the PureScript discourse, so let’s add that as a potential to do (we can decide later whether to bother). Then it’s probably worth experimenting with commander (although maybe do a very quick look at alternatives to check that this is the best option). There doesn’t seem to be a PureScript wrapper for commander, so we can write our own – i.e. a Commander.js and Commander.purs that exports just the method(s) we initially need, and simplifying where appropriate/feasible.

Btw, how did you get on with testing the command-line after yarn install fluid into a fresh repo?

I've added some subtasks now. Currently, I'm thinking the effort put into purescript-optparse is not worth the limited time left. command-line-args is another alternative with some popularity, but more lightweight than commander. I'll try out commander first, though. Another reason I'm leaning towards abandoning purescript-optparse is that I would want to undo all the dependency installations that are causing the compilation errors, which means I cannot properly test the command line feature after a yarn install fluid since I would need to build.

rolyp commented 2 months ago

I agree, purescript-optparse would only be worth pursuing if a new version of the library were released that fixed the packaging/dependencies problem.

For a pure NPM solution, yargs also looks promising.

ColinC-UoE commented 2 months ago

I had a look into yargs and opted for commander in the end as it appeared more straight forward to use. After some investigation, it seems JavaScript is not made to be able to access local user files for security reasons, so I'm unsure how a user may have their .yml file be read.

rolyp commented 2 months ago

Ok, sounds good. Re. file loading, yes front-end Node apps (which have been bundled to run in the browser) aren’t able to access the file system. But if you’re compiling for Node itself (backend JavaScript) you should have access to the file system – I think it depends on how you build the app. (I thought just --platform=node would be enough but I don’t know much about this.)

ColinC-UoE commented 2 months ago

Ah ha. I kept my search terms to "JavaScript ..." so none of the results mentioned Node.