Notes

Short-form thoughts, tips, and interesting findings from my daily work and exploration

For some projects using shadow-cljs I can’t add my custom keys to the shadow-cljs, so I wrote this little clojure function to add my keys and git assume-unchanged.

Sadly there is no merge-config or similar for the shadow-cljs CLI.

So To edit shadow-cljs edn we can use rewrite-clj to add our keys to every :devtools. I’m using rewrite-clj to keep the pre-existing formatting of the shadow-cljs.edn

clojure
(defn adjust-shadow-cljs!
  "Adds dev keys to the `:devtools` of the shadow-cljs.edn"
  []
  (let [file "./repo/frontend/shadow-cljs.edn"
        zloc (-> (z/of-string (slurp file))
                 (z/prewalk
                   (fn [loc]
                     (when (and (z/map? loc)
                                (= (z/sexpr (z/left loc)) :devtools))
                       (-> loc
                           ;; Loads my custom preload ns in dev/preload
                           (z/assoc :preloads ['preload])
                           ;; I don't want shadow cljs logs in my console
                           (z/assoc :log false)))))
                 (z/root-string))]
    (bp/shell shell-opts "git update-index --assume-unchanged frontend/shadow-cljs.edn")
    (spit file zloc)
    zloc))

I always set :log false for the devtools as i don’t want to get noisy logs for every reloading of updated namespaces.

And I load my custom namespace per default.

In my preload namespace I do further noise log removal like this

clojure
(ns preload
  (:require
   [app.common.logging :as l]
   [devtools.core :as devtools]))
 
(defn setup! []
  (devtools/set-pref! :dont-display-banner true)
  (devtools/set-pref! :min-expandable-sequable-count-for-well-known-types 0)
  (remove-watch l/log-record ::l/default))
 
(setup!)

You can generate a changelog with aider from the commits since the last version tag:

This might use a lot of LLM tokens, as it feeds the entire diff
sh
# Fetch the latest tag
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
 
# Fetch main branch
git fetch origin main:temp-main
 
# Create the diff file between the last version and current main branch
git diff $latest_tag..temp-main > diff.txt
 
# Use 'aider' to update the CHANGELOG file with the changes
aider -f diff.txt -o CHANGELOG
 
# Remove temp files
git branch -D temp-main
rm diff.txt