Fork me on GitHub
#shadow-cljs
<
2018-09-25
>
thheller07:09:17

@lilactown I pushed 2.6.10 which should fix this now. its a weird race condition but its behind a lock now so it should be ok.

lilactown14:09:41

🙇 thank you!

thheller14:09:20

@clashthebunny please grep for devcards in your project. the file must come from somewhere

thheller14:09:52

there is nothing devcards related in shadow-cljs itself so I have no clue where things are coming from

ClashTheBunny14:09:42

Sorry, I forgot to add that part.

deps.edn:        devcards {:mvn/version "0.2.5"}
package.json:    "devcards": "shadow-cljs watch devcards",
public/cards.html:        <script>devcards.core_card.init();</script>
shadow-cljs.edn:                :devcards {:target :browser
shadow-cljs.edn:                            {:entries [devcards.core_card]}}
shadow-cljs.edn:                           :dev {:compiler-options {:devcards true}}
src/cljs/devcards/core_card.cljs:(ns devcards.core_card
src/cljs/devcards/core_card.cljs:   [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
src/cljs/devcards/core_card.cljs:   [devcards.core :as dc]
src/cljs/devcards/core_card.cljs:   [devcards.core-table :as table]
src/cljs/devcards/core_card.cljs:                                              :filter (if (not-empty (get-in @devcards.core_card/card-state [:card :image-data]))
src/cljs/devcards/core_table.cljs:(ns devcards.core-table
src/cljs/devcards/core_table.cljs:   [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
src/cljs/devcards/core_table.cljs:   [devcards.core :as dc]

ClashTheBunny14:09:03

And here is shadow-cljs.edn:

{:deps  true
 :nrepl {:port 8230}

 ; :cache-blockers #{deck-builder.macros}
 :open-file-command ["emacsclient" "-n" ["+%s:%s" :line :column] :file]

 :builds       {:browser
                {:target           :browser
                 :modules          {:base {:entries [deck-builder.core]}}
                 :output-dir       "public/js/compiled"
                 :asset-path       "/js/compiled"
                 :devtools         {:http-root    "public"
                                    :http-handler shadow.http.push-state/handle
                                    :http-port    8280
                                    :after-load   deck-builder.core/mount-root
                                    :preloads     [devtools.preload]}}

                :browser-test
                {:target           :browser-test
                 :test-dir         "out/browser-test"
                 ;; :compiler-options {:closure-defines  {re-frame.trace.trace-enabled? true}}
                 :devtools         {:http-root    "out/browser-test"
                                    :http-port    8290}}

                :karma-test
                {:target           :karma
                 :output-to        "out/karma/test.js"}

                :devcards {:target :browser
                           :output-dir "public/js/compiled"
                           :asset-path "/js/compiled"

                           :modules
                           {:main
                            {:entries [devcards.core_card]}}

                           :dev {:compiler-options {:devcards true}}
                                                    ;; :closure-defines {goog.DEBUG        true}}}
                                                    ;;                   day8.re-frame.tracing.trace-enabled? true}}}

                           :devtools
                           {:autoload true
                            ;; :before-load app.core/before-load
                            ;; :after-load app.core/after-load
                            ;; :http-handler shadow.http.push-state/handle
                            ;; :preloads     [day8.re-frame-10x.preload]
                            :http-root "public"
                            :http-port 3449}}}}

thheller14:09:08

