Fork me on GitHub
#shadow-cljs
<
2018-02-20
>
wilkerlucio01:02:21

@thheller hello, about the RN integration, would you have an idea why it only works if I compile to the node_modules/shadow-cljs directory? when I try compiling on anything else (still inside node_modules) it fails and dont run

wilkerlucio02:02:18

@thheller not sure if you saw that, but it seems that shadow stops working if you delete some file that it did compiled before

wilkerlucio02:02:34

it's happening to me compiling npm-modules (for react native)

wilkerlucio02:02:54

when I delete a file it's starting throwing errors

thheller08:02:54

@wilkerlucio I ship a default .babelrc for shadow-cljs which tells babel to not do any processing

thheller08:02:16

if you have use a custom dir that file won't exist so that might be the reason?

thheller08:02:23

IIRC I added that file for RN, might have been CRA though

hlolli12:02:54

@wilkerlucio I believe I had that too yesterday. I dad yarn remove on a package. All I had to do was to restart shadow-cljs.

thheller12:02:17

there seems to be an issue with deleting files. the watch doesn't seem to detect it.

thheller12:02:31

also somehow adding new directories doesn't seem to register on windows

thheller12:02:43

I'm pretty sure that used to work on mac

wilkerlucio13:02:04

@hlolli yes, restarting fix it

martinklepsch14:02:31

Playing around with using shadow-cljs in a bigger, existing project and getting this:

The required JS dependency "react" is not available, it was required by "cljsjs/react.cljs".

mynomoto14:02:43

@martinklepsch I think you need to install using npm install react react-dom create-react-class. Shadow doesn't use the included js from cljsjs.

martinklepsch14:02:02

Got it. Wasn’t aware foreign-libs aren’t supported at all. Will need to see if that’s an issue.

thheller14:02:53

@martinklepsch since you can just use JS directly now there shouldn't be any need to use foreign-libs ever

thheller14:02:50

does anyone have a suggestion how to improve the > The required JS dependency "react" is not available, it was required by "cljsjs/react.cljs". error message?

justinlee15:02:40

You could just add “Install it using npm or yarn.” when I switched over to this project I couldn’t believe it was so easy after being burned by bizarre and unhelpful error messages coming from :npm-deps. 🙂

thheller14:02:18

I don't know what to write that would it more obvious about what you are supposed to do

martinklepsch14:02:50

@thheller Insert a short link that points to the appropriate docs?

thheller14:02:30

thats a good start yes

martinklepsch14:02:00

Is there a workaround for the case that I depend on a library which has something like this: https://github.com/funcool/cuerdas/blob/master/src/cuerdas/regexp.cljc#L33 ?

thheller14:02:29

yep. just npm install xregexp

thheller14:02:42

the shadow-cljsjs lib maps the foreign-libs back to their original npm packages and uses those directly

thheller14:02:03

since basically all cljsjs pacakges are just repackaged versions of the npm thing

thheller14:02:03

you can just create them in your project in case they are not available in shadow-cljsjs yet

martinklepsch14:02:39

Interesting, got it

martinklepsch14:02:31

Ok, next issue: 😄 (I’m on cljs 1.9.946)

646 |       #?(:cljs NaN :clj Double/NaN))))
----------------------^---------------------------------------------------------
 Use of undeclared Var cuerdas.core/NaN

thheller14:02:45

should be js/NaN?

martinklepsch14:02:07

That’s probably it. Guess I could have seen that myself 🙈

thheller14:02:51

hehe. those warnings easily get lost in other CLJS tools since it will only warn once when caching is enabled.

thheller14:02:01

shadow-cljs doesn't cache files with warnings so you'll always see them

martinklepsch14:02:27

I’m always under the impression that Figwheel doesn’t print any warnings/errors to the console 😏

justinlee15:02:40

You could just add “Install it using npm or yarn.” when I switched over to this project I couldn’t believe it was so easy after being burned by bizarre and unhelpful error messages coming from :npm-deps. 🙂

justinlee15:02:27

and actually it might be worth the reminder for new people since npm-deps ostensibly installs the packages for you

thheller15:02:01

will add a link to the msg later

eoliphant17:02:05

Hi i’m trying to get my lein project (gen’ed by luminus) converted to shadow here’s my lein dev config, not sure which other options need to be moved over. Also, trying to figure out how to map my dev,test, uberjar profiles over appropriately

:cljsbuild
                  {:builds
                   {:app
                    {:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
                     :figwheel {:on-jsload "fema-gmm.core/mount-components"}
                     :compiler
                     {:main "fema-gmm.app"
                      :asset-path "/js/out"
                      :output-to "target/cljsbuild/public/js/app.js"
                      :output-dir "target/cljsbuild/public/js/out"
                      :source-map true
                      :optimizations :none
                      :pretty-print true
                      ;:install-deps true
                      ;:npm-deps {:aws-amplify "0.2.6"
                      ;           :left-pad "1.1.3"}
                      :preloads [re-frisk.preload]}}}}
