Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ClojureScript evaluation in the browser and building ClojureScript modules in the project #21

Open
Lambeaux opened this issue Dec 4, 2020 · 0 comments
Labels
capabilities/interfaces Concerns accessibility, runtime platforms, and interaction modes context/experimental Applies to a specific branch (not master)

Comments

@Lambeaux
Copy link
Contributor

Lambeaux commented Dec 4, 2020

Scope

Applies to experiment: https://github.com/connexta/osg-eyes/tree/mvn-indexing
Ensure you're familiar with the parent issue: #19

Goal

Provide JavaScript dependencies, fully integrated with the build, that do the following:

  • Evaluate ClojureScript for the app's CLI.
  • Support pre-loading ClojureScript so functions are readily available in the evaluation namespace.
  • Support querying and retrieving metadata about the current evaluation namespace (for use in autocomplete, etc).
  • Convert deps-draw-graph to .cljc, which is "platform-independent" Clojure.
  • Provide a JavaScript build of deps-draw-graph for the browser's consumption.

This adds overhead to the project that must be dealt with:

  • Passing around JavaScript between modules as part of the build.
  • Managing the ClojureScript build process as part of Maven.

Notes

Managing ClojureScript builds as part of a maven project is a small endeavor on its own. Here are some options:

Quickstart to ClojureScript:

Clojure CLI tools:

What Reddit has to say on the topic:

Extra stuff:

See Adds Clojure console/repl at the top of the web page commit:

  • Leverages paren-soup to provide the CLI.
  • Transitive dependency on eval-soup.
  • Latter commits improve the integration and expose the eval function window.clojure.eval(text, callback) for use on the React side of the project.
  • Note that paren-soup is not available on NPM so the released files had to be copied into deps-ui/public manually but I was loathe to check them into source control so I did not.
  • Also, paren-soup manages its HTML directly which doesn't work for a React app; to work around this I am hiding the HTML that paren-soup needs to attach to / manage to properly initialize and simply ignore it once its satisfied.
  • Currently not sure how to interact with paren-soup's autocomplete or parinfer support so I suspect we'll have to do that ourselves.
  • Currently cannot omit the first order opening ( and closing ) without an error getting thrown; would be nice to do this since Clojure is truly being used as just a CLI in this context and everything on the CLI is a function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
capabilities/interfaces Concerns accessibility, runtime platforms, and interaction modes context/experimental Applies to a specific branch (not master)
Projects
None yet
Development

No branches or pull requests

1 participant