Skip to content
Peter Strömberg edited this page Sep 5, 2019 · 36 revisions

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

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 in VS Code. (You are using VS Code and Calva, right?)

The dev process looks like so:

  1. Run the build task Watch TS.
    1. Wait for it to compile the TypeScript code and start watching. (Only takes a second).
  2. Run the build task Watch Webpack.
    1. Wait for it build its stuff and start watching. (This also only takes a second).
  3. (Optional, if you want to play with the cljs part of Calva) Jack in Calva to Calva itself.
    1. Choose to connect to the :calva-lib cljs REPL.
    2. Wait for it to build and run the tests. (You'll see this happening in the Terminal spawned to run the Jack-in task.)
  4. Start the extension in debug mode (the Extension Host): F5. (This is the app with a cljs REPL server your Calva will connect to.)
  5. 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, and for the cljs part in its Jack-in terminal.
    • 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).
  6. Restart the extension host when you have new TS code to test (CLJS code will hot-reload, just as you are used to).

Before sending pull requests

  1. Consider having your work in a feature branch. Since most PRs will be of a work-in-progress nature, you are welcome to follow our convention of naming our feature branches wip/<faeture-name>.
  2. Make sure all tests pass. Please add some basic unit tests for any functionality in the ClojureScript code that you add or change.
  3. Package a vsix file:
    1. Note: It is good practice to hack the version of Calva in package.json before packaging. On Windows it seems this is even necessary in order to install Calva from the extension marketplace. Don't commit this change.
    2. vsce package (you might need to npm install -g vsce first.)
    3. Install the vsix in your VS Code (from the Extensions pane) and do some testing that the production build works.
  4. Make sure you are directing the pull request at the master branch, unless you have reasons to target some other branch.
  5. Mention any issues you are addressing or fixing. (Use the fixes/closes syntax, if applicable.)

After sending pull requests

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