and what I have so far in my config file
;; shadow-cljs configuration
{:lein true
 ;:source-paths
 ;["src"]
 ;
 ;:dependencies
 ;[]

 :builds
 {:app {:target :browser
        :output-dir "target/cljsbuild/public/js"
        :asset-path "/js/out"
        :modules {:main {:entries [fema-gmm.app]}}}}}

thheller17:02:19

{:lein true
 :builds
 {:app {:target :browser
        :output-dir "target/cljsbuild/public/js"
        :asset-path "/js"
        :modules {:main {:entries [fema-gmm.app]}}
        :devtools {:after-load fema-gmm.core/mount-components
                   :preloads [re-frisk.preload]}}}}

thheller17:02:35

npm install aws-amplify

thheller17:02:37

shadow-cljs itself does not have profiles since builds already cover that

eoliphant17:02:20

that makes sense

thheller17:02:24

how do I use the luminus tempalte? just lein new luminus foo?

eoliphant17:02:40

and the profile

eoliphant17:02:07

like lein new luminus foo +reagent or +re-frame ,etc

thheller17:02:35

yuck so many things I hate about that template

eoliphant17:02:21

lol yeah, it was my onramp into clojure back in the day so have just kind of stuck with it, never got much into lein hacking as it generally just worked

eoliphant17:02:20

FYI, the lein section in the docs doesn’t appear to mention adding the [thheller/shadow-cljs "2.1.21"] dependency

thheller17:02:42

oh right. thx.

thheller17:02:55

do you have any particular reason why you want to run cljs from inside lein?

thheller17:02:05

or is it just "because"?

eoliphant17:02:36

it’s just because

eoliphant17:02:40

as i think aobut it

eoliphant17:02:45

not really necessary

thheller17:02:59

thats one of the most complex project.clj I have seen. scary that the template generates this mess.

eoliphant17:02:00

since i’m doing a lein run

eoliphant17:02:05

and a lein figwheel

eoliphant17:02:32

the shadow-cljs watch or whatever

eoliphant17:02:36

would be the equivalent

eoliphant17:02:42

of lein figwheel?

thheller17:02:54

pretty much yes

eoliphant17:02:29

i’d kind of thought that, the project.clj was nutty, I’ve spent a lot of my life lol, becoming proficient at maven, gradle,sbt, etc

eoliphant17:02:51

hadn’t really dug into lein, but now I’m thinking I might lol

eoliphant17:02:22

is the :after-load fema-gmm.core/mount-components setting up figwheel?

thheller17:02:41

we don't use figwheel

thheller17:02:00

but it does the equivalent of figwheel yes

eoliphant17:02:48

so for my dev workflow

eoliphant17:02:59

i’d conceivably just run shadow-cljs

eoliphant17:02:22

but for my builds, etc would run via lein I’m thinking

thheller17:02:49

lein for the server stuff

thheller17:02:54

shadow-cljs for cljs

thheller17:02:33

I'm still trying to trim the generated config

eoliphant17:02:44

right, at the moment, my app bundles the cljs and the lightweight server into the uberjar

thheller17:02:46

still haven't figured out what it does 😛

eoliphant17:02:58

yeah there’s a ton of stuff in there lol

thheller18:02:12

do you use the server stuff or do you just want cljs?

eoliphant18:02:49

yeah I use the server stuff as well

eoliphant18:02:56

running the build

eoliphant18:02:39

got some stactraces, etc. Pretty long would you like to see it here

thheller18:02:09

probably deps conflicts

eoliphant18:02:38

wasn’t happy about parsing some of the files, etc

thheller18:02:22

those are just warnings so not critical. no idea why you get those though

eoliphant18:02:09

but it complains at the end about the namepsace

thheller18:02:43

well if you import it anywhere thats a problem yes

thheller18:02:50

but we don't need it so don't import it

thheller18:02:52

doesn't like that since it is not a valid op

thheller18:02:02

guess my parser is too strict

thheller18:02:32

@eoliphant do you use the REPL to interact with figwheel?

eoliphant18:02:31

yes I do ffrom time to time

eoliphant18:02:53

actually that namespace thing is weird

eoliphant18:02:04

the project.clj config mentions it

eoliphant18:02:09

but it doens’t actualyl exist

eoliphant18:02:28

.core is the entry point for the app

thheller18:02:57

phew that was quite a bit of work 😛

thheller19:02:57

@eoliphant this is a rough rewrite of the template output https://github.com/thheller/lumifoo

thheller19:02:26

instead of lein run I'd recommend lein repl (user/start)

thheller19:02:01

starts the server and also the shadow-cljs app build

thheller19:02:11

I didn't do any of the test stuff

eoliphant20:02:13

ah ok lol, will check it out