This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-06
Channels
- # bangalore-clj (2)
- # beginners (55)
- # boot (32)
- # bristol-clojurians (4)
- # cider (16)
- # clara (13)
- # cljsrn (6)
- # clojure (110)
- # clojure-india (1)
- # clojure-italy (69)
- # clojure-spec (32)
- # clojure-uk (15)
- # clojurescript (102)
- # community-development (6)
- # cursive (1)
- # datomic (9)
- # docs (2)
- # duct (1)
- # emacs (39)
- # events (3)
- # fulcro (131)
- # garden (1)
- # immutant (4)
- # jobs (1)
- # jobs-discuss (5)
- # keechma (1)
- # lein-figwheel (6)
- # leiningen (6)
- # mount (6)
- # nrepl (2)
- # off-topic (69)
- # om (54)
- # parinfer (7)
- # re-frame (63)
- # reagent (13)
- # remote-jobs (1)
- # shadow-cljs (90)
- # spacemacs (8)
- # specter (6)
- # sql (16)
- # testing (1)
- # unrepl (3)
- # vim (4)
- # yada (1)
hi - I'm working on a clojurescript project and using boot-cljs. Just added a node server and trying to figure out how to separate out :source-paths
between the 2 build tasks.
my build.boot is currently like this:
(set-env!
:source-paths #{"src"}
:dependencies '[[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.9.854"]
[adzerk/boot-cljs "2.1.4" :scope "test"]
[adzerk/boot-reload "0.5.2" :scope "test"]
[reagent "0.7.0" :exclusions [[cljsjs/react]
[cljsjs/react-dom]
[cljsjs/react-dom-server]
[cljsjs/create-react-class]]]
[secretary "1.2.3"]])
(require
'[adzerk.boot-cljs :refer [cljs]]
'[adzerk.boot-reload :refer [reload]])
(deftask client
"Make client files"
[]
(comp
(cljs :source-map true
:optimizations :none
:compiler-options {:main "client.load"
:output-dir "public/js"
:output-to "public/js/app.js"
:npm-deps {:react "16.2.0"
:react-dom "16.2.0"
:create-react-class "^15.6.3"}
:install-deps true
:infer-externs true})
(target)))
(deftask server
"Make server files"
[]
(comp
(cljs :source-map true
:optimizations :none
:compiler-options {:main "server.main"
:target :nodejs
:npm-deps {:express "4.16.2"
:react "16.2.0"
:react-dom "16.2.0"
:create-react-class "^15.6.3"}
:install-deps true
:infer-externs true})
(target)))
Possibly using https://github.com/seancorfield/boot-tools-deps? That could help as well with keeping deps separate (if that is something you'd like do to)
You could maybe use it with either two aliases or even separate deps.edn
files
Hey @lalanikki what do you mean with separate source paths? would you like to have different values for :source-paths
for the two builds?
you could call set-env!
inside the task. That would prevent chaining them though, so the next step would be to run the task in a pod and set the sources there. That would mean having subfolders for the client and server code (if I understood correctly) (?)
If you scroll up I had a similar problem and candera kindly suggested a solution https://clojurians.slack.com/archives/C053K90BR/p1517755943000006
@martinklepsch @nha I do seem to have the same situation - common, client, & server subdirectories where I want to exclude client from server file path and vice versa. Trying the solution @candera suggested with including in the task.
It’s sort of gross to have that sort of side effect, though. The more I think about it the less I’m thrilled with that. But not a Boot expert - maybe @micha or @alandipert or someone with more experience can comment. It’s certainly ought to be an option to have more than one build.boot in the same repo. But I guess if nothing else you can always restore the environment afterward.
Client-side entrypoint targets the browser and references document which you only find on client. When that runs when the server starts up, it causes a crash
Also, in loading the client entrypoint file it has references to server side libraries that cause errors
Nothing should reference files not used by build, no need to separate source-paths
You don't have .cljs.edn
files? That would break this because that case is horrible hack and breaks everything
https://github.com/boot-clj/boot-cljs/blob/master/src/adzerk/boot_cljs.clj#L163-L166
@juhoteperi which case is the hack?
Without .cljs.edn
file Boot-cljs will require all .cljs files in the fileset
Which is really bad idea, but required for legacy reasons in this case (boot-reload etc.)
Maybe this should be deprecated and instead the task could spit out a default “fill-in-the-blanks” cljs.edn file?
it's just unable to figure out what exactly the entry point is, so it pulls in everything
Only way around this would be to hardcode boot-cljs to include boot-reload/cljs-repl/figwheel files in addition to main/require option, so it wouldn't have to load everything
The problem is that "addon" tools presume boot-cljs will automatically load their namespaces, if .cljs.edn can't be found
That is, only way if we keep supporting using boot-cljs without .cljs.edn, if we force everyone to use .cljs.edn files, that will remove lots of problems
When using Boot and Cider and am trying to compile a class with :gen-class
in the namespace declaration, I’m getting a ClassCastException. Example:
(ns com.grzm.ex.boot.ds
(:gen-class
:name com.grzm.ex.boot.DS))
(comment
(compile 'com.grzm.ex.boot.DS) ;; evaling this line
)
Exception details:
java.lang.ClassCastException: java.base/java.io.File cannot be cast to java.base/java.lang.String
clojure.lang.Compiler$CompilerException: java.lang.ClassCastException: java.base/java.io.File cannot be cast to java.base/java.lang.String, compiling:(com/grzm/ex/boot/DS.clj:1:1)