so there it is? (ns devcards.core_card

thheller14:09:50

what is the full ns form? I fixed a bug in the ns form that maybe that ns form slipped through?

ClashTheBunny14:09:54

Seems to be, and it's in my path:

~/c/deck-builder ❯❯❯ cat deps.edn                                                                                                                                                                                                                                                                             master ✭ ✖ ✱ ◼
{:deps {re-frame {:mvn/version "0.10.5"}
        day8.re-frame/re-frame-10x {:mvn/version "0.3.3-react16"}
        binaryage/devtools {:mvn/version "0.9.10"}
        proto-repl {:mvn/version "0.3.1"}
        devcards {:mvn/version "0.2.5"}
        cider/cider-nrepl {:mvn/version "0.18.0"}
        refactor-nrepl {:mvn/version "2.4.0-SNAPSHOT"}
        secretary {:mvn/version "1.2.3"}
        venantius/accountant {:mvn/version "0.2.4"}
        org.clojure/data.csv {:mvn/version "0.1.4"}
        json-html {:mvn/version "0.4.4"}
        io.joshmiller/exif-processor {:mvn/version "0.2.0"}
        cljs-ajax {:mvn/version "0.7.4"}
        camel-snake-kebab {:mvn/version "0.4.0"}
        thheller/shadow-cljs {:mvn/version "2.6.10"}
        com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}

 :paths ["dev"
         "test/cljs"
         "src/clj"
         "src/cljs"]


 :aliases {:outdated {:extra-deps {olical/depot {:mvn/version "1.2.0"}}
                      :main-opts ["-m" "depot.outdated.main"]}}}

ClashTheBunny14:09:41

It's significant, sorry for the spam:

(ns devcards.core_card
  (:require-macros
   [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
   [cljs.test :as t :include-macros true :refer-macros [testing is]]
   [deck-builder.macros :as dm])
  (:require
   ["rmwc/Select" :refer (Select)]
   ["rmwc/Grid" :refer (Grid GridCell)]
   ["rmwc/Chip" :refer (Chip
                        ChipText
                        ChipIcon
                        ChipSet)]
   ["rmwc/Card" :refer (Card
                        CardPrimaryAction
                        CardMedia
                        CardAction
                        CardActions
                        CardActionButtons
                        CardActionIcons)]
   ["rmwc/Drawer" :refer (Drawer DrawerHeader DrawerContent)]
   ["rmwc/TextField" :refer (TextField TextFieldIcon TextFieldHelperText)]
   ["rmwc/Fab" :refer (Fab)]
   ["rmwc/Radio" :refer (Radio)]
   ["rmwc/Button" :refer (Button ButtonIcon)]
   ["rmwc/List" :refer (ListItem ListItemText)]
   ["rmwc/Toolbar" :refer (Toolbar
                           ToolbarRow
                           ToolbarSection
                           ToolbarTitle
                           ToolbarMenuIcon
                           ToolbarFixedAdjust
                           ToolbarIcon)]
   ["rmwc/Shape" :refer (ShapeContainer)]
   ["rmwc/Typography" :refer (Typography)]
   ["rmwc/Icon" :refer (Icon)]
   ["rmwc/Elevation" :refer (Elevation)]
   [json-html.core :refer (edn->html)]
   [reagent.core :as r]
   [ajax.core :as ajax]
   [ajax.protocols :as protocols]
   ;; [re-frame.core :as rf]
   ;; [re-frame.db :refer [app-db]]
   [devcards.core :as dc]
   [devcards.core-table :as table]
   [deck-builder.views :as v]
   [deck-builder.core :as c]
   [clojure.string :as str]))

thheller14:09:56

yep there it is

thheller14:09:02

[cljs.test :as t :include-macros true :refer-macros [testing is]]

thheller14:09:04

this is not valid

thheller14:09:23

although I wonder why you are not getting the correct error message to tell you this

ClashTheBunny14:09:57

I assume I just change it to the same as the devcards include.

thheller14:09:25

just put [cljs.test :as t :refer [testing is]] into your :require not :require-macros

thheller14:09:45

do me a favor and delete your .shadow-cljs/jar-manifests directory and then start the server again as you did above

thheller14:09:11

hmm no wait that won't change anything. the file isn't in a jar

thheller14:09:20

I'm confused why are not getting the correct error

thheller14:09:32

will try to reproduce

ClashTheBunny14:09:29

Much better error now:

[:devcards] Compiling ...
------ ERROR -------------------------------------------------------------------
 File: /tank/rmason/code/deck-builder/src/cljs/devcards/core_table.cljs:1:1
--------------------------------------------------------------------------------

   1 | (ns devcards.core-table
-------^------------------------------------------------------------------------
Invalid namespace declaration
-- Syntax error -------------------

  (... ... (:require-macros
            [devcards.core
             :as
             dc
             :refer
             [defcard defcard-rg deftest mkdn-pprint-str]]
            [cljs.test :as t :include-macros true :refer-macros [testing is]]
            [deck-builder.macros :as dm]) ...)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

has extra input

-- Relevant specs -------

:shadow.build.ns-form/ns-form:
  (clojure.spec.alpha/cat
   :ns
   '#{clojure.core/ns}
   :name
   clojure.core/simple-symbol?
   :docstring
   (clojure.spec.alpha/? clojure.core/string?)
   :meta
   (clojure.spec.alpha/? clojure.core/map?)
   :clauses
   :shadow.build.ns-form/ns-clauses)

-------------------------
Detected 1 error

--------------------------------------------------------------------------------
   2 |   (:require-macros
   3 |    [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
   4 |    [cljs.test :as t :include-macros true :refer-macros [testing is]]
   5 |    [deck-builder.macros :as dm])
--------------------------------------------------------------------------------

:error
[1:0]~shadow.user=>

thheller14:09:57

I don't understand why you didn't get that before though

ClashTheBunny14:09:48

And it's from the old problem. The ns form doesn't contain that anymore.

ClashTheBunny14:09:59

I moved cljs.test down below. It's not in the :require-macros section anymore:

1 (ns devcards.core_card
    2   (:require-macros
    3    [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
    4    [deck-builder.macros :as dm])
    5   (:require
    6    ["rmwc/Select" :refer (Select)]
    7    ["rmwc/Grid" :refer (Grid GridCell)]
    8    ["rmwc/Chip" :refer (Chip
    9                         ChipText
   10                         ChipIcon
   11                         ChipSet)]
   12    ["rmwc/Card" :refer (Card
   13                         CardPrimaryAction
   14                         CardMedia
   15                         CardAction
   16                         CardActions
   17                         CardActionButtons
   18                         CardActionIcons)]
   19    ["rmwc/Drawer" :refer (Drawer DrawerHeader DrawerContent)]
   20    ["rmwc/TextField" :refer (TextField TextFieldIcon TextFieldHelperText)]
   21    ["rmwc/Fab" :refer (Fab)]
   22    ["rmwc/Radio" :refer (Radio)]
   23    ["rmwc/Button" :refer (Button ButtonIcon)]
   24    ["rmwc/List" :refer (ListItem ListItemText)]
   25    ["rmwc/Toolbar" :refer (Toolbar
   26                            ToolbarRow
   27                            ToolbarSection
   28                            ToolbarTitle
   29                            ToolbarMenuIcon
   30                            ToolbarFixedAdjust
   31                            ToolbarIcon)]
   32    ["rmwc/Shape" :refer (ShapeContainer)]
   33    ["rmwc/Typography" :refer (Typography)]
   34    ["rmwc/Icon" :refer (Icon)]
   35    ["rmwc/Elevation" :refer (Elevation)]
   36    [json-html.core :refer (edn->html)]
   37    [reagent.core :as r]
   38    [ajax.core :as ajax]
   39    [ajax.protocols :as protocols]
   40    ;; [re-frame.core :as rf]
   41    ;; [re-frame.db :refer [app-db]]
   42    [devcards.core :as dc]
   43    [devcards.core-table :as table]
   44    [deck-builder.views :as v]
   45    [deck-builder.core :as c]
   46    [clojure.string :as str]
   47    [cljs.test :as t :refer [testing is]]))

ClashTheBunny14:09:36

Maybe a clean or something is now required?

ClashTheBunny14:09:19

The above output is from a (shadow/once :devcards)

thheller14:09:05

does it happen when you run shadow-cljs compile devcards? ie. kill all running shadow-cljs instances and start fresh?

thheller14:09:18

something weird seems to be going on on your machine

ClashTheBunny14:09:53

No, I figured it out. I had that refer-macros in core_table.cljs also. Just too similar a name to pick it out of the error message.

ClashTheBunny14:09:25

So, I got the right message when core_table.cljs was included in core_card.cljs but not when the error was in core_card.cljs which is what shadow-cljs.edn uses as it's entry point.

ClashTheBunny14:09:03

Yeah, it compiles now that I fixed both places.

[1:0]~shadow.user=>  (shadow/once :devcards)
[:devcards] Compiling ...
npm package "fbjs" expected version "[email protected]^1.0.0" but "2.5.7" is installed.
[:devcards] Build completed. (458 files, 28 compiled, 0 warnings, 163.04s)
:done
[1:0]~shadow.user=>

ClashTheBunny14:09:48

The full set of changes:

~/c/deck-builder ❯❯❯ git diff deps.edn shadow-cljs.edn src                                                                                                                                                                                                                                                  ⏎ master ✭ ✖ ✱ ◼
diff --git i/deps.edn w/deps.edn
index 10891a0..342b4ac 100644
--- i/deps.edn
+++ w/deps.edn
@@ -12,7 +12,7 @@
         io.joshmiller/exif-processor {:mvn/version "0.2.0"}
         cljs-ajax {:mvn/version "0.7.4"}
         camel-snake-kebab {:mvn/version "0.4.0"}
-        thheller/shadow-cljs {:mvn/version "2.5.1"}
+        thheller/shadow-cljs {:mvn/version "2.6.10"}
         com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}

  :paths ["dev"
diff --git i/src/cljs/devcards/core_card.cljs w/src/cljs/devcards/core_card.cljs
index 974362c..f322b04 100644
--- i/src/cljs/devcards/core_card.cljs
+++ w/src/cljs/devcards/core_card.cljs
@@ -1,7 +1,6 @@
 (ns devcards.core_card
   (:require-macros
    [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
-   [cljs.test :as t :include-macros true :refer-macros [testing is]]
    [deck-builder.macros :as dm])
   (:require
    ["rmwc/Select" :refer (Select)]
@@ -44,7 +43,8 @@
    [devcards.core-table :as table]
    [deck-builder.views :as v]
    [deck-builder.core :as c]
-   [clojure.string :as str]))
+   [clojure.string :as str]
+   [cljs.test :as t :refer [testing is]]))


 (enable-console-print!)
diff --git i/src/cljs/devcards/core_table.cljs w/src/cljs/devcards/core_table.cljs
index 494687b..6046ea4 100644
--- i/src/cljs/devcards/core_table.cljs
+++ w/src/cljs/devcards/core_table.cljs
@@ -1,7 +1,6 @@
 (ns devcards.core-table
   (:require-macros
    [devcards.core :as dc :refer [defcard defcard-rg deftest mkdn-pprint-str]]
-   [cljs.test :as t :include-macros true :refer-macros [testing is]]
    [deck-builder.macros :as dm])
   (:require
    ["rmwc/Select" :refer (Select)]
@@ -45,7 +44,8 @@
    [deck-builder.views :as v]
    [deck-builder.core :as c]
    [deck-builder.rules :as rls]
-   [clojure.string :as str]))
+   [clojure.string :as str]
+   [cljs.test :as t :refer [testing is]]))

 (def fake-player-data
   (apply merge

mattly22:09:40

I'm having an issue attempting to pull the graphiql npm module into a new library, [2018-09-25 15:49:47.466 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/graphql-language-service-interface/dist/GraphQLLanguageService.js", :requires [{:line 149, :column 30}]}

mattly22:09:04

the offending require:

mattly22:09:16

we're attempting to port to shadow-cljs from lein and wanted to use npm deps instead of clojars

mattly23:09:14

I'm not sure why it's doing this dynamic require

justinlee23:09:31

@mattly when you say you want to use “npm deps” do you mean the :npm-deps compiler flag or do you mean doing it the shadow-cljs way, where you install the library using npm or yarn and then require it directly?

mattly23:09:44

the latter

justinlee23:09:22

okay I just wanted to sanity check 🙂 thomas is surely asleep right now so you may have to wait for him, but one thing to try is to see if there are different distributions of the library you might be able to try.

justinlee23:09:45

i had trouble with one of these conditional requires in the pdf.js library and in the end i just stopped trying to bundle it with shadow