b9890a9d44
This commit upgrades Shadow CLJS from 2.11.16 (released on Feb/21) to latest 2.25.0 (Jul/23), so ~1.5 years worth of upgrades. By upgrading shadow we can finally use the latest major Clojure version 1.11.x. Why upgrade shadow? - Shadow CLJS controls the ClojureScript version we can use. In order to use the latest major Clojure version we must upgrade Shadow CLJS. - Shadow CLJS releases new versions very frequently, and if you take a look at its changelog https://github.com/thheller/shadow-cljs/blob/master/CHANGELOG.md, you'll see it had tons and tons of bug fixes over the years. I hope some of them help improve the DX for certain contributors who recently reported issues with it. - Clojure 1.11 brings new features, bug fixes and even performance improvements (although I think the performance mostly impacts Clojure on the JVM). See the changelog https://github.com/clojure/clojure/blob/master/changes.md#changes-to-clojure-in-version-1110 Things that can be beneficial to us, or are interesting nonetheless: - New :as-alias to be used in require, which is like :as but does not require the namespace to load. This means namespaced keywords using :as-alias can't cause circular dependency errors. This feature would very useful if we used namespaced keywords, but we don't, so... https://github.com/clojure/clojure/blob/master/changes.md#22-as-alias-in-require - New macros run-test and run-test-var to run single test with fixtures and report. - New iteration function, useful for processing paginated data. https://www.abhinavomprakash.com/posts/clojure-iteration/ - New update-keys function: applies a function to every key in a map. - New update-vals function: applies a function to every value in a map. Examples for update-vals and update-keys. They should perform better than the common reduce-kv approach since they use a transient data structure. (let [m {:a 1 :b 2}] (update-vals m inc)) ; => {:a 2, :b 3} (let [m {:a 1 :b 2}] (update-keys m name)) ; => {"a" 1, "b" 2} Why change namespaces within __tests__ directories? Any namespace with the word --tests-- throws an error, like the one below. I didn't bother investigating why, so I changed the guidelines to reflect the new convention. It's probably related to the double dashes in the name. Namespace quo2.components.dividers.--tests--.divider-label-component-spec has a segment starting with an invalid JavaScript identifier at line 1 |
||
---|---|---|
.. | ||
README.md | ||
default.nix | ||
deps.json | ||
deps.list | ||
generate.sh |
README.md
Description
This folder contains the scripts and Nix derivations necessary to generate Clojure dependencies for this project.
Usage
Running generate.sh
in a shell that has available shadow-cljs
and clojure
should update the deps.list
and deps.json
files.
Details
By using the following command:
shadow-cljs classpath --force-spawn
We both download the necessary JARs and POMs into ~/.m2
folder, but also get the classpath printed into standard output.
We then use the classpath in combination with contents of ~/.m2
folder to generate the following files:
deps.list
- List of JARs relative to the~/.m2
cache folder.deps.json
- Full list of JARs and POMs including their SHAs.
The deps.list
file is just intermediate and for debugging purposes.
The deps.json
is loaded by the derivation in default.nix
and used to produce a derivation that contains all the necessary dependencies:
> grep cljfmt nix/deps/clojure/deps.list
cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar
> nix-build --no-out-link -A pkgs.deps.clojure
/nix/store/d7p8r9vhq6z2jmxwakxpcb262wgkc86s-status-mobile-clojure-deps
> DEPS=$(nix-build --no-out-link -A pkgs.deps.clojure)
> find $DEPS -iname 'cljfmt-0.6.7.*'
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.pom.sha1
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.pom
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar.sha1
/nix/store/d7p...86s-status-mobile-clojure-deps/cljfmt/cljfmt/0.6.7/cljfmt-0.6.7.jar