This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-25
Channels
- # announcements (3)
- # beginners (64)
- # calva (1)
- # cider (78)
- # clj-kondo (4)
- # clojure-losangeles (1)
- # clojure-uk (5)
- # clojuredesign-podcast (1)
- # clojurescript (15)
- # cursive (2)
- # datomic (19)
- # docker (7)
- # fulcro (17)
- # graalvm (1)
- # hugsql (1)
- # instaparse (2)
- # jobs-discuss (25)
- # joker (2)
- # luminus (1)
- # off-topic (20)
- # pathom (1)
- # pedestal (2)
- # reagent (5)
- # shadow-cljs (83)
- # spacemacs (11)
- # vim (1)
- # vscode (13)
I generated a luminus project with shadow support, and I’m trying to start CIDER to connect to both CLJ and CLJS. I got this error:
1. Unhandled clojure.lang.ExceptionInfo missing instance {} runtime.clj: 11 shadow.cljs.devtools.server.runtime/get-instance! runtime.clj: 8 shadow.cljs.devtools.server.runtime/get-instance! api.clj: 125 shadow.cljs.devtools.api/worker-running?
It’s been a while, but I’ve had CIDER running with shadow successfully, so I’m sure it’s just a step I’ve missed.
can you tell me the template startup command you used @jmckitrick? I'll give it a shot and see what happens for me
@jmckitrick the reason is that that's not a valid shadow-cljs project. They put the shadow-cljs.edn map inside project.clj and then use a plugin to re-extract it. That seems like just a weird thing to do
just pull the :shadow-cljs
map out of project.clj and into a proper shadow-cljs.edn file and rip out that plugin. The downsides are that you'll have two config files. The upside is that all workflows and documentation will again apply to you. Seems like a steep price to pay to have a single file.
although it seems like this will side effect and write package.json and shadow-cljs.edn if you run the plugin once and then everything should work from there. just sounds like a bunch of headache for no real net gain
Ah, ok. Let’s try it….
@dpsutton Am I better off starting clj and cljs, and connecting from CIDER, or starting both from within CIDER itself?
Hmm. Still having the same issue. Well, I’m going to call it a night and pick up tomorrow afternoon.
until there's a shadow-cljs.edn file there's no hope of this working in CIDER. run lein shadow compile app
and it should make a package.json file and a shadow-cljs.edn file. it copies all the deps over it seems instead of just the ones you need so probably prune that down. at that point excise all that junk and just embrace the two systems
i don't think it matters about clj and cljs separately. they ultimately end up doing the same thing. the important thing is that a valid shadow-cljs.edn file exists and you've run npm install. let the plugin do that once and then you should be good to go
@jmckitrick you need to start the shadow-cljs instance if you run it embedded in a regular CLJ project/REPL. see https://shadow-cljs.github.io/docs/UsersGuide.html#embedded. not sure about the cider parts but the "missing instance" is caused when trying to call shadow-cljs API method without a running server instance in that JVM, which you need to start in embedded mode.
Hello, I have a problem with the karma target. Everything works fine in the repl, but when I run karma, I get the following exception
TypeError: s.replace is not a function
at Object.clojure$string$replace_all [as replace_all] (karma-test.js:49567:10)
at Object.clojure$string$replace [as replace] (karma-test.js:49626:23)
at Object.shadow$test$karma$indent [as indent] (karma-test.js:82522:23)
at shadow$test$karma$format_log (karma-test.js:82613:214)
at karma-test.js:29716:89
at karma-test.js:29717:3
at Object.sval (karma-test.js:23585:110)
at Object.cljs$core$ISeqable$_seq$arity$1 (karma-test.js:23736:10)
at Object.cljs$core$seq [as seq] (karma-test.js:16711:13)
at karma-test.js:29690:36
The code I added is the following.
(defn summarize-results' [spec-check]
(map (fn [x] (pprint/write (stest/abbrev-result x) :stream nil)) spec-check))
(defn check' [spec-check]
(is (nil? (-> spec-check first :failure)) (summarize-results' spec-check)))
Does anybody have a solution?
I already tried to add a "-test" postfix to the namespace the code is in.@philipp.siegmantel you are passing nil to something that expects a string
oh no wait you are not passing nil, you are passing something that is not a string when a string is expected
@thheller With message
you mean the second argument to is
? That makes sense. I copied the code from somewhere but summarize-results'
returns a seq not a string. Thank you for your help.
Would it make sense to create the app from luminus without shadow then add it manually?
I mean sure it probably helps you understand the setup better and you don't have lein-shadow (which I don't recommend anyways)
but you can just use the generated code run it once so it creates the shadow-cljs.edn
file and then remove lein-shadow entirely
This is what I get for not taking copious notes last time I worked on my project. I’m going to start from scratch shortly, but still using a luminus template. I’ll work my way through all the docs and hopefully get something working for my new project.
So you are saying move the shadow part of the project file into the standalone shadow edn file, right?
there is no shadow-cljs.edn
file nor package.json
file. Then i run lein shadow compile app
and the plugin generates those files from the project.clj file. At this point you have a normal shadow-cljs.edn file. At this point, remove that plugin and delete the shadow-cljs entry in the project.clj file and pretend like that stuff never happened
Ok, got it.
CIDER just starts up shadow normally and now will print out the startup commands so you can seem them. super straight forward and it should work on any standard shadow project. if you run into any issues open an issue on CIDER's github and i'll get it patched up for you
Ok, I’m getting there. When running CIDER and jack-in clj and cljs, I’m still seeing the ‘missing instance’ where @thheller says I need to be running shadow server. Does that sound right?
@jmckitrick it depends if you want to run shadow-cljs in embedded mode or not. if the instance is missing then you are likely connected to the luminus CLJ server. so you can either embed shadow-cljs into that or run it separate and connect to that instead.
Which one is best for getting full CIDER functionality in CLJ and CLJS?
Maybe @dpsutton would have insight on that
Is the beginner guide from the website still up to date? It's from the middle of 2017
It's linked on http://shadow-cljs.org as Beginner Guide
i'm having a different experience. i ran the plugin so i had a shadow-cljs.edn file. I deleted the shadow-cljs key from project.clj. I then ran cider-jack-in-cljs
from the shadow-cljs.edn file and the repl starts up.
;; Startup: /home/dan/projects/node/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.2 -d cider/cider-nrepl:0.23.0 server
;;
;; ClojureScript REPL type: shadow
;; ClojureScript REPL init form: (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch :app) (shadow/nrepl-select :app))
this is displayed in the repl buffer. its just running npx shadow-cljs and then shadow/watch :app, nrepl-select app
ok let me try that command, rather than clj and cljs
I assume you didn’t start anything else, in other terminals?
do them separately. you want to use lein for the backend and shadow-cljs for the frontend. it seems like jack in clj&cljs will use the same build tool for both
But I can still get CIDER to connect to both? I used to do that with the old figwheel.
So… cider-jack-in-cljs
seems to work… I selected shadow, then the build, and it’s offering to open a page in the browser that shows active http servers.
Now I’m going to try cider-jack-in-clj
It’s asking if I want to open a sibling session… I’m saying ‘yes’
It’s not letting me do both. Trying to connect to CLJ seems to silently fail.
The Beginner Guide starts with > Say you have a project:
├── README.md
├── assets
│ └── index.html
├── package.json
├── shadow-cljs.edn
├── src
│ └── app
│ ├── lib.cljs
│ └── main.cljs
└── yarn.lock
And doesn't really explain how you would have gotten there in the first place, do you generally start a new shadow-based CLJS project with an npm-init and install, then include shadow-cljs.edn
and plugin shadow at that point?@kamuela if you want that structure then you can start by cloning this repo https://github.com/minimal-xyz/minimal-shadow-cljs-browser
or you can follow the "official" quickstart and use npx create-cljs-project foobar
https://github.com/thheller/shadow-cljs#quick-start
Ah right, that quick start isn't mentioned at all on http://shadow-cljs.org
Probably from the perspective of knowing any possible way to work with a shadow project that beginner's guide is still relevant, but from a new perspective I'd definitely say the create-react-app route is the preferred onboarding
well the issue is that shadow-cljs is a build tool. I don't really want to write framework specific things like create-react-app
if you want that then its typically best to go with a template for the given framework you want
Guess it depends on the use case you have in your head. If the majority of people have pre-existing apps, and you're speaking to an experienced audience, then I can see the message being more like a look at how we can simplify your dev experience. But for someone like me who's brand new, it's nice to have a create-cljs-project
path to follow
All I'm really saying is that the quick-start is great and the main site pushing the beginner's guide threw me a bit
there are links to a presentation site with the slides, link to a repo that i walk you through building, and a link to the site running the example app
I used your presentation several times and it worked great, thanks! But I find myself making shadow-reagent apps so frequently that I decided to take advantage of the Github template feature: https://github.com/porkostomus/shadow-reagent
Is there some specific configuration I need to add to get shadow-cljs’ hot code reload to work with react-native?
yes, you need something like this https://github.com/thheller/reagent-react-native/blob/master/src/main/test/app.cljs#L33-L67