Fork me on GitHub
#shadow-cljs
<
2018-08-25
>
smnplk06:08:44

After upgrading shadow-cljs to the latest version 2.6.3, why does the log output still say "server version: 2.4.26" and "cli version: 2.4.26" ? If I do "which shadow-cljs" it does point to the new binary /home/simon/.nvm/versions/node/v10.8.0/bin/shadow-cljs

urbanslug06:08:47

ok uploading a screenshot but it's taking forever

smnplk06:08:32

oh, nvm. I didn't run npm upgrade. 🙂

urbanslug07:08:34

I wonder whether I should have different {:main {:entries [...]}}

thheller07:08:32

you are including the wrong output file

thheller07:08:51

shoud be js/devcards/main.js

thheller07:08:28

@smnplk the version installed in the project is always used over the global install

urbanslug07:08:49

hmmm is it just me or does devcards still need saving for me to see the changes? I should probably watch the talk

urbanslug07:08:18

I thought it would be the inventing on principle thing or storybook where I change text and the UI changes

urbanslug07:08:22

without a save

urbanslug07:08:44

this feels just like shadow-cljs hot reload

thheller07:08:05

you still need to save. something smarter would require pretty heavy compiler modifications

thheller07:08:53

you can use the REPL though

thheller07:08:04

which is generally faster than saving, waiting for watch etc

urbanslug07:08:01

ok defcard I'm using defn

urbanslug07:08:12

hmmm let me see how I can do this > you can use the REPL though

urbanslug07:08:57

from what you're saying though I don't see a big difference between devcards and what shadow does. I could have shadow with a different build outputting to a different js file referenced by a different html and get the same result, right?

thheller07:08:38

devcards is just a clojurescript library. shadow doesn't do anything comparable no.

thheller07:08:39

devcards is not responsible for any live-reloading or anything. that is done by shadow or figwheel

urbanslug07:08:28

hmmm ok I should really finish reading the readme because defcard doesn't even create a function

urbanslug07:08:39

Yeah let me first do what the docs say

thheller07:08:02

if you haven't watched the talk then yes you should definitely watch the talk

urbanslug07:08:25

haha ya I clearly dk what this tool is for. 😄 I created a devcard and can't get those nice meters on it

urbanslug07:08:38

(ns sniff.devcards
  (:require [devcards.core :refer-macros (defcard)]
            [devcards.core :as dc] 
            [reagent.core :as r]))

(def x 10)

(defcard simple-component [x]
  [:div
   [:p (str  "I am a component!" x) ]
   [:p.someclass
    "I have " [:strong "bold"]
    [:span {:style {:color "red"}} " and red "] "text."]])


(defn ^:export main
  []
  (dc/start-devcard-ui!))

urbanslug07:08:29

and screenshots by ff is taking forever to upload

thheller08:08:10

pretty sure that that is not the correct way to create a devcard

thheller08:08:23

I never used it but the [x] is definitely out of place

urbanslug09:08:21

hahaha I read the docs and yeah it wasn't

urbanslug09:08:24

I can kinda see what devcards are for. Taking a component out and just seeing what's wrong with it in isolation

urbanslug09:08:32

Now to use a deps.edn

thheller09:08:02

I'd say its about getting visual examples of you components in different states

thheller09:08:10

not about "seeing whats wrong with it"

raf19:08:39

Hi! I'm working or re-frame/reagent application and somehow I cannot force shadow-cljs to do live reloading of page content. The strange part is that repl and browser are connect and when I save the file I see in the browser log:

shadow-cljs: load JS <name>
but he HTML on the page is not changed. When I refresh whole page I see the changes. Any tip what is going on? Or maybe where in shadow JS code I could look to debug it

thheller19:08:09

do you have the hooks properly configured?

thheller19:08:14

the page doesn't change without hooks and you triggering the page update

thheller19:08:48

in reagent apps there typically is a call to render which you need to call again in the hooks

raf19:08:37

@thheller oh, I read the manual but somehow I've missed the need to add those hooks. Again you save me lot of time!

raf19:08:59

@thheller and of course it works, as you suggested I've added the hook to the main render method and I have my live reloading of HTML 👍

