Fork me on GitHub
#shadow-cljs
<
2017-11-29
>
sundbp01:11:13

not quite sure what best way is for threading a parameter all the way there. what approach would you suggest?

thheller09:11:30

@sundbp does you code actually run this long? I noticed that sometimes the REPL doesn’t properly return the result and ends up in a timeout which is a bug.

thheller09:11:49

could make it configurable but where? 😛

thheller09:11:06

problem is that there is no way to interrupt JS

sundbp09:11:29

i’m using the REPL and sometimes have some long DB queries and such I’m waiting for. for exploration.

sundbp09:11:13

was thinking an option in shadow-cljs.edn would be logical

thheller10:11:06

:devtools {:repl-timeout a-number}?

thheller10:11:56

btw I can’t figure out why source maps don’t work (in :node-library)

thheller10:11:50

they work just fine in :node-script

sundbp10:11:04

yeah, something like that option was what i was hoping for

sundbp10:11:16

seems small differences between the two profiles..

thheller10:11:04

yeah there are but I can’t figure out why they would affect source maps

thheller10:11:53

well … I probably know why it doesn’t work but don’t have a solution yet

thheller10:11:16

I generate a piece of code the the exports. that piece does not have source maps so there is a “gap”

thheller10:11:42

the gap seems to confuse the source mapper

sundbp10:11:27

right.. i’m actually producing a node-script, but used node-library to use the bin/runner.js

sundbp10:11:07

so i can switch it to node-script relatively easily to get source-maps if needed

mitchelkuijpers12:11:03

I am running into this case on my build-server:

