devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
bhauman 2015-10-05T00:33:45.000008Z

Added some more devcards documentation:

đź‘Ť 2
bhauman 2015-10-05T00:35:33.000011Z

@darwin: I'd look at the IDevcardOptions protocol in the docs above

bhauman 2015-10-05T00:35:45.000012Z

lets you override the path

2015-10-05T14:40:23.000015Z

@bhauman: thanks a lot, will revisit my code soon-ish

2015-10-05T14:50:42.000016Z

@bhauman: while you are at documenting things, I would really appreciate some doc on how to build my initial data only if defcard is going to be displayed - for example look at defcard reagent-support here http://rigsomelight.com/devcards/#!/devdemos.core, what if building re-bmi-data is a heavy-weight operation? I want to build it only if the card is going to be displayed. Maybe passing a function there?

bhauman 2015-10-05T14:53:16.000018Z

@darwin you can defonce an ratom and pass that in as your initial data

bhauman 2015-10-05T14:54:07.000019Z

@darwin you can also defonce initial data (a map) and pass that in as well

2015-10-05T14:54:37.000020Z

ok, that would work for figwheel-workflow, but what if I want to do a full refresh for some reason, then I get all the heavy objects from all cards re-created

2015-10-05T14:54:56.000021Z

the issue for me wasn’t really speed, but debug logging

2015-10-05T14:55:11.000022Z

I wanted to focus on one card and ignore others for a while

2015-10-05T14:55:19.000023Z

had to comment-out all my other cards

2015-10-05T14:55:42.000024Z

or push the init code into render function of the component as a quick hack

bhauman 2015-10-05T15:14:12.000025Z

@darwin: well that seems like the cost of doing business right.

bhauman 2015-10-05T15:14:39.000026Z

@darwin: but you can focus on one card though, by clicking the heading

2015-10-05T15:14:56.000027Z

that is what I did, but all namespaces get loaded and all init code runs

2015-10-05T15:16:09.000028Z

I would like to have some way how to build init data on-demand, only when devcard is going to be displayed

2015-10-05T15:16:57.000029Z

not sure about tests tough,

2015-10-05T15:17:04.000030Z

they also run all the time I guess

bhauman 2015-10-05T15:18:12.000031Z

@darwin: there is a figwheel client side flag that isn't documented called :reload-dependents

bhauman 2015-10-05T15:18:26.000032Z

@darwin: tests only run if the card is mounted

bhauman 2015-10-05T15:18:49.000033Z

if you set that flag to false then the other ns won't be loaded every time

2015-10-05T15:20:18.000034Z

hm, I will look for some solutions, maybe my workflow was broken, I didn’t use figwheel for this, because my atoms weren’t updated on change for some reason, so I had to do full refreshes

2015-10-05T15:20:48.000035Z

but still the thing that all my devcard init code runs even if I just directly view one devcard is not optimal

bhauman 2015-10-05T15:21:10.000036Z

@darwin: here is what you can do

2015-10-05T15:21:15.000037Z

I had situations where I broke my code, and wanted to fix it on one particular card, but all were broken giving me hard time debugging it

bhauman 2015-10-05T15:21:48.000038Z

just create an a react component that initializes your data when it's mounted

bhauman 2015-10-05T15:22:20.000039Z

Have it take a function

bhauman 2015-10-05T15:22:38.000040Z

then make that the first card on the page

bhauman 2015-10-05T15:23:36.000041Z

This is also a good solution for your app. Top level init isn't very good. Enclosing this stuff into a component gives you much more control

2015-10-05T15:24:23.000042Z

ok, will try to something like this, will rewrite my stuff with IDevcardOptions anyway, it will be good opportunity to revisit this

2015-10-05T15:24:32.000043Z

thanks for the hints

bhauman 2015-10-05T15:25:08.000044Z

there is also Stuart sierras component which works in CLJS now

2015-10-05T15:25:30.000045Z

want to use it, just saw his talk from StrangeLoop few years back

2015-10-05T15:25:47.000046Z

need to rewrite most of my defs this way

bhauman 2015-10-05T15:28:21.000048Z

but react comps work as well or better

bhauman 2015-10-05T20:06:07.000049Z

@meow: Just letting you know my strategy for creating a devcards website. Create an index.html at the root of my repository that references built assets in the resources dir. And then create a gh-pages branch from master.

đź‘Ť 1
bhauman 2015-10-05T20:07:35.000051Z

The every so often build the website build and merge it into gh-pages

bhauman 2015-10-05T20:07:50.000052Z

gh-pages is simply a mirror of my master

shaun-mahood 2015-10-05T21:16:42.000054Z

@bhauman: I've started using devcards for building out project and technical requirements, it's working really well for it. I prefer it to pretty much all the alternatives I've tried, including markdown based editors, bug trackers and project management software . Just feels so freeing to be able to extend things as far as I want and have everything respond so quickly to changes.

bhauman 2015-10-05T21:19:34.000055Z

@shaun-mahood: Thats good to hear :simple_smile: Yeah live code and docs together is pretty expressive. I'm glad you are having fun with it.

bhauman 2015-10-05T21:20:10.000056Z

@shaun-mahood: I'm pretty busy updating the docs

shaun-mahood 2015-10-05T21:23:38.000057Z

I'm mostly surprised at how nice it is to use it for the simplest things using just defcard and deftest, without anything complex. Docs are definitely coming along too, it's way more understandable and the case for it seems much clearer than when it was first announced.

shaun-mahood 2015-10-05T21:24:19.000058Z

I have a bunch of work coming up that's outside of clojure / cljs and I'm already feeling depressed about it.

bhauman 2015-10-05T21:31:36.000059Z

darn, sorry to hear that

shaun-mahood 2015-10-05T21:37:47.000060Z

I've got plans for eventually getting it all moved over. May be rebuilding one of the apps sooner than later into cljs, so that part will be fun.

đź‘Ť 1