Fork me on GitHub
#shadow-cljs
<
2021-03-31
>
superstructor08:03:42

lein new re-frame my-app template had a major new release today. It now creates a pure shadow-cljs build using shadow-cljs.edn and package.json as the source of configuration. Appreciate any testing, feedback, issues or PRs from the shadow-cljs community to improve it further. https://github.com/day8/re-frame-template

thheller08:03:44

nice! one thing you might want to consider is using npm-run-all and cross-env like this setup does https://github.com/jacekschae/shadow-cljs-tailwindcss/blob/main/package.json#L2-L10

thheller08:03:00

cross-env to make things work in windows, since it doesn't support the FOO=thing env vars otherwise

thheller08:03:24

npm-run-all contains the run-p and run-s utils to run things in parallel or sequentially

thheller08:03:58

(might be useful if you ever intend to add something like that)

thheller08:03:38

also please consider updating the use of the :devtools :http-root and :http-port. they have been deprecated for years and :dev-http should be used instead https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http

superstructor08:03:08

thanks for the link re npm-run-all / cross-env, that will be very helpful.

superstructor08:03:15

I'll fix the :devtools usage now.

thheller09:03:22

:dev-http {8280 {:root "resources/public" :handler foo.bar}} would be the handler variant

superstructor09:03:36

Thanks, but have removed the handler support as we decided to focus purely on the best possible client side experience (being a 're-frame' template) and leave the backend impl to other projects.

superstructor09:03:07

I have released v2.0.1 that fixes the deprecated use of devtools, uses dev-http.

thheller09:03:54

does the top-level :build-hooks actually work? I can't remember 😛

thheller09:03:29

:build-defaults {:build-hooks ...} should but otherwise no right?

superstructor09:03:31

oh ops; maybe I messed up the template

superstructor09:03:47

Thanks for spotting that @thheller. v2.0.2 is releasing on ci now, will be live in 10 minutes. Tested w/ build-defaults and the version is set correctly.

👍 3
Gleb Posobin13:03:44

How do I keep my package.json updated? I updated my cljs dependencies, how do I prune and update the JS packages they were depending on?

richiardiandrea15:03:26

My favorite way is yarn upgrade-interactive --exact

thheller13:03:14

manually checking it I guess? shadow-cljs provides no tools to do so

wombawomba14:03:07

How can I get a 'nice' stand-alone terminal REPL going with shadow-cljs? Ideally something like https://github.com/bhauman/rebel-readline

thheller14:03:24

you only get a basic REPL for the terminal. most people use REPL provided by their editor so terminal REPL hasn't had much work

thheller14:03:11

not aware of anyone working on one either

wombawomba17:03:07

Alright. How would I go about making one?

wombawomba17:03:28

I'm thinking it shouldn't be that much work to add at least basic readline support/autocompletion to the existing one

thheller17:03:03

you could build one on top of nrepl, maybe using cider-nrepl. then you basically get all the features that has out of the box and you just write the readline code

wombawomba17:03:43

is the basic shadow-cljs repl talking to an nrepl server, or is it hosting one?

thheller17:03:21

no the basic repl is using a plain streaming socket repl. thats why it has basically no extra features

thheller17:03:43

if you have a shadow-cljs server or shadow-cljs watch running you can find the nrepl port via the .shadow-cljs/nrepl.port file

thheller17:03:29

nrepl is a fairly simple protocol so should be easy to do

wombawomba17:03:56

would it be possible to instead hook into the existing shadow-cljs command? so I wouldn't have to keep track of two services

wombawomba17:03:24

i.e. could I extend it with my own command that runs my REPL and also manages a shadow-cljs server?

thheller17:03:49

that would be something your tool would do

thheller17:03:11

I mean since that needs to control the input stream to hook up the readline stuff

thheller17:03:32

if you run the shadow-cljs command separately or from whatever process you launch is your choice