👍 4
thheller20:08:39

@richiardiandrea nice article on the cursive setup. one small nitpick: the source-map-support install is not required. shadow-cljs already depends on that and ensures that it is installed.

richiardiandrea20:08:56

oh cool thank you

richiardiandrea20:08:14

I guess this is true only for npm install though am I right?

thheller20:08:45

also the new npx create-cljs-project foo might be useful. skips the yarn init + yarn add calls

thheller20:08:03

its new so it doesn't have any options yet but saves some typing already 😉

thheller20:08:40

yarn create cljs-project foo also works

thheller20:08:26

@richiardiandrea not sure what you mean by npm install?

richiardiandrea20:08:38

I mean npm install shadow-cljs

thheller20:08:02

yes that is already required basically. it provides the few dependencies we require.

thheller20:08:14

source-map-support, node-libs-browser, ws, etc

richiardiandrea20:08:32

ok cool, as long as it is it pulled transitively 😄 will add a comment on that, thank you!

raf20:08:02

taking the opportunity I have one more question (I've started using shadow-cljs few days ago and still try to figure out all the stuff - still I think it's superior work!): is there way to make live reload of work with the repl? I mean: when I run some code I repl I would like to see the changes in my reagent app

richiardiandrea20:08:29

is create-cljs-project a new thing? since which version?

thheller20:08:53

@raf just call the :after-load function you just added via the REPL

thheller20:08:23

ie. make a change, eval it, then eval the render

thheller20:08:43

there is no REPL hook to do that automatically. not sure that would be a good idea

richiardiandrea20:08:31

oh, ok did not check after that 😉

raf20:08:30

also not sure if this would be a good idea 😉 and of course you've helped me again. When I've run the render method in repl I see my changes. Now I think my whole development environment is ready to do some coding 😉

thheller20:08:04

@raf which editor are you using? in Cursive you could make a REPL command for (your.app/render) and bind it to a key

thheller20:08:17

so you could re-render on keypress. might be useful.

raf20:08:23

@thheller I'm using Emacs with Cider

thheller20:08:41

its possible there too but I have no idea how 😉

raf20:08:43

and ofc I could do that in Emacs 😉

raf20:08:00

I think I know 😄

raf20:08:27

@thheller if I find time maybe I will write small blog post about all the stuff you have learned my on this slack - maybe it safe you some time with "another me" next time 😄

thheller20:08:42

I always try to note what questions people ask and update the docs accordingly but sometimes stuff gets in the way

thheller20:08:48

so blog posts are always welcome 😉 as are docs PRs

richiardiandrea20:08:30

😄 that is what I did for the Cursive blog post, that's great that you are always online Thomas, especially in terms of usability shadow-cljs does not have rivals

raf20:08:01

true that! I find shadow-cljs the best option right now, plus the possibility to ask you a question here is also extremely nice

raf20:08:41

@thheller I think your manual has all the bits that are needed, but sometimes if you're new to the subject it's hard to connect them in one story

thheller20:08:00

yeah its tough to properly organize sometimes

thheller20:08:16

I'll be writing a proper quickstart guide once I figure out this template situation

raf20:08:04

great, good luck with that 🙂

richiardiandrea20:08:27

@thheller yarn create-cljs-project cursive-shadow-cljs does not work but the npx version does

richiardiandrea20:08:25

I think yarn does not do project resolution from npm

thheller20:08:04

@richiardiandrea not the extra space in my example. yarn has a special create command which is kind of a gimmick

thheller20:08:20

so yarn create cljs-project loads the create-cljs-project package and calls it

thheller20:08:26

npx just calls whatever

richiardiandrea20:08:34

wow completely missed reading that 😄

richiardiandrea20:08:09

adding it to the post

raf20:08:35

I will call it a night. Have a good one, bye

👋 4
ghiden23:08:43

Hello. I just started to play with shadow-cljs a few days ago. How do you start an external server from shadow-cljs? I have a boot file that starts a proxy server to backend API, and my re-frame app talks to the API server through this proxy. Is this something possible to do with shadow-cljs?