Fork me on GitHub
#shadow-cljs
<
2018-08-01
>
haywood14:08:27

is there a way I can add a package to my classpath when using shadow and deps? I need to include cider/nrepl v0.18 without hardcoding it in deps.edn

lilactown14:08:08

how are you running shadow-cljs?

haywood14:08:07

through npm run

haywood14:08:53

I could create a cider alias and

haywood14:08:33

wondered if there was anything I could do globally, sort of like lein user profiles

lilactown14:08:29

I think you can set global aliases

lilactown14:08:32

it’s funny, I literally just started digging into deps.edn

thheller14:08:32

@haywood you can run shadow-cljs -d cider/cider-nrepl:version ...

haywood15:08:35

gotcha, thanks Thomas

lilactown15:08:36

https://clojure.org/reference/deps_and_cli#_directories also says that it will check $HOME/.clojure/deps.edn

lilactown15:08:03

so that’s probably what I’m going to do - setup a :cider alias

lilactown15:08:26

I was wondering what kind of support cider had for deps.edn already, I know it automatically injects the nrepl middleware and all that for leiningen

thheller15:08:27

it injects automatically for shadow-cljs too

thheller15:08:04

via -d which is also passed along to deps if you use :deps

lilactown15:08:53

I noticed a weird thing: when I launched and connected to my app via cider, and then manually started shadow-cljs, it wouldn’t allow me to connect to a cljs repl

lilactown15:08:58

which I kind of expected

lilactown15:08:43

but when I set up my dev profile to automatically start shadow-cljs, suddenly it was dropping me in shadow.user on startup and I could connect to CLJS REPLs 😄

lilactown15:08:53

(using lein)

lilactown15:08:20

I’m not unhappy about it, it was just surprising - I didn’t know what was going on. still don’t. but I’m guessing it’s some sort of CIDER + shadow-cljs magic

thheller15:08:06

I don't understand what you are saying

thheller15:08:25

"launched and connected to my app via cider" meaning your CLJ app?

lilactown15:08:45

using whatever magic cider-jack-in does

thheller15:08:03

yeah but if you start shadow-cljs separately then it will be a difference JVM

thheller15:08:10

and thus a completely different nrepl server

thheller15:08:40

so from your CLJ repl you can't talk to the CLJS repl since its elsewhere

thheller15:08:14

I dont know anything about cider so no idea how it handles multiple connections

lilactown15:08:18

previously, I was starting shadow-cljs by running cider-jack-in, then requireing the shadow server et. al., starting it and running a build

haywood15:08:59

a bit of FUD, but I think it's all working when adding the cider version to my global .clojure/deps.edn. I upgraded emacs and a bunch of stuff yesterday, and all of a sudden my .cljs files weren't connected to my cljs repl instance. when evaling I'd get something like cannot call stringp of nil, where nil was the cider cljs connection

lilactown15:08:38

and it was fixed by upping your nrepl version?

haywood15:08:03

there was a mismatch between cider versions in emacs and the project

haywood15:08:20

so pinning the cider version in the project to the one in emacs seems to have fixed it

lilactown15:08:16

for whatever reason I couldn’t switch into a CLJS REPL, I can’t remember why. but after setting up lein to automatically start the shadow server and my build, it started working ¯\(ツ)

thheller15:08:45

You can't switch to a CLJS REPL is CLJS is running in a different VM

thheller15:08:07

unless you open a second connection but AFAICT cider only expects to run over one connection

thheller15:08:22

so if its connected to your CLJ app via jack-in it won't find the CLJS one

lilactown15:08:57

I was starting shadow server in my jacked-in REPL though

lilactown15:08:40

I’m not reporting a bug or anything, it was just weird. I can try and reproduce it again if you are curious

thheller15:08:44

ah I thought "manually started shadow-cljs" means separately

lilactown15:08:07

yeah sorry. imprecise language

lilactown19:08:25

