thheller / standardized-cljs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE: I'm still thinking about this.

Standardized CLJS - Draft

Standardizing ClojureScript project configuration for a simpler environment.

Problem

In ClojureScript, we understand the value of storing things in a central place as plain data. And yet, we wrap what should be common project configuration in special interfaces that differ across different build tools:

  • cljs.jar relies on either lein or boot for defining dependencies, and defines project config inline.
  • lein-cljsbuild uses its own project config standard, and uses lein for defining dependencies
  • lein-figwheel piggiebacks on lein-cljsbuild's config standard, but provides a sidecar library for defining project config inline
  • boot-cljs uses its own project config standard across different files, and uses boot for defining dependencies
  • LightTable does something that I don't know (TODO)
  • cuttle piggiebacks on lein-cljsbuild's config

Proposal - common config

Define the project information as plain data in a canonical file cljs.edn or cljs.json.

Builds

The build tools can be flagged to read build config from this data rather than through specific interfaces.

;; filename: cljs.edn

{:builds {:build-id {:src "src"
                     :compiler {:optimizations :none
                                :main foo.core
                                ...}
                     ...}
          ...}

 ...}

Feel free to add tool-specific config inside a build, such as :figwheel true. See the examples/ directory for how each build tool would make use of this data.

Dependencies

Dependency information is also data that should be readable by build tools:

;; filename: cljs.edn

{:dependencies [[org.clojure/clojurescript "1.8.40"]
                [hiccups "0.3.0"]
                ...]

 :dev-dependencies [[figwheel-sidecar "0.5.0-SNAPSHOT"]
                    ...]

 ...}

About