Add reloading API for external tools

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
clojure, javascript
Domain
api, tooling

Research direction

Start by reviewing the linked scittle-reload example and the proposed scittle.core.reload API, then compare the lifecycle-hook references from Shadow-cljs and Figwheel. Done should include a core reload mechanism that external tools can use, with lifecycle hooks supported; error reporting and popup feedback are described as optional plugin work.

Written by the indexing model from the issue text.

Description

In order to develop any serious cljs/scittle app we need help of some kind of livereloading. cljs-josh is the first (public) tool that offers livereloading of Scittle apps. It is still missing some essential features such as lifecycle hook support and error reporting. With some work this could be added to josh or another tool, however I believe it is desirable to have some reloading functionality part of Scittle itself (that 3rd parties like Josh can use).

The exported js API could be something like:

scittle.core.reload("/path-to-some-cljs-asset")

What would this reloading api would trigger:

  1. Support wide-spread lifecycle hooks from tools like Shadow-cljs and Figwheel
  2. A popup that reports a successful reload (e.g. BB icon) or a popup reports a failure

Since Sci provides enough information (file contents, rich stacktraces) we can create a nice UI that goes through the trace step by step.

I believe 1 is essential to have in the core of Scittle to avoid fragmentation. 2 could be supported by an (external) plugin (I think) and would allow some experimentation with feedback styles. To enable external plugins for this we would need an API like scittle.core.on_error or something similar.

Example code of the above in action

Slack discussion

A quick demo of the possibilities:

https://github.com/user-attachments/assets/31ee77d0-1db2-4989-a147-66c594ae455c

Dominant language
HTML
Stars
446
Forks
37
Avg merge
1m
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/scittle

All issues in babashka/scittle

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.