Skip to content

Commit 58c39d3

Browse files
committed
add manual build, npm source maps, and clj test
- lein test currently doesn't pick up .cljc, use lein-test-refresh plugin which not only fixes this issue, but also runs a test-runner - add npm sourcemaps - organize aliases
1 parent 17aba5a commit 58c39d3

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/lib
33
/classes
44
/checkouts
5+
node_modules
56
pom.xml
67
pom.xml.asc
78
*.jar

dev/user.clj

+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
root (cljs.compiler/compile-root src-dir out-dir opts)]
1919
(cljs.closure/compiled-file root))))))
2020

21+
(defn build
22+
([& options]
23+
"Build Cljs src with options"
24+
(println "Building Cljs and watching for changes ...")
25+
(let [start (System/nanoTime)]
26+
(println "setting main as: " 'garden)
27+
(cljs.build.api/build "src"
28+
{:main 'garden
29+
:output-to "target/build/garden.js"
30+
:output-dir "target/build"
31+
:optimizations :none
32+
:source-map true
33+
:verbose true})
34+
(println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))))
35+
2136
(defn repl [main env & dirs]
2237
(cljs.build.api/build (Dirs. (concat ["src" "test"] dirs))
2338
{:main main

project.clj

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject garden "1.2.7-SNAPSHOT"
1+
(defproject garden "1.3.0-SNAPSHOT"
22
:description "Generate CSS from Clojure/Cljs data structures."
33
:url "https://github.com/noprompt/garden"
44
:license {:name "Eclipse Public License"
@@ -9,17 +9,22 @@
99
:dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
1010
[org.clojure/clojurescript "1.7.28" :scope "provided"]]
1111

12-
:plugins [[cider/cider-nrepl "0.9.1"] ;;required for cider-0.9.1
13-
[codox "0.8.13"]]
12+
:npm {:dependencies [[source-map-support "0.3.1"]]}
1413

1514
:clean-targets
1615
^{:protect false} ["target"]
1716

1817
:profiles
1918
{:dev {:source-paths ["src" "test" "dev"]
2019
:dependencies [[com.yahoo.platform.yui/yuicompressor "2.4.7"]
21-
[criterium "0.4.1"]]}}
20+
[criterium "0.4.1"]]
21+
:plugins [[cider/cider-nrepl "0.9.1"] ;; for cider-0.9.1
22+
[codox "0.8.13"]
23+
[lein-npm "0.6.1"]
24+
[com.jakemccrary/lein-test-refresh "0.10.0"]]}}
2225

2326
:aliases
24-
{"node-repl" ["run" "-m" "user/node-repl"]
25-
"test-all" ["run" "-m" "garden.tests/test-all"]})
27+
{"build-cljs" ["run" "-m" "user/build"]
28+
"node-repl" ["run" "-m" "user/node-repl"]
29+
"test-clj" ["do" "clean," "run" "-m" "user/build," "test-refresh"]
30+
"test-cljs" ["run" "-m" "garden.tests/test-all"]})

0 commit comments

Comments
 (0)