Fork me on GitHub
#shadow-cljs
<
2018-01-15
>
mhuebert09:01:47

would it make sense to have some kind of --reload option for clj-run?

thheller09:01:21

I'd suggest using clj-repl and invoking the function via the REPL while developing it

thheller09:01:38

you can do (require 'the.ns :reload) then

thheller09:01:16

cursive and others let you Load file in REPL directly as well which also works

thheller09:01:41

I feel like the REPL would be much more productive than --reload

thheller09:01:50

but I can add it if you feel like you need it

mhuebert09:01:39

while i am developing, i’d be using a repl (probably evaluating the stuff from my editor)

mhuebert09:01:37

but sometimes i might have a process running in the background from coding, and i want to build a release from the command line using the latest state of the code

thheller09:01:02

any particular reason you are not calling that from the REPL?

mhuebert09:01:31

i have a release command in package.json so that other team members only need to remember one thing (eg. npm run release) and this is what our ci / build systems call

thheller09:01:55

ah. makes sense.

thheller09:01:31

I feel like you'd just add --reload permanently then though and just let it always reload?

mhuebert09:01:08

the intent would be that anyone else touching the system wouldn’t have to worry about npm run release not using the latest version of that code

thheller09:01:56

I don't think clojure records when something was loaded. otherwise I could probably do something automatic

mhuebert09:01:57

by way of example, say i have a dev-server running in the background. i run shadow-cljs watch browser and do some front-end coding, with live reload. Then I close the watch process and want to run a release

mhuebert09:01:38

normally i’d just run this from the command line, npm run release, but since the dev-server is in the background i end up restarting it whenever i do releases. possibly because i just haven’t developed the habit of using a repl for that bit

thheller09:01:25

hmm yeah restarting the server shouldn't be a necessary thing

thheller09:01:16

I'll see if I can figure out an automatic way to do this. if not I'll add the flag.

mhuebert09:01:07

is there any difference at all between shadow-cljs watch browser vs. shadow-cljs clj-run my-build-ns.core/watch, wherein I do some cleanup and then run (shadow.cljs.devtools.api/watch <build-id>) ?

mhuebert09:01:14

(where ‘cleanup’ means ’revert some asset-path transformations performed during release` and other such build-pipeline-related stuff)

thheller09:01:52

tiny bit of difference maybe

thheller09:01:18

watch stops the build when connected to the server an you CTRL+C

thheller09:01:35

the clj-run probably doesn't

thheller09:01:17

I'm still sorting out the hook API that would let you hook into :watch-start :release etc events

thheller09:01:42

then you could probably use that instead of clj-run

mhuebert10:01:44

so in the meantime, shadow-cljs clj-run my.build.ns/before-watch; shadow-cljs watch browser;

mhuebert10:01:11

which, if a server is already running, is super fast, otherwise it starts a server process twice

thheller10:01:41

shadow-cljs start; shadow-cljs clj-run my.build.ns/before-watch; shadow-cljs watch browser;

thheller10:01:52

start starts a background server if none is running

mhuebert10:01:34

do you recommend putting shadow-cljs into :npm-deps?

thheller11:01:39

at most it is a dev dependency which :npm-deps doesn't handle