shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
wilkerlucio 2020-12-05T03:03:28.351800Z

is there way to tell shadow to output exports using export ... format instead of Object.defineProperty(module.exports, ...)?

thheller 2020-12-05T09:19:56.352500Z

via https://clojureverse.org/t/generating-es-modules-browser-deno/6116 only

πŸ‘ 1
wilkerlucio 2020-12-05T03:03:54.352100Z

using :npm-module target

benny 2020-12-05T09:35:38.354300Z

can I use shadow-cljs to create an "uberjar" like node bundle? I want to compile something on one platform and transfer a single file or small archive to the target platform and have node it without any dependency issues

βœ… 1
benny 2020-12-05T09:43:23.354500Z

note to self: first try to read documentation: https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-script

thheller 2020-12-05T09:47:32.354700Z

that doesn't bundle the dependency by default

thheller 2020-12-05T09:47:41.354900Z

you can use something like https://github.com/vercel/ncc to make it fully self contained

thheller 2020-12-05T09:47:56.355200Z

or even https://github.com/nexe/nexe

theeternalpulse 2020-12-05T10:07:02.358200Z

I'm trying to integrate flow-storm-debugger in my development workflow with shadow. It requires that you first call the flow-storm-debugger.main/-main and then connect using flow-storm-api/connect. I originally added a preload of a .cljs file but it needs to run the debugger in a clj context. Is there a way to execute that debugger.main namespace as part of my build?

theeternalpulse 2020-12-05T10:09:08.358400Z

I'm not using this workflow, would I need to switch? https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run

thheller 2020-12-05T10:27:25.358600Z

sorry I don't have a clue what flow-storm is

benny 2020-12-05T10:37:03.358800Z

weird, I used the release target and my single cljs dependency was bundled

benny 2020-12-05T10:37:46.359Z

oh sorry: node is on the target platform, but that's it. I don't need a single file executable, a single file script is enough for my usecase (arm7l system)

theeternalpulse 2020-12-05T10:52:18.359200Z

It's a debugger that I can connect to, but it requires a startup beforehand in clojure, and connecting to it when the app loads

theeternalpulse 2020-12-05T10:52:59.359400Z

Basically I want to run it beforehand, but I'm clojure, and then connect using a preload

thheller 2020-12-05T11:07:58.359600Z

then run the clj part however the instructions tell you

thheller 2020-12-05T11:08:49.359800Z

seems to be a separate application so you need to run it separately πŸ˜›

thheller 2020-12-05T11:11:11.360Z

yes if you only use CLJS and the built-in node packages that'll be fine as is

thheller 2020-12-05T11:11:34.360200Z

but if you add any npm dependencies it'll either require the node_modules folder wherever you are running or post-processing a release build with ncc

wontheone1 2020-12-05T16:21:56.361400Z

Hello! I just started using shadow-cljs (I used leiningen only)

wontheone1 2020-12-05T16:22:52.362500Z

{:source-paths ["src" "test"]
 :dependencies [[com.taoensso/timbre "4.10.0"]
                [macchiato/core "0.2.16"]]
 :builds {:app {:devtools {:repl-init-ns backend.core
                           :repl-pprint true}
                :main   backend.core/server
                :target :node-script
                :source-map true
                :exports {:server backend.core/server}
                :output-dir "target"
                :output-to "target/main.js"
                :compiler-options {:optimizations :simple}}}
 :nrepl {:init-ns backend.core}}
^ My edn file looks like this but where do I put development dependencies. Can’t see example from the official doc. I want to include [binaryage/devtools "1.0.2"]

wontheone1 2020-12-05T16:25:15.363300Z

:profiles {:dev     {:source-paths ["dev"]
                       :repl-options {:init-ns user}
                       :dependencies [[midje "1.9.9"]
                                      [ring/ring-mock "0.4.0"]]
                       :aliases      {"test-ancient" "midje"
                                      "upgrade-deps" ["ancient" "upgrade" ":all" ":check-clojure"]}
                       :bikeshed     {:max-line-length 120
                                      :docstrings      false}}
^ Would using dev profile work? (This is from my leiningen project.clj )

thheller 2020-12-05T16:36:53.363600Z

just include it always. doesn't matter.

theeternalpulse 2020-12-05T16:56:48.363700Z

right, I want it integrated into the build, so trying with the clj-run option

theeternalpulse 2020-12-05T17:00:23.363900Z

That seemed to do it

wontheone1 2020-12-05T19:25:43.365100Z

@thheller Thank you. Just to clarify, do you mean I include it in :dependencies (top level)?

theeternalpulse 2020-12-05T20:28:40.365200Z

I was hoping there was a way to have preloads run clj files to execute so I could just do cider jack in from cider

thheller 2020-12-05T20:54:23.366100Z

@wontheone1 yes. it won't have any negative impacts.

wontheone1 2020-12-05T20:57:04.366700Z

Aha thank you. I guess some dead code elimination πŸ™‚ makes sense

thheller 2020-12-05T23:34:29.367300Z

that doesn't apply. just adding a dependency does not automatically include it in a build. you actually need to require the namespaces it provides.