Fork me on GitHub
#shadow-cljs
<
2018-07-03
>
steveb8n01:07:08

@urbanslug I had to create a new image in the end. it’s here https://hub.docker.com/r/steveb8n/cljs-node-aws-cli/

urbanslug05:07:41

@steveb8n hmm I always thought the Dockerfile was visible by default

steveb8n05:07:01

Apparently only when you do an"automated build"

steveb8n05:07:11

I just pushed from local

steveb8n05:07:39

I just pasted the dockerfile into the description so you can see it

πŸ‘ 4
grounded_sage05:07:11

where does :ssl {} go in my config?

grounded_sage05:07:51

I'm trying to satisfy all the lighthouse audits locally

grounded_sage06:07:12

oh nvm I have to do the self signed stuff all g

thedavidmeister07:07:54

is it normal that if i run shadow-cljs watch npm in one tab

thedavidmeister07:07:04

and shadow-cljs node-repl npm in another

thedavidmeister07:07:23

that i have to quit the repl and restart it to see code changes?

thedavidmeister07:07:48

and that when i restart i don't have any repl history saved?

thheller07:07:58

@thedavidmeister node-repl is completely standalone and does not take a build argument. you probably want shadow-cljs cljs-repl npm. if you want REPL history and stuff use rlwrap shadow-cljs cljs-repl npm. didn't have time to add that yet.

thedavidmeister07:07:20

let me try that...

thedavidmeister08:07:21

so i see this now

thedavidmeister08:07:23

No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.

thedavidmeister08:07:32

with the rlwrap command

thheller08:07:48

that message has been tuned like 100 times. I do not know how to make it any clearer.

thheller08:07:02

you need to launch whatever target :npm used and load your JS

thheller08:07:37

if the :npm target is :npm-module than REPL is a lot harder to do

thedavidmeister08:07:10

ok, what target would let me test things out more easily?

thheller08:07:24

which things?

thedavidmeister08:07:41

hitting an API from cljs

thedavidmeister08:07:54

from a repl, with code reloading as i make changes

thheller08:07:12

:browser is generally the easiest since you get easy access to browser devtools

thheller08:07:11

:node-script if you need node stuff

thheller08:07:25

the node-repl doesn't do live reload since thats not usually how you work with a REPL

thedavidmeister08:07:32

i did try browser, but code reload did not work and it wouldn't let me make network calls

thheller08:07:00

did you open the file directly instead of over http?

thedavidmeister08:07:11

what do you mean live reload isn't usually how i work with REPL?

thheller08:07:35

in a REPL env you typically control when the code is reloaded manually

thheller08:07:49

CLJ REPL for example doesn't do any live reloading automatically

thedavidmeister08:07:08

oh, the boot one has an option to

thheller08:07:09

its left to tools like tools.namespace or manually calling (require 'foo.bar :reload) or load-file

thedavidmeister08:07:13

so i'm used to that in clj

thheller08:07:56

in the quickstart-browser repo just run npx shadow-cljs watch app and open

thheller08:07:14

that does live reload and has a REPL via rlwrap npx shadow-cljs cljs-repl app

thedavidmeister08:07:15

kk, i'll try that out

thedavidmeister08:07:02

ah ok this is working, thanks!

thedavidmeister08:07:12

i'll try to port it to what i was doing and see where i went wrong

thedavidmeister08:07:15

somewhat related question

thedavidmeister08:07:39

is there a way to only require something from npm when i'm not running it in a browser?

lsnape10:07:02

Hiya, I'm getting this intermittent failure when running my karma tests after a shadow-cljs watch ci. The karma error is a bit obscure, but I can trace it down to this line: https://github.com/thheller/shadow-cljs/blob/5df9969639030128586afd2968db2ea5f704b4b0/src/main/shadow/test/karma.cljs#L17 Error message:

{
    "message": "Uncaught TypeError: s.replace is not a function\nat ci.js:138901:1\n\nTypeError: s.replace is not a function\n    at Object.clojure$string$replace_all [as replace_all] (ci.js:53046:10)\n    at Object.clojure$string$replace [as replace] (ci.js:53105:23)\n    at Object.shadow$test$karma$indent [as indent] (ci.js:358372:23)\n    at shadow$test$karma$format_log (ci.js:358467:304)\n    at ci.js:32847:89\n    at cljs.core.map.cljs$core$IFn$_invoke$arity$2 (ci.js:32848:3)\n    at cljs.core.LazySeq.sval (ci.js:26691:109)\n    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (ci.js:26842:10)\n    at Object.cljs$core$seq [as seq] (ci.js:19645:13)\n    at cljs.core.map.cljs$core$IFn$_invoke$arity$2 (ci.js:32821:36)",
    "str": "Uncaught TypeError: s.replace is not a function\nat ci.js:138901:1\n\nTypeError: s.replace is not a function\n    at Object.clojure$string$replace_all [as replace_all] (ci.js:53046:10)\n    at Object.clojure$string$replace [as replace] (ci.js:53105:23)\n    at Object.shadow$test$karma$indent [as indent] (ci.js:358372:23)\n    at shadow$test$karma$format_log (ci.js:358467:304)\n    at ci.js:32847:89\n    at cljs.core.map.cljs$core$IFn$_invoke$arity$2 (ci.js:32848:3)\n    at cljs.core.LazySeq.sval (ci.js:26691:109)\n    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (ci.js:26842:10)\n    at Object.cljs$core$seq [as seq] (ci.js:19645:13)\n    at cljs.core.map.cljs$core$IFn$_invoke$arity$2 (ci.js:32821:36)"
  }

lsnape10:07:19

That namespace is requiring clojure.string but isn't using the alias s. I'd be surprised if that was the problem though!

lsnape10:07:37

So the problem is a non-string message in the is, which is invoked when the test fails. Is the correct fix to just call str on a s? https://github.com/thheller/shadow-cljs/blob/5df9969639030128586afd2968db2ea5f704b4b0/src/main/shadow/test/karma.cljs#L15

thheller10:07:48

I copied that code from some library

thheller10:07:52

no idea what it actually does πŸ˜›

thheller10:07:05

but yeah looks like a non-string being passed into the fn

thheller10:07:38

wonder which assertion generates a non-string though?

thheller10:07:56

@lsnape you can create a copy of that file in your project and test arround

lsnape10:07:33

Oh it was one of the assertions in my tests.

lsnape10:07:41

Ha that'll learn ya πŸ˜‚

lsnape10:07:21

I was passing a map as the 2nd pos arg to is

lilactown20:07:18

is there some incantation I can do to get a node_module that exports only a .jsx file to work?

thheller20:07:42

not currently no

thheller20:07:07

well I guess you can use babel to transform it so there is a js file

lilactown20:07:58

so I would need to do a transform into like an externs dir and add that to my source paths?

thheller20:07:13

npx babel node_modules/that-module should be enough

thheller20:07:11

or use another npm package that doesn't use jsx. or complain that they only ship non-standard JSX