adzerk-oss / boot-cljs-example Goto Github PK
View Code? Open in Web Editor NEWExample application using boot, boot-cljs, boot-cljs-repl, and boot-reload.
Example application using boot, boot-cljs, boot-cljs-repl, and boot-reload.
Hey guys,
Tests don't work for me.
As I didn't get any output from the runner I tried to add a failing test but I still get nothing.
Maybe I missed something on how I'm supposed to run them.
/cc @crisptrutski
boot auto-test
says Ran 0 tests containing 0 assertions.
Full log:
~/src/boot-cljs-example $ boot auto-test
Downloading https://github.com/boot-clj/boot/releases/download/2.5.5/boot.jar...done.
Retrieving pod-2.5.5.jar from https://clojars.org/repo/
Retrieving core-2.5.5.jar from https://clojars.org/repo/
Retrieving aether-2.5.5.jar from https://clojars.org/repo/
Retrieving worker-2.5.5.jar from https://clojars.org/repo/
Retrieving boot-cljs-1.7.228-1.jar from https://clojars.org/repo/
Retrieving boot-http-0.7.1-20151103.174541-1.jar from https://clojars.org/repo/
Retrieving boot-reload-0.4.5.jar from https://clojars.org/repo/
Retrieving closure-compiler-v20151216.jar from https://repo1.maven.org/maven2/
Retrieving clojurescript-1.7.228.jar from https://repo1.maven.org/maven2/
Retrieving tools.reader-1.0.0-alpha1.jar from https://repo1.maven.org/maven2/
Starting file watcher (CTRL-C to quit)...
Writing output.cljs.edn...
Writing clj_test/suite.cljs...
Compiling ClojureScript...
WARNING: Replacing ClojureScript compiler option :main with automatically set value.
• output.js
Running cljs tests...
Testing clj-test.suite
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///tmp/phantom6622532016446551644.js. Domains, protocols and ports must match.
Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///tmp/phantom6622532016446551644.js. Domains, protocols and ports must match.
Implicit target dir is deprecated, please use the target task instead.
Set BOOT_EMIT_TARGET=no to disable implicit target dir.
Elapsed time: 18.346 sec
boot serve
raise Exception:
f2e [master●] % boot serve -d target/ watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
<< started web server on http://127.0.0.1:3000 (serving: target/) >>
Starting file watcher (CTRL-C to quit)...
nREPL server listening: 0.0.0.0:65208
Compiling main.js...
Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
Exception in thread "Thread-18"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-18"
^CJava HotSpot(TM) 64-Bit Server VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGINT to handler- the VM may need to be forcibly terminated
[1] 44108 killed boot serve -d target/ watch speak cljs-repl cljs -usO none reload
f2e [master●] % boot watch speak cljs-repl cljs -usO none reload
<< started reload server on ws://localhost:8090 >>
Starting file watcher (CTRL-C to quit)...
nREPL server listening: 0.0.0.0:65217
Compiling main.js...
Adding <script> tags to html...
Elapsed time: 12.351 sec
boot serve -d target/ watch speak reload cljs-repl cljs -sO none
doesn't work, returning clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: No such task (serve)
.
In the example here, the reader is directed to open a file in their browser. This is the "old school" way of developing HTML, we all worked this way in the 1990s.
It still sort of works today, if you are on the machine where you are running the commands. But it usually not a suitable practice for real work, since some browsers (notably Chrome, the most popular browser among developers) same-origin policy blocks pretty much everything for pages loaded from file URLs.
So, rather than direct new users down this problematic path, I suggest making the example include one more bit, the bit which serves the HTML/etc, and direct the user to localhost:nnnn rather than to open the HTML file in the browser.
If you don't already have nodejs installed, then "boot dev" will fail. I'm new to boot so I don't have a solution.
Following http://adzerk.com/blog/2014/11/clojurescript-builds-rebooted/ I cloned the repo, installed boot, and ran boot watch speak cljs-repl cljs -usO none reload
boot-cljs-repl-0.1.5.jar seems to fail:
$ boot watch speak cljs-repl cljs -usO none reload
Retrieving boot-cljs-0.0-2371-22.jar from http://clojars.org/repo/
Retrieving boot-reload-0.1.3.jar from http://clojars.org/repo/
Retrieving boot-cljs-repl-0.1.5.jar from http://clojars.org/repo/
Retrieving weasel-0.4.1.jar from http://clojars.org/repo/
clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: option :middleware must be of type [sym]
data: {:file "/tmp/boot.user4523921757035797881.clj", :line 13}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: option :middleware must be of type [sym]
java.lang.IllegalArgumentException: option :middleware must be of type [sym]
boot.task.built-in/fn/fn built_in.clj: 164
...
adzerk.boot-cljs-repl/eval166/fn boot_cljs_repl.clj: 74
...
clojure.core/apply core.clj: 624
boot.core/construct-tasks core.clj: 321
...
clojure.core/apply core.clj: 624
boot.user/eval259/fn boot.user4523921757035797881.clj: 15
clojure.core/binding-conveyor-fn/fn core.clj: 1910
I've cloned the repo and run boot dev
, when the page loads there is this error in the console (seems it can't find source maps):
GET http://localhost:3000/out/cljs/core.js.map 404 (Not Found)
When developing with the pipeline recommended in the README, ie:
(comp (serve :port 8080 :dir "target")
(watch)
(speak)
(reload)
(cljs-repl)
(cljs :source-map true
:unified-mode true
:optimizations :advanced))
...there is a recurring Exception being thrown that breaks the pipeline, which must then be restarted. The Exception looks like this on my machine:
Exception in thread "Thread-31" java.nio.file.NoSuchFileException: /home/mu/.boot/tmp/home/mu/repos/com/github/adzerk/boot-cljs-example/29x/-p9hf6h/frontend
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.asIOException(UnixException.java:111)
at sun.nio.fs.LinuxWatchService$Poller.implRegister(LinuxWatchService.java:246)
at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:329)
at java.lang.Thread.run(Thread.java:745)
I changed the "<p>i'm dynamically created</p>"
to "<p>i'm dynamically created!!!</p>"
and after the "reload" message I get two errors:
2BB0C40.js?zx=esaicio3ejno:3 - Uncaught ReferenceError: require is not defined
node_runner.cljs:9 - Uncaught TypeError: Cannot read property 'report' of undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.