-
-
Notifications
You must be signed in to change notification settings - Fork 219
How to Contribute
Currently Calva is mostly JavaScript renamed to .ts
, but slooooowly being migrated to being mostly ClojureScript. The plan is to have most of the ”logic” build with ClojureScript while keeping the integration with VS Code in TypeScript. (There are reasons for this, that I'll find the time to write about some time.)
The CLJS code is compiled by shadow-cljs
into an npm module, @cospaia/calva-lib, that is then required from the TypeScript part of the Calva extension.
Depending on what you want to contribute you might have to fork at least two repos: This one, and calva-lib.
Consider saying hello in #calva-dev at the Clojurians Slack.
Unless you know that your change is on the extension/TypeScript end only, start with:
- Clone your fork of https://github.com/BetterThanTomorrow/calva-lib
- Most often you'll be branching off of
master
(the main branch). -
npm install
(This will install, amongst other things,shadow-cljs
) - Open the project root directory in VS Code. (You are using VS Code and Calva, right?)
The dev process is like so:
- Do Run Build Task… in VS Code and chose
npm: watch
. (This will runshadow-cljs
and make it watch:test
and:calva-lib
.) - Check the task Output pane and notice that tests are run.
- Connect Calva and choose the
node-repl
for your CLJS repl (it won't work with any of the build repls, unfortunately). - Hack away. Every time you save, the tests are run.
- Add/remove/modify any relevant test.
- Test the changes in the actual extension (see below about that setup).
- Assuming it is setup this means switching to the Calva window and restart the extension host process (then switch to the extension host window and do your manual testing).
For testing the changes to the actual extension you'll need to setup:
- Clone your fork (I'll assume you do so in a sibling directory to
calva-lib
). - Most often you'll be branching off of
master
(the main branch). npm install
- Open the project root directory in VS Code.
The dev process depends a bit on wether you are hacking also on calva-lib
. If you are, then start with:
npm link ../calva-lib/packages
Regardless, this:
- Run the build task Watch TS. Wait for it to compile the TypeScript code and start watching. (Only takes a second).
- Start the extension in debug mode (the Extension Host):
F5
. - Hack away. The watch task will rebuild the extension really quickly.
- There are no automated tests for the extension, 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).
- Restart the extension host when you have new code to test (regardless if it is
calva-lib
, or thecalva-fmt
, or both that has changed.
- Make sure all tests pass. Please add some basic unit tests for any functionality in the ClojureScript code that you add or change.
- If you have changed
calva-lib
, then build a release build:npm run release
- Restart the extension host in the Calva window and test that things still work. (You need to add the
^:export
meta-data to anything you want to be accessible from the requiring TypeScript code.) - Package a
vsix
file:-
vsce package
(you might need tonpm install -g vsce
first.) - Install the vsix it manually in your VS Code and do some testing that the production build works.
-
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.