Fork me on GitHub
#shadow-cljs
<
2018-10-14
>
mitchelkuijpers08:10:29

I am trying to use shadow-cljs for a Jira Addon, but when I load shadow in watch mode, there is apparantly alread a goog.string defined and some other stuff which clashes and make the whole dev mode of shadow fail. Anyone here know a trick to prevent that?

mitchelkuijpers08:10:52

I am getting all kind of errors like this ๐Ÿ˜ž

thheller08:10:08

@mitchelkuijpers hmm thats odd. is there already a goog version loaded on the page?

thheller08:10:32

just check goog in the console without loading the .js generated by shadow-cljs?

mitchelkuijpers08:10:08

@thheller Yes there is already something there

thheller09:10:26

hmm yeah thats a problem. there can only be one development build loaded at a time

thheller09:10:31

are there two different CLJS dev builds on the page?

thheller09:10:06

@mitchelkuijpers you can probably "fix" the warning by adding :prepend "goog.isProvided_ = function(name) { return false; }; to your base module

mitchelkuijpers11:10:59

Damn this is annoying it seems my code get's overwritten again.. ๐Ÿ˜ž

mitchelkuijpers11:10:18

Jira uses it for i18n and soy templates

mitchelkuijpers11:10:49

Is it possible to make google closure use another base instead of goog?

mitchelkuijpers11:10:51

Damn even during production they still have a goog ns.. So my only change for getting this to work would be to use another prefix I would think.

mitchelkuijpers11:10:49

Lol I currently fixed it by doing: goog = {};

mitchelkuijpers11:10:50

I did not get the :prepend option working for some reason during dev is it possible to set it with the :devtools option?

mitchelkuijpers11:10:33

But this of course makes fulcro-inspect stop working but I can live with that for now

thheller14:10:14

Jira uses unoptimized closure code?

thheller09:10:29

but it may break a bunch of stuff in other places if you just overwrite the already loaded code

kurt-o-sys10:10:07

I'm trying to use https://github.com/gregthebusker/react-confirm-bootstrap#readme in one of my shadow-cljs projects. So far, I've been able to add other components, but I seem to fail this one: The example in js:

var Confirm = require('react-confirm-bootstrap');

    var ConfirmAction = React.createClass({
        onConfirm() {
            // Preform your action.
        },

        render() {
            return (
                <Confirm
                    onConfirm={this.onConfirm}
                    body="Are you sure you want to delete this?"
                    confirmText="Confirm Delete"
                    title="Deleting Stuff">
                    <button>Delete Stuff</button>
                </Confirm>
            )
        },
    });
I'd expect something in cljs like this:
(ns ....
  (:require ["react-confirm-bootstrap" :default Confirm]))

      [:> Confirm {:body      "question"
                 :title     "whatever"
                 :onConfirm #(println "confirmed")}
       [:span "push me"]]
There are no errors or warnings, but when clicking 'push me', nothing happens...

kurt-o-sys10:10:24

Not sure if it's reagent or shadow-cljs related, actually ๐Ÿ˜›

thheller10:10:51

@kurt-o-sys probably ["react-confirm-bootstrap" :as Confirm] not :default

kurt-o-sys10:10:52

when I use :as: Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

kurt-o-sys10:10:54

not sure about that library... may be something weird in there.

mitchelkuijpers10:10:59

@thheller I think I am first going to check if I can turn the other one in release mode

thheller10:10:05

@kurt-o-sys maybe it just doesn't support a span?

kurt-o-sys10:10:07

๐Ÿ™‚

[:> Confirm {:onConfirm #(println "test")
                   :title "title"
                   :body "body"}
       [:button "test"]]
still nothing happens ๐Ÿ˜›

thheller10:10:19

it looks like it is cloning the children and adding props

thheller10:10:24

that won't work with reagent

kurt-o-sys10:10:34

oh, ok... so, no way to solve that one?

thheller10:10:40

(r/as-element [:button "test"]) maybe

kurt-o-sys10:10:45

ok, will try ๐Ÿ™‚

thheller10:10:21

or you can just leave out the button altogether and specify :buttonText

kurt-o-sys10:10:48

oh, right. may work fine - although I wanted just an icon there, but well...

thheller10:10:07

as-element should work

thheller10:10:30

not sure how reagent typically deals with this though

kurt-o-sys10:10:19

lol, you know what, it seems it does work, but I can't see the dialog that pops up... It's hidden behind the other stuff for some reason.

thheller10:10:21

hmm actually this should probably work in reagent

thheller10:10:44

ah yeah maybe just z-index ๐Ÿ˜›

kurt-o-sys10:10:04

trying, but nope. Not sure where it's gone.

kurt-o-sys10:10:54

ok... so it's the opacity that was set to 0, and fade didn't seem to work fine.

thheller14:10:16

@mitchelkuijpers its not just goog. any other namespace will have the same issues (eg. cljs.core). but no there is no way to adjust that

grounded_sage14:10:45

@thheller Iโ€™m giving a bit of hammock time to my static site generator and was just wondering where I can follow your thoughts and updates on building a โ€œGatsby likeโ€ system and the plugin system you mentioned some time ago that you will be adding for stuff like Sass. Would like to ensure what I end up building is in the right direction.

thheller14:10:03

@grounded_sage I can't give you any details since I don't have them myself yet

thheller14:10:23

the plugin system is actually already implemented so there is nothing left to do there

thheller14:10:57

but the gatsby like stuff will not be part of shadow-cljs itself

thheller14:10:05

it would just be using it like any other tool

thheller14:10:19

for this to work you basically need a full framework like gatsby etc

thheller14:10:34

so I'd probably build on top of fulcro myself

pauld17:10:27

I'm playing with fulcro shadow-cljs template (nodemo) and I'm working through the fulcro book. I've been able to adapt the template to follow along with the book, but I'm getting the following compiler error when trying to build the :cards build:

pauld17:10:50

The required namespace "cljsjs.marked" is not available, it was required by "devcards/util/markdown.cljs".

pauld17:10:06

I did an npm install marked but still get the same error.

pauld17:10:15

Hmmm, I wonder if I have an old version of devcards running since I can't see any dependency on cljsjs.marked in the devcards project.clj on github.

pauld18:10:09

Ok I see that devcards "0.2.6" does have this dependency and the shodow-cljs documentation says that the solution is to npm install marked but the error still occurs.

pauld18:10:02

Hmmm, I can't seem to npm install marked --save in such a way that will get devcard build to compile.

pauld18:10:21

I guess it needs a shim.

pauld18:10:34

Ok, made a shim for marked, but now I'm getting this errror: The required namespace "create-react-class" is not available, it was required by "devcards/core.cljs". but I thought the required shim for react already existed in shadow.

pauld18:10:56

I guess I'll make a shim for this too...

pauld18:10:59

Hmmm, puzzling - I see create-react-class in shadow-cljsjs project.

pauld18:10:56

oops probably forgot to install it.

pauld18:10:53

Ok, that was it - sorry for the noise.