This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-09
Channels
- # announcements (1)
- # babashka (14)
- # calva (8)
- # chlorine-clover (3)
- # clerk (6)
- # clj-kondo (27)
- # cljdoc (20)
- # clojars (6)
- # clojure (53)
- # clojure-denver (8)
- # clojure-europe (17)
- # clojure-nl (1)
- # clojure-norway (270)
- # clojure-uk (5)
- # clojurescript (35)
- # community-development (7)
- # cursive (12)
- # datalevin (3)
- # datomic (26)
- # etaoin (23)
- # exercism (1)
- # hyperfiddle (3)
- # java (14)
- # nrepl (2)
- # off-topic (12)
- # pathom (3)
- # portal (44)
- # practicalli (2)
- # reagent (7)
- # releases (1)
- # shadow-cljs (13)
- # timbre (3)
- # xtdb (4)
Does touching the package.json of an npm package still cause the package to reload? I haven’t been able get hot code reload working forever for npm linked packages. And this makes my workflow really slow.
why are you trying to hot load npm packages? and yes, package.json changing should still cause a recompile. whether or not hot-reload is up to the package. many npm/js things aren't really hot-reloadable
I write all the UI components in react typescript and have custom hooks that will pull in data from cljs and publish actions to cljs land, because cljs is good with data. The UI components are a separate project because: • Storybook driven development FTW. (I know this can be done with cljs but it’s a pain, one has to enlist the control types and it’s not done automatically) • So much better when letting freelance react and typescript developers build UI components. • A lot of libraries look awkward and take time to write when invoked from cljs/reagent. I use a lot of prosemirror, google-map apis and it’s much simpler to do it all in JS. • TS is nice for UI development and Storybook. Nullchecks and documentation of props are very useful. Prop types are automatically converted to controls in Storybook. • Embracing JS/React world for the libs and pool of people (many junior devs) and embracing CLJS for the ultimate productivity when it comes to working with data (few senior devs). It has worked very well for us. The whole App is written in TSX (we freelance to get the components built, Figma has a plugin that allows exporting a component as HTML + TailwindCSS, so a lot of times this is just copy and paste and some tweaking to use the custom hooks to get the data). The App is imported into cljs as a lib. The data plumbing, routing and event handling is all done in CLJS by just two devs. We want to restrict access to the clj+cljs project so we don’t want to pull in the UI project into it and use babel to generate JS that can be used directly.
Well, I tried touching, and just changing something and saving the package.json but it didn’t cause a recompile. It’s quite sad. Every month or so I revisit this and fail at a solution. It hampers our devX quite a bit.
Many many thanks for ShadowCLJS btw, it has been really smooth for us and has a very well thought design.
If there was an api in shadow-cljs, where I could specify the package I want to watch/hot-reload, that would be nice. (I’m aware of the history here: https://github.com/thheller/shadow-cljs/issues/759)
so how are you doing all of the above? like what is building the JS code, how is the CLJS build configured?
Vite is building the JS code in library mode. For cljs, the shadow-cljs config is simple:
{:deps {:aliases [:client]}
:nrepl {:port 7000}
:dev-http {8000 "target"}
:builds {:app {:target :browser
:output-dir "target/scripts/"
:asset-path "/scripts/"
:modules {:core {:init-fn }}}}}
The whole App and all the internal components are written in TS. It uses custom hooks for subscribing to state and dispatching events. These hooks are based on functions that are registered in react context. When I import this JS app in cljs, I pass the functions as part of the context.
I write all the UI components in react typescript and have custom hooks that will pull in data from cljs and publish actions to cljs land, because cljs is good with data. The UI components are a separate project because: • Storybook driven development FTW. (I know this can be done with cljs but it’s a pain, one has to enlist the control types and it’s not done automatically) • So much better when letting freelance react and typescript developers build UI components. • A lot of libraries look awkward and take time to write when invoked from cljs/reagent. I use a lot of prosemirror, google-map apis and it’s much simpler to do it all in JS. • TS is nice for UI development and Storybook. Nullchecks and documentation of props are very useful. Prop types are automatically converted to controls in Storybook. • Embracing JS/React world for the libs and pool of people (many junior devs) and embracing CLJS for the ultimate productivity when it comes to working with data (few senior devs). It has worked very well for us. The whole App is written in TSX (we freelance to get the components built, Figma has a plugin that allows exporting a component as HTML + TailwindCSS, so a lot of times this is just copy and paste and some tweaking to use the custom hooks to get the data). The App is imported into cljs as a lib. The data plumbing, routing and event handling is all done in CLJS by just two devs. We want to restrict access to the clj+cljs project so we don’t want to pull in the UI project into it and use babel to generate JS that can be used directly.