Fork me on GitHub
#shadow-cljs
<
2020-07-01
>
lgessler00:07:08

hi, i'm working with a cljc file project.cljc and shadow's complaining that a clojure-only keyword doesn't exist even though it's only referenced inside a #?(:clj ...) reader conditional. the offending code:

(ns glam.models.project
  (:require #?(:clj [glam.neo4j.project :as prj])
            #?(:clj [glam.neo4j.core :refer [one rename-id]])
            #?(:clj [com.wsscode.pathom.connect :as pc])))

#?(:clj
   (pc/defresolver all-projects [{:keys [neo4j current-user]} _]
     {::pc/output [:project/id]}
     (prj/get-document-ids neo4j)))
the error:
X Compilation failed.
------ ERROR -------------------------------------------------------------------
 File: [...]/glam/models/project.cljc:8:18
--------------------------------------------------------------------------------
   5 | 
   6 | #?(:clj
   7 |    (pc/defresolver all-projects [{:keys [neo4j current-user]} _]
   8 |      {::pc/output [:project/id]}
------------------------^-------------------------------------------------------
glam/models/project.cljc [line 8, col 18] Invalid keyword: ::pc/output.

--------------------------------------------------------------------------------
   9 |      (prj/get-document-ids neo4j)))
  10 | 
  11 | #?(:clj
  12 |    (pc/defresolver get-project [{:keys [neo4j]} {:project/keys [id]}]
--------------------------------------------------------------------------------

lgessler00:07:15

I think I must be missing something basic here... any suggestions?

lgessler00:07:04

if I expand the keyword and write :com.wsscode.pathom.connect/output the error of course goes away, but it'd be nice to avoid that

erik06:07:28

is there any up-to-date schema against which to validate my shadow-cljs.edn?

thheller07:07:09

@lgessler the pc alias needs to exist in CLJS as well. otherwise the code isn't readable. consider it a quirk in clojure and tools.reader since both have this issue. not something shadow-cljs can do anything about.

👍 3
lgessler15:07:06

got it, thank you!

thheller07:07:09

@eallik no. there are some specs for :builds but no overall schema

erik07:07:45

seems that it silently ignores bad input...

thheller07:07:45

yeah it won't complain about bad keys

Wilson Velez10:07:13

in shadow-cljs.edn what’s the difference between

:dev-http {8000 "resources/public"}
and
:devtools         {:http-root    "resources/public"
                   :http-port    8000}
?

thheller10:07:03

the second converts to :dev-http. use :dev-http. the :devtools http stuff is deprecated

bjrnt14:07:34

Hi, just started learning CLJS and I'm interested in trying this out: https://blog.fikesfarm.com/posts/2015-06-15-see-js-in-cljs-repl.html . I've tried setting :repl-verbose true in devtools in my shadow-cljs config file, but that didn't seem to do anything. Does anyone know if this is possible in combination with shadow-cljs?

Wilson Velez15:07:44

I think it shouldn’t be in the devtools , probably in the first level of the edn, but I haven’t test it before

:repl-options {:repl-verbose     true}

bjrnt15:07:28

Gave it a try, but didn't seem to work

thheller16:07:22

this is not supported by shadow-cljs

bjrnt18:07:37

Good to know, thanks!

Jakub Holý (HolyJak)19:07:05

Hi! Is there a way to reset the Inspect tab of the shadow server so that I can easily see new values that have been tap-ed to it? Thanks!

royalaid19:07:58

@thheller Hey quick question, is it easy for shadow to warn when an underscore is included as an actual clojure namespace symbol?

royalaid19:07:26

e.g. file name test_fixes.cljs and then a namespace name test_fixes

royalaid19:07:33

when it should be test-fixes

royalaid19:07:08

because I just started work at a new place and their project compiled fine under CLJS in a build script but shadow timed out with "par-timeouts"

royalaid19:07:24

fixing the underscore was the solution

thheller19:07:08

@holyjak not yet. planning to add it though.

❤️ 3
thheller19:07:15

@royalaid not even aware that was an issue. it should be warning already if the filename doesn't match the expected ns name but maybe it doesn't

royalaid19:07:27

Yeah I am not sure if it is a weird corner case or we hit a fluke but that definitely was the issue

thheller19:07:46

probably should open an issue otherwise I'll forget 😉

royalaid19:07:07

Let me know if that is enough to go on