shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
superstructor 2021-03-31T08:38:42.268700Z

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

thheller 2021-03-31T08:39:44.269500Z

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

thheller 2021-03-31T08:40:00.269900Z

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

thheller 2021-03-31T08:40:24.270500Z

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

thheller 2021-03-31T08:40:58.271400Z

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

thheller 2021-03-31T08:45:38.273200Z

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

superstructor 2021-03-31T08:46:08.273700Z

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

superstructor 2021-03-31T08:46:15.274100Z

I'll fix the :devtools usage now.

thheller 2021-03-31T09:05:22.275600Z

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

superstructor 2021-03-31T09:11:36.278200Z

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.

superstructor 2021-03-31T09:12:07.278900Z

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

thheller 2021-03-31T09:13:58.279100Z

thanks

thheller 2021-03-31T09:14:54.279500Z

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

thheller 2021-03-31T09:15:29.280Z

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

superstructor 2021-03-31T09:15:31.280200Z

oh ops; maybe I messed up the template

superstructor 2021-03-31T09:23:47.281400Z

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.

👍 1
Gleb Posobin 2021-03-31T13:34:44.283800Z

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?

thheller 2021-03-31T13:45:14.284400Z

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

wombawomba 2021-03-31T14:10:07.285600Z

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

thheller 2021-03-31T14:16:24.287Z

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

thheller 2021-03-31T14:17:11.287200Z

not aware of anyone working on one either

richiardiandrea 2021-03-31T15:26:26.287300Z

My favorite way is yarn upgrade-interactive --exact

wombawomba 2021-03-31T17:23:07.288100Z

Alright. How would I go about making one?

wombawomba 2021-03-31T17:24:28.289500Z

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

thheller 2021-03-31T17:26:03.290300Z

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

wombawomba 2021-03-31T17:28:59.290700Z

alright

wombawomba 2021-03-31T17:29:43.291700Z

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

thheller 2021-03-31T17:30:21.292300Z

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

thheller 2021-03-31T17:32:43.292900Z

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

wombawomba 2021-03-31T17:33:08.293200Z

alright

thheller 2021-03-31T17:33:29.293900Z

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

wombawomba 2021-03-31T17:33:34.294100Z

right yeah

wombawomba 2021-03-31T17:33:56.294600Z

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

wombawomba 2021-03-31T17:34:24.295200Z

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

thheller 2021-03-31T17:34:49.295500Z

that would be something your tool would do

thheller 2021-03-31T17:35:11.296Z

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

thheller 2021-03-31T17:35:32.296400Z

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

wombawomba 2021-03-31T17:35:37.296600Z

alright