Skip to content
Peter Strömberg edited this page May 12, 2019 · 36 revisions

Calva is mostly TypeScript, but some things are written in ClojureScript.

The following assumes you are basing your contributions on the dev branch, which you should. There are currently big changes there, compared to master.

The CLJS code is compiled by shadow-cljs into an npm library, that is then required from TypeScript.

The setup:

Start by saying hello in #calva-dev at the Clojurians Slack. Then:

  1. Clone your fork of https://github.com/BetterThanTomorrow/calva
  2. npm install (This will install, amongst other things, shadow-cljs)
  3. Open the project root directory and a cljs file in it in VS Code. (You are using VS Code and Calva, right?)

The dev process is like so:

  1. Do Run Build Task… in VS Code and choose Watch CLJS.
    • Wait for it to build and run the tests. (You'll see this happening in the Terminal spawned to run the task.)
  2. Run the build task Watch TS.
    1. Wait for it to compile the TypeScript code and start watching. (Only takes a second).
  3. Run the build task Watch Webpack.
    1. Wait for it build its stuff and start watching. (This also only takes a second).
  4. Start the extension in debug mode (the Extension Host): F5. (This is the app with the a cljs REPL server you can connect to.)
  5. Go back to the Calva code and connect to the REPL.
    1. Choose to connect to the :calva-lib cljs REPL.
  6. Hack away. The watch task will rebuild the extension really quickly.
    • You'll find the output from both build task in their respective vscode Terminal view.
    • NB: There are no automated tests for the TS code, mainly because I don't know how to do it. Please consider setting that up to collect gold stars in heaven (as we say in Sweden).
  7. Restart the extension host when you have new code to test.

Before sending pull requests

  1. Make sure all tests pass. Please add some basic unit tests for any functionality in the ClojureScript code that you add or change.
  2. Package a vsix file:
    1. vsce package (you might need to npm install -g vsce first.)
    2. Install the vsix it manually in your VS Code and do some testing that the production build works.

After sending pull requests

When you have issued your Pull Request it is best to ping me about it to catch my attention. The #calva-dev channel of the Clojurians Slack is a good place for this ping, mention @pez even.

Please consider contributing to the porting of Calva to CLJS, as this will be a lot of work. Contact me and we can discuss together how we should go about it.