polyfy / polylith

A tool used to develop Polylith based architectures in Clojure.
Eclipse Public License 1.0
499 stars 47 forks source link

Add support for ClojureScript #481

Open tengstrand opened 6 days ago

tengstrand commented 6 days ago

We've decided to do a retake on how to support ClojureScript. The new solution will be less complex than the previous ideas and will only support a single workspace (as previously already suggested by some users back then). Here, I explain why we finally decided to go with the single workspace approach.

The plan is to add support for ClojureScript, mainly relying on shadow-cljs. This will be developed incrementally by continuously pushing to the main branch, which will build SNAPSHOT releases.

As a first step, we will ensure that the poly tool understands not only clj and cljc code but also cljs code by parsing it and storing it in the workspace structure. In the next phase, we will extend support for ClojureScript to various commands, with the check command likely being the first.

In the workspace.edn file, it will be possible to specify the Clojure dialect, clj or cljs, under each project in :projects. If not specified, the default will be clj. Both dialects will automatically handle cljc code. The projects will need to define their dialect (clj or cljs) so that the poly tool can decide which tree to consider when calculating the dependencies and affected parts of the workspace after a change. The components can contain namespaces that are purely clj, cljs or a mix of the two.