<- Compile CLJS: om/next.cljc (15087 ms)
Cache write: om/next.cljc
aborted par-compile, [:shadow.build.classpath/resource "fulcro/client/util.cljc"] still waiting for #{om.next}
{:aborted [:shadow.build.classpath/resource "fulcro/client/util.cljc"], :pending #{om.next}}
ExceptionInfo: aborted par-compile, [:shadow.build.classpath/resource "fulcro/client/util.cljc"] still waiting for #{om.next}
	clojure.core/ex-info (core.clj:4739)
	clojure.core/ex-info (core.clj:4739)
	shadow.build.compiler/par-compile-one (compiler.clj:647)
	shadow.build.compiler/par-compile-one (compiler.clj:622)
	shadow.build.compiler/par-compile-cljs-sources/fn--11576/iter--11577--11581/fn--11582/fn--11583/fn--11584 (compiler.clj:721)
	clojure.core/apply (core.clj:657)
	clojure.core/with-bindings* (core.clj:1965)
	clojure.core/with-bindings* (core.clj:1965)
	clojure.core/apply (core.clj:661)
	clojure.core/bound-fn*/fn--5471 (core.clj:1995)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
	java.lang.Thread.run (Thread.java:748)
Is this fixable?

thheller12:11:28

its supposed to timeout after 30sec

thheller12:11:43

but it completed om.next … not sure whats happening

mitchelkuijpers12:11:13

Maybe this helps:

mitchelkuijpers12:11:18

17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/logging.cljc"] waiting for #{om.next}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/i18n.cljc"] waiting for #{fulcro.client.logging}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/mutations.cljc"] waiting for #{fulcro.client.util fulcro.client.logging om.next fulcro.i18n}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/impl/om_plumbing.cljc"] waiting for #{fulcro.client.mutations fulcro.client.logging om.next}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/impl/data_fetch.cljc"] waiting for #{fulcro.client.util fulcro.client.mutations fulcro.client.logging om.next fulcro.client.impl.om-plumbing}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/network.cljc"] waiting for #{fulcro.client.logging}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/impl/application.cljc"] waiting for #{fulcro.client.util fulcro.client.impl.data-fetch fulcro.client.network fulcro.client.logging om.next fulcro.client.impl.om-plumbing fulcro.i18n}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/core.cljc"] waiting for #{fulcro.client.util fulcro.client.mutations fulcro.client.impl.application fulcro.client.network fulcro.client.logging om.next fulcro.client.impl.om-plumbing}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "atlas_crm/api/mutations.cljs"] waiting for #{fulcro.client.mutations fulcro.client.logging om.next fulcro.client.routing}
17-11-29 12:48:05 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro/client/routing.cljc"] waiting for #{fulcro.client.util fulcro.client.core fulcro.client.mutations fulcro.client.logging om.next}
17-11-29 12:48:06 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "atlas_crm/ui/app/routes.cljc"] waiting for #{fulcro.client.routing}
17-11-29 12:48:07 cb56ad16b459 WARN [shadow.build.compiler:286] - [:shadow.build.classpath/resource "fulcro_css/core.cljc"] waiting for #{om.next}
<- Compile CLJS: om/next.cljc (15087 ms)
Cache write: om/next.cljc
aborted par-compile, [:shadow.build.classpath/resource "fulcro/client/util.cljc"] still waiting for #{om.next}
{:aborted [:shadow.build.classpath/resource "fulcro/client/util.cljc"], :pending #{om.next}}
ExceptionInfo: aborted par-compile, [:shadow.build.classpath/resource "fulcro/client/util.cljc"] still waiting for #{om.next}
	clojure.core/ex-info (core.clj:4739)
	clojure.core/ex-info (core.clj:4739)
	shadow.build.compiler/par-compile-one (compiler.clj:647)
	shadow.build.compiler/par-compile-one (compiler.clj:622)
	shadow.build.compiler/par-compile-cljs-sources/fn--11576/iter--11577--11581/fn--11582/fn--11583/fn--11584 (compiler.clj:721)
	clojure.core/apply (core.clj:657)
	clojure.core/with-bindings* (core.clj:1965)
	clojure.core/with-bindings* (core.clj:1965)
	clojure.core/apply (core.clj:661)
	clojure.core/bound-fn*/fn--5471 (core.clj:1995)
	java.util.concurrent.FutureTask.run (FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
	java.lang.Thread.run (Thread.java:748)

thheller12:11:58

guess I really need to crank up this delay. did not expect any namespaces to ever take longer to compile than cljs.core

thheller12:11:16

wonder what om.next is doing that its this slow

thheller12:11:26

technically the only reason to have this abort is to prevent infinite loops due to bugs

thheller12:11:58

I’ll just bump the timeout to a minute or so

mitchelkuijpers13:11:44

Thnx that will solve it for now, fulcro has forked om.next, I hope that compiles faster

thheller13:11:40

I need to decide on a framework I want to use for the shadow-cljs UI I want to build

thheller13:11:08

need to try fulcro for that. maybe I can figure out why it so slow to compile.

thheller13:11:20

@mitchelkuijpers try [email protected], bumped the timeout to 60sec

thheller13:11:31

what is the state of fulcro? how stable is it? or still alpha?

mitchelkuijpers13:11:33

Fulcro is pretty awesome in my opinion they even have special devtools released which makes it a pretty nice dev env. If you are seriously interesed I would be happy to assist in any way

mitchelkuijpers13:11:50

They are almost release fulcro 2.0 RC

mitchelkuijpers13:11:03

but there is also a 1.2 version which we are using in production

thheller13:11:25

I like fulcro although I’m not convinced that co-locating queries in components is the best idea

mitchelkuijpers13:11:27

For me the most important thing is that it has good documentation

thheller13:11:33

would kinda prefer if that was decoupled a bit

thheller13:11:48

but I guess too much relies on that idea

mitchelkuijpers13:11:56

We co-locate: queries, initial-state and css

mitchelkuijpers13:11:36

We love it, it makes a lot of stuff a lot more straightforward. For us the biggest win is the graph-db format

thheller13:11:43

I already solved css for me so I don’t need that 😉 https://github.com/thheller/shadow/wiki/shadow.markup

mitchelkuijpers13:11:45

Oh nice, we loved the way fulcro did it because you need to compose css to root. We use that to SSR markup and only return the css that is necessary for that view

thheller13:11:09

whats the performance like? I think om.next always re-renders from the root?

thheller13:11:52

I tested om.next a long while ago and it was pretty terrible performance wise

mitchelkuijpers13:11:18

No you re-render from any point that you like

thheller13:11:24

but it has been a real long while so that may have changed since then

mitchelkuijpers13:11:41

you can also re-render by ident if you know what that means. And then it will only re-render what is bound to that ident

thheller13:11:02

ah ok. thats “new” then

mitchelkuijpers13:11:15

It has some nice tools to handle performance sensitive stuff

mitchelkuijpers13:11:30

But fulcro 2.0 forked om.next to fix some important stuff

thheller13:11:47

interesting

mitchelkuijpers13:11:04

Something todo with the "Dynamic queries" and to add some nice performance optimizations

mitchelkuijpers13:11:49

Hmm I am trying to use the :karma target but it gives me:

[:ci] Compiling ...
{:type :shadow.build.targets.karma/test-namespaces, :test-namespaces [atlas-crm.ui.components.entity-selector-test atlas-crm.ui.impl.routing.path-test atlas-crm.ui.impl.routing.linear-search-router-test], :entries [shadow.test.env atlas-crm.ui.components.entity-selector-test atlas-crm.ui.impl.routing.path-test atlas-crm.ui.impl.routing.linear-search-router-test shadow.test.karma]}
no goog/base.js
{}
ExceptionInfo: no goog/base.js
        clojure.core/ex-info (core.clj:4739)
        clojure.core/ex-info (core.clj:4739)
        shadow.build.output/closure-defines-and-base (output.clj:46)
        shadow.build.output/closure-defines-and-base (output.clj:41)
        shadow.build.targets.karma/flush-karma-test-file (karma.clj:72)
        shadow.build.targets.karma/flush-karma-test-file (karma.clj:67)
        shadow.build.targets.karma/flush (karma.clj:94)
        shadow.build.targets.karma/flush (karma.clj:91)
        shadow.build.targets.karma/process (karma.clj:109)
        shadow.build.targets.karma/process (karma.clj:99)
        clojure.lang.Var.invoke (Var.java:381)
        shadow.build/process-stage (build.clj:110)
        shadow.build/process-stage (build.clj:102)
        shadow.build/flush (build.clj:316)
        shadow.build/flush (build.clj:312)
        shadow.cljs.devtools.api/compile* (api.clj:189)
        shadow.cljs.devtools.api/compile* (api.clj:184)
        shadow.cljs.devtools.cli/do-build-command (cli.clj:40)
        shadow.cljs.devtools.cli/do-build-command (cli.clj:30)
        shadow.cljs.devtools.cli/do-build-commands/fn--61387/fn--61388 (cli.clj:68)
        clojure.core/binding-conveyor-fn/fn--5476 (core.clj:2022)
        java.util.concurrent.FutureTask.run (FutureTask.java:266)
        java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
        java.lang.Thread.run (Thread.java:748)

mitchelkuijpers13:11:12

Or am I running it wrong I run: bin/lein run -m shadow.cljs.devtools.cli compile ci

thheller13:11:06

why do you torture yourself. those commands takes ages to run. 😉

thheller13:11:34

no idea though.

mitchelkuijpers14:11:25

Haha what command should I run?

thheller14:11:47

shadow-cljs compile ci 😉

mitchelkuijpers14:11:58

Hehe but i have set leiningen to true

mitchelkuijpers14:11:16

So I don't see a difference 😛

mitchelkuijpers14:11:28

Lol it does work when I run it like that

thheller14:11:26

yeah but its still using lein to start so thats no fun 😉

thheller14:11:55

no idea about the error though

thheller14:11:04

it means that it didn’t find goog/base.js in the compile output

mitchelkuijpers14:11:13

No worries it does work with the shadow-cljs command

thheller14:11:54

what the heck, with :lein true it basically calls exactly the command you used

mitchelkuijpers14:11:41

No I get the same error

mitchelkuijpers14:11:20

:ci {:target :karma
               :output-to "resources/public/ci/karma.js"}
Is this config maybe wrong?

mitchelkuijpers14:11:33

I stole it from you 😛

thheller14:11:42

no thats correct

thheller14:11:23

ok, I get the same error now

thheller14:11:32

wonder where that came from

thheller14:11:50

nvm .. I’m just stupid

thheller14:11:45

didn’t you have :browser-test working with karma?

mitchelkuijpers14:11:47

Yeah I though I had

mitchelkuijpers14:11:11

But it doesn't seem to work

thheller14:11:41

I couldn’t get it to understand how closure wants to load files

thheller14:11:48

to the :karma target just always emits one file

mitchelkuijpers14:11:07

That is absolutely fine because this is only for Ci

thheller14:11:44

you probably also want to set the :ns-regexp

mitchelkuijpers14:11:50

No Karma breaks on:

mitchelkuijpers14:11:20

Really sorry to keep disturbing you

thheller14:11:23

oh hehe oops

thheller14:11:33

:js-options {:js-provider :shadow}

mitchelkuijpers14:11:51

I am still trying to get the other browser-test build working

thheller14:11:31

uhm that shouldn’t need that

thheller14:11:26

I’m confused now .. which doesn’t work :karma or :browser-test or both?

thheller14:11:42

:karma is basically a very simplified version that doesn’t do live reloading or a REPL

mitchelkuijpers14:11:19

Oh sorry, :karma does not work

mitchelkuijpers14:11:38

So I should just add js-options provider shadow?

thheller14:11:17

yes that should do it

mitchelkuijpers14:11:29

That works awesome!

mitchelkuijpers14:11:34

Today we are moving over completely to shadow-cljs with my team ^^

mitchelkuijpers14:11:20

I had one more idea btw, we are also using devcards do you think we could use :browser-test target to automatically include all files that end on -cards

thheller15:11:37

:ns-regexp "-(test|cards)$" should do it?

thheller15:11:49

I think devcards also needs the compiler options though

thheller15:11:27

but I don’t think you want to include devcards with your tests? those don’t do anything cljs.test related or do they?

mitchelkuijpers15:11:42

No but I just want something to automatically include all -card namespaces so I don't have to keep adding them to one file

thheller15:11:17

sounds like :target :devcards would be useful 😉

mitchelkuijpers15:11:58

I can make my own targets right?

mitchelkuijpers15:11:21

Hmm that might be cool to do

thheller15:11:18

that gets pretty low level though

thheller15:11:01

gets substantially more complicated when trying to include a REPL/live-reloading

mitchelkuijpers15:11:38

First I am struggling to get my :browser-test to work again, for some reason it does not seem to pick up my runner-ns

thheller15:11:02

oh doh .. that probably has the same issue I just fixed for :karma

mitchelkuijpers15:11:44

Oh lol then I could have still used the old way with using browser-test for karma

mitchelkuijpers15:11:55

That would explain why that broke

mitchelkuijpers15:11:28

Would you be interested if I setup a circleci config for shadow-cljs to start adding some tests?

thheller15:11:52

fixed in [email protected]. same issue indeed.

thheller15:11:22

circleci yes

thheller15:11:36

also I really can’t come up with proper ways to run tests

thheller15:11:38

thats the main issue

thheller15:11:56

how do you verify that the browser output was correct?

mitchelkuijpers15:11:20

Maybe a examples folder with for example a karma test, that one we could verify

mitchelkuijpers15:11:25

browser output is a bit harder

thheller15:11:57

well just verifying that the compile completed without an error would be enough to start

mitchelkuijpers15:11:02

There is the new chrome project where you can run chrome and do pretty nifty stuff

mitchelkuijpers15:11:25

I could just start with creating a circleci config and run some tests

thheller15:11:25

but often very subtle changes break in exciting ways

thheller15:11:33

and not always directly on startup

mitchelkuijpers15:11:41

that would be a good start at least

thheller15:11:35

yeah I need to look into this container business anyways

mitchelkuijpers15:11:57

If you create a issue in github I would be happy to help, we already have some cljs tests running on circleci

thheller15:11:38

I’ll look over the circleci docs, getting the config right is probably the hardest part

thheller15:11:26

ah the docker image was a problem @mhuebert ran into

thheller15:11:58

I think it wasn’t easy to find a docker image with java8, current node+npm

mitchelkuijpers15:11:11

I built one myself

mitchelkuijpers15:11:10

FROM circleci/clojure:lein-2.7.1
USER root
RUN curl -sL  | bash -
RUN apt-get install -y nodejs

# 
RUN wget -q -O -  | apt-key add -
RUN echo 'deb  stable main' >> /etc/apt/sources.list
RUN apt-get update && apt-get install --no-install-recommends -y google-chrome-stable

colindresj15:11:19

Sorry to hijack this thread, but I’m wondering if I can use lein checkouts (or something similar) with shadow

thheller15:11:42

are you using lein or shadow-cljs directly?

colindresj15:11:10

I’m using shadow-cljs

thheller15:11:50

you can add :source-paths ["src" "checkouts/the-thing/src"]

colindresj15:11:59

That’s what I thought

thheller15:11:09

but the checkout dependency still needs to be in :dependencies so its dependencies get picked up properly

colindresj15:11:17

Right, it is

thheller15:11:29

the source path will always be picked over the jar this way

colindresj15:11:40

Yeah that’s cool, I’d like that

colindresj15:11:13

Then, could I just change the source paths in the release config?

colindresj15:11:36

Ie, the release override

thheller15:11:43

no, changing the classpath is not supported

colindresj15:11:08

Alternatively, if I go through lein, checkouts should just work?

thheller16:11:15

@mitchelkuijpers the first lein test via circleci succeeded. not very meaningful since there are no tests but still 😉

thheller16:11:26

I’ll think about what to test and how to test it

mitchelkuijpers16:11:30

Nice small steps

mitchelkuijpers16:11:48

I would love to contribute some tests, it would help us a lot

thheller16:11:01

why would they use .yml thats such a horrible format 😛

thheller16:11:00

yeah I wanted proper tests for a while. accidental changes like the :karma/`:browser-test` breaking are not cool

thheller16:11:23

project getting to big to keep track of everything

mitchelkuijpers16:11:23

Yeah that is very understandable

mitchelkuijpers16:11:47

Yeah yml sucks but spacemacs protects me a bit from mixing spaces and tabs and such

thheller16:11:27

hmm can you start a process and then run other commands while that process is running?

thheller16:11:42

seems like you can background stuff

mitchelkuijpers16:11:09

You can also start multiple docker containers

thheller16:11:35

I just want to re-use the JVM and not start a new one for each command

thheller16:11:04

run shadow-cljs server in the background and then run a bunch of things against that server

thheller16:11:30

I’ll figure it out eventually

mitchelkuijpers16:11:58

Maybe just create a clj script which does multiple things? Is that an option

thheller16:11:24

to test the JVM side yes but I also want tests for the CLI script

thheller16:11:28

====>> Saving Cache
Error: Skipping cache - error checking storage: not supported

thheller16:11:46

meh .. many docs to read …