duct-framework / module.cljs Goto Github PK
View Code? Open in Web Editor NEWDuct module for developing and compiling ClojureScript
Duct module for developing and compiling ClojureScript
Hello. There is no anymore lein duct compile
(from README). It was removed here
duct-framework/duct@fba4ad3.
Is there some "official" way to do it, or I need to make some workaround for at least now?
Thank you.
Hello James,
I just created a fresh project with lein new duct foo +cljs +site +example
When I run lein run :duct/compiler
, I get this error:
Applying optimizations :advanced to 15 sources
nov. 16, 2017 11:40:19 AM com.google.javascript.jscomp.LoggerErrorManager println
GRAVE: /tmp/foo/target/resources/foo/public/js/cljs/core.js:3579: ERROR - Parse error. primary expression expected
case ##Inf:
^
This is discussed here: https://clojurians-log.clojureverse.org/cljs-dev/2017-09-19.html and seems to be fixed in this commit: clojure/clojurescript@26bf9a5
Bumping the ClojureScript dependency to the latest release (r1.9.946) should fix this.
Currently, the the figwheel configuration will be generated by figwheel-config
(defn- figwheel-config [path main]
{:duct.server/figwheel
{:css-dirs ^:displace ["resources" "dev/resources"]
:builds ^:displace
[{:id "dev"
:figwheel true
:source-paths ["dev/src" "src" ]
:build-options
{:main main
:output-to (str path "/js/main.js")
:output-dir (str path "/js")
:asset-path "/js"
:closure-defines {'goog.DEBUG true}
:verbose false
:preloads '[devtools.preload]
:optimizations :none}}]}})
which is hard to change like ':figwheel {:on-jsload "..."}', the only option is to override all the figwheel config.
when people needs multi builds (e.g. js per page, serverside rendering specific js) for development would be really hard to change the config.
Currently, I could only hard code all the configs under :duct.server/figwheel
and :duct.compiler/cljs
. It is not ideal, since the path
and main
would be hard-coded.
Would it be any better way to do it? like the boot-reload
, .cljs.edn
?
Not sure if this is an issue or just something with my setup (in latter case I need help)
I have a project where I'm using om.next and when I start up duct everything works fine but after any change in a .cljs file and a (reset)
the compilation fails, see log below
I should also mention that doing a (clear)
doesn't help, but it works again after restarting the repl.
I don't know where to begin looking so if anyone know why this happens or could point me where I should start to look.
$ lein repl
nREPL server started on port 63133 on host 127.0.0.1 - nrepl://127.0.0.1:63133
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0-alpha16
Java HotSpot(TM) 64-Bit Server VM 1.8.0_60-b27
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (dev)
:loaded
dev=> (go)
[rabbitmq] connecting to {:host localhost, :port 5672, :username guest, :password guest, :vhost /}
[rabbitmq] connected. Channel id: 1
:duct.server.http.jetty/starting-server {:port 3000}
Compiling "/Users/mange/workspace/checker/dapp/target/resources/dapp/public/js/main.js" from ["dev/src" "src"]...
Successfully compiled "/Users/mange/workspace/checker/dapp/target/resources/dapp/public/js/main.js" in 4.126 seconds.
notifying browser that file changed: target/resources/dapp/public/js/goog/deps.js
notifying browser that file changed: target/resources/dapp/public/js/cljs_deps.js
notifying browser that file changed: out/dapp/util.js
notifying browser that file changed: out/dapp/client.js
notifying browser that file changed: out/dapp/core.js
notifying browser that file changed: out/dapp/parser.js
notifying browser that file changed: out/dapp/ui.js
notifying browser that file changed: out/dapp/router.js
:initiated
dev=> (reset)
Closed connection to rabbitmq
:reloading (om.util om.tempid om.transit duct.router.cascading duct.middleware.web cljs.tagged-literals cljs.env cljs.analyzer om.next.protocols cljs.analyzer.api om.next.impl.parser om.next duct.middleware.web-test duct.handler.static duct.module.web dapp.endpoint.example dapp.endpoint.example-test dapp.component.parser dapp.main cljs.stacktrace dapp.endpoint.api compassus.util dev compassus.core dapp.endpoint.app bidi.bidi dapp.component.rabbitmq duct.module.web-test user)
[rabbitmq] connecting to {:host localhost, :port 5672, :username guest, :password guest, :vhost /}
[rabbitmq] connected. Channel id: 1
Compiling "/Users/mange/workspace/checker/dapp/target/resources/dapp/public/js/main.js" from ["dev/src" "src"]...
Failed to compile "/Users/mange/workspace/checker/dapp/target/resources/dapp/public/js/main.js" in 0.36 seconds.
---- Could not Analyze src/cljs/dapp/ui.cljs line:12 column:1 ----
at line 12 src/cljs/dapp/ui.cljs
10 ; (.format c value)))
11
12 (defui Project
^--- at line 12 src/cljs/dapp/ui.cljs
13 static om/Ident
14 (ident [this props]
15 [:project/by-id (:project/id props)])
---- Analysis Error : Please see src/cljs/dapp/ui.cljs ----
:resumed
dev=>
No matter what I change it always complains about the same thing.
project.clj
(defproject dapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.9.0-alpha16"]
[org.clojure/core.async "0.3.443"]
;[com.cognitect/transit-clj "0.8.300"]
[com.cognitect/transit-cljs "0.8.239"]
[com.novemberain/langohr "4.0.0"]
[duct/core "0.4.0"]
[duct/module.logging "0.2.0"]
[duct/module.web "0.5.0"]
[duct/module.cljs "0.2.2"]
[org.omcljs/om "1.0.0-beta1"]
[compassus "1.0.0-alpha3"]
[bidi "2.1.1"]
[kibu/pushy "0.3.7"]
[cheshire "5.7.1"]]
:plugins [[duct/lein-duct "0.9.0-alpha5"]
[lein-ancient "0.6.10"]]
:main ^:skip-aot dapp.main
:duct {:config-paths ["resources/dapp/config.edn"]}
:source-paths ["src/clj" "src/cljc"]
:resource-paths ["resources" "target/resources"]
:prep-tasks ["javac" "compile" ["duct" "compile"]]
:profiles
{:dev [:project/dev :profiles/dev]
:repl {:prep-tasks ^:replace ["javac" "compile"]
:repl-options {:init-ns user
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
:uberjar {:aot :all}
:profiles/dev {}
:project/dev {:source-paths ["dev/src/clj" "dev/src/cljc"]
:resource-paths ["dev/resources"]
:dependencies [[integrant/repl "0.2.0"]
[eftest "0.3.1"]
[kerodon "0.8.0"]]}})
ui.cljs
(ns dapp.ui
(:require [om.next :as om :refer-macros [defui]]
[om.dom :as dom]
[dapp.router :as router]
[clojure.string :as str]))
; (defn currency [value]
; (let [c (NumberFormat. (.. NumberFormat -Format -CURRENCY))]
; (.format c value)))
(defui Project
static om/Ident
(ident [this props]
[:project/by-id (:project/id props)])
static om/IQuery
(query [this]
[:project/id :project/title :project/running :project/url :project/checkers])
Object
(render [this]
(dom/div nil (str "Project: " (om/props this)))))
(def project-view (om/factory Project {:keyfn :project/id}))
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.