should this work?

;; deps.edn
:aliases
 {:dev {:extra-deps {thheller/shadow-cljs {:mvn/version "2.4.24"}
                     binaryage/devtools {:mvn/version "0.9.10"}}
        :extra-paths ["dev"]}}
clj -A:dev -m shadow.cljs.devtoools.cli release client

thheller19:08:56

apart from making a release build from a dev profile yes 😉

lilactown19:08:14

😛 just trying to get things to work!

lilactown19:08:33

i’m getting this error:

clj -A:dev -m shadow.cljs.devtoools.cli release client
2018-08-01 12:57:06.920:INFO::main: Logging initialized @11265ms
Exception in thread "main" java.io.FileNotFoundException: Could not locate shadow/cljs/devtoools/cli__
init.class or shadow/cljs/devtoools/cli.clj on classpath.                                            

lilactown19:08:02

if I run clj -A:dev and then (require '[shadow.cljs.devtools.cli]), it requires it just fine

thheller19:08:04

oh .. three o

lilactown19:08:57

thank you for putting up with me @thheller 😄

thheller19:08:49

I'm thinking about dropping the devtools package for the .api, .cli and .server namespace

thheller20:08:06

just shadow.cljs.cli would look so much better 😉

lilactown20:08:15

that would honestly be pretty nice

lilactown20:08:24

I type that namespace a lot 😆

thheller20:08:57

I think you can add :main-opts ["-m" "shadow.cljs.devtools.cli"] to the dev profile

thheller20:08:05

then its just clj -A:dev release client

thheller20:08:51

might be a different name though. not exactly sure.

lilactown20:08:17

nice. I’ll probably setup a :release alias now. just needed to sanity check my understanding of clj

lilactown20:08:03

actually this is dumb. this is going to to load my whole app classpath in order to execute shadow-cljs

lilactown20:08:28

:thinking_face: if I set :deps true in my shadow-cljs.edn, and give it an alias, will it also load all of the top-level :deps in deps.edn?

lilactown20:08:14

I assume so, which means if I want to use shadow-cljs using deps.edn I need to separate my clojure app deps from my client app deps and put them in separate aliases

dfcarpenter20:08:01

Does anyone know how I could use something like https://css-blocks.com/ with a reagent project running on shadow-cljs?

thheller20:08:22

@lilactown what exactly is your goal? if you are going to separate deps anyways why not keep CLJS deps in shadow-cljs.edn?

lilactown20:08:43

just messing around with deps.edn basically

lilactown20:08:10

trying to figure out how it works and how it fits into my workflow

thheller20:08:48

@dfcarpenter I use this myself https://github.com/thheller/shadow/wiki/shadow.markup but all the CSS-in-JS(ish) tools will be rather hard to integrate and are currently not supported

thheller20:08:04

mostly due to them being written in JS and expecting JS code

dfcarpenter20:08:39

@thheller Yeah, I was taking a closer look at it and it seems unfeasable. I might just resort to the standard separate SCSS tooling

thheller20:08:14

yeah I do have plans for something scss related so that should become easier hopefully

lilactown20:08:19

CSS-in-JS seems to work just fine for me

thheller20:08:38

yeah some work ok-ish but some require way too much compiler tuning

lilactown20:08:06

we use emotion.sh at work - it’s real good

lilactown20:08:23

I think it depends on if it’s a true “CSS-in-JS” or requires some compiling

thheller20:08:43

emotion.sh is one of those things that clearly shows how shit the JS syntax is

thheller20:08:53

same as graphql .. whats with all the strings ... 😛

lilactown21:08:18

it’s pretty great with EDN on top 😉

dfcarpenter21:08:59

@lilactown Do you have a gist or example somewhere I can look at?

👍 4
mattly21:08:40

I'd love to see this too

lilactown21:08:34

it's literally just: (css/edn {:font-size "14px" :&:hover {:color "blue"}})