Fork me on GitHub
#shadow-cljs
<
2020-02-19
>
paul a01:02:41

i'm still having a hard time understanding what i need to do to define a macro and use it in my CLJS code at compile time. i read the blog post that i found, but i'm still getting the same Error in phase :compilation error, without a stacktrace.

paul a01:02:26

it feels like the closest i've gotten is an error along the lines of "proj/ns.clj" was found on the classpath. Should this be a .cljs file?

paul a01:02:41

i'm using the latest version of shadow-cljs and 1.10.x of CLJS.

paul a01:02:16

otherwise, my shadow-cljs compilation output is just:

shadow-cljs - connected to server
[:test] Compiling ...
------ ERROR -------------------------------------------------------------------
 File: /path/to/frontend_test.cljs
Error in phase :compilation

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Quest02:02:27

Has anyone had any luck getting private Maven repos to work in shadow-cljs? Latest I can find 2018 -- theller notes that it might work, but doesn't seem like anyone has figured out how. I'll just use deps.edn as a workaround, but curious if anyone did figure this out

Jacob Emcken22:11:25

It works with something along the lines in shadow-cljs.edn:

{:dependencies [[re-frame/re-frame "1.3.0"]
                [reagent/reagent "1.2.0"]
                [binaryage/devtools "1.0.7"]]

 :repositories {"my-repo" {:url      ""
                           :username #shadow/env "PRIVATE_MAVEN_USERNAME"
                           :password #shadow/env "PRIVATE_MAVEN_PASSWORD"}}

 :builds {:app {:target :browser
 ...
I would have loved being able to store the password using gpg though - like with lein :
:username [:gpg :env/PRIVATE_MAVEN_USERNAME]
:password [:gpg :env/PRIVATE_MAVEN_PASSWORD]
But no luck ๐Ÿ€ ๐Ÿ˜ข

๐Ÿ˜ข 1
justinbarclay20:02:30

Just an update, weeks ago (so long ago the thread is gone) I reported a problem I ran into when running shadow-cljs on windows 10 and WSL2. Specifically, WSL2 has a problem right now where it doesn't properly bind the ipv6 address`::1` correctly. What this meant was that I couldn't connect to a shadow-cljs dev server through services like Anyways, it took me until today to find find an excuse to dig into this during work hours. But I found out that Java uses ipv6 by default and converts ipv4 addresses to their ipv6 equivalents. Ex 0.0.0.0 -> ::1 So if you're like me and need to force shadow-cljs to use an ipv4 binding you can set it as an option in env vars export _JAVA_OPTIONS="-.preferIPv4Stack=true" https://superuser.com/questions/453298/how-to-force-java-to-use-ipv4-instead-ipv6

๐Ÿ‘ 8
thheller21:02:55

interesting. you can also set :jvm-opts ["-.preferIPv4Stack=true"] in shadow-cljs.edn (or deps.edn/project.clj)

justinbarclay21:02:01

Interesting isn't the term I'd use ๐Ÿ˜…. But that is a great alternative to using an env var, thanks for pointing that out ๐Ÿ™‚

thheller21:02:03

how is wsl2 otherwise? I'm hesitant to use it because of the "beta" windows and stuff

gerred21:02:13

i'm using wsl2 with vscode remote through wsl2 for fun

gerred21:02:14

it's fantastic.

gerred21:02:32

it almost competes with my mbp ๐Ÿ™‚

justinbarclay22:02:35

Yeah, I was hesitant on the beta problems as well. Which on the "fast ring", there have been several that have been several bugs that have bit me. However, the file system performance is leagues ahead of WSL1. The file system changes are particularly what has driven me to use WSL2, IE using git (and Magit) feel so much nicer on WSL2 than it ever did on WSL1. It's easy to dip your toes into WSL2 as well just fire up a second distro/image and set it to version two, no need to sacrifice your main dev environment.

justinbarclay22:02:26

I think you could also export your current WSL dev environment, import it under a new name and set it to WSL2. In effect, copying your current set-up and seeing how it performs under WSL2.

gerred22:02:57

need to figure out REBL with X410 though

thheller22:02:13

hmm I guess I'll wait ๐Ÿ˜›

thheller22:02:21

fs performance is pretty much the only thing I really care about

az22:02:11

Hi, Iโ€™m trying to create a tiny browser editor that users can create a snippet of clojure -> send to the compiler -> compile and then insert back to the browser where itโ€™s live and callable. Any thoughts on how to approach this?

lilactown22:02:15

I would use bootstrapped clojurescript, rather than sending to a remote compiler

az22:02:51

Thanks so much!

lilactown22:02:48

hereโ€™s a blog post that might help getting you started: https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html

dpsutton23:02:52

i made it private but its quite easy to get codemirror running with shadow to have a nice cljs editing experience

(ns editor.main
  (:require [reagent.core :as r]
            [clojure.string :as str]
            ["codemirror" :as codemirror]
            ["codemirror/mode/clojure/clojure"]
            ["codemirror/addon/edit/matchbrackets"]
            ["codemirror/addon/hint/show-hint"]
            [shadow.resource :as rc]
            [cljs.reader :as edn]))