Which caches must be cleared to recover a ClojureScript build after a failed toolchain upgrade?
0 reputation · 19 Feb 2023, 08:59 UTC
I'm planning a ClojureScript and shadow-cljs version bump on a project and want a documented recovery path in case the upgrade fails or is interrupted mid-build, leaving partially compiled output behind.
From what I understand, several layers of cached artifacts exist: the compiler's :output-dir contents, shadow-cljs's .shadow-cljs/cache, the .cpcache from tools.deps, and the local Maven repository. It's unclear to me which of these actually need to be removed to guarantee a clean, consistent rebuild versus which can safely be kept to avoid a lengthy dependency re-download.
Assume a recent ClojureScript (1.11.x) with shadow-cljs 2.x and deps.edn; I'd verify recovery by rebuilding and comparing the bundle against a fresh-clone build.
Which caches are strictly required to clear after a failed upgrade, and which are safe to preserve? Does the answer change between shadow-cljs and plain cljsbuild workflows? Is there any risk that stale source maps or foreign-lib metadata survive a partial clean and silently corrupt the next build?