Fork me on GitHub
#shadow-cljs
<
2020-05-19
>
amar01:05:41

Hi. I'm trying to cache build dependencies for CI. Is there a way to specify another location for the local maven repo directory? Want to download and copy the entire .m2 directory into a container.

lilactown01:05:17

shadow creates a local build cache in .shadow-cljs/builds

amar01:05:00

thanks. i'll look into that

David Pham04:05:15

Anyone managed to get pretty printing working in the repl?

thheller08:05:29

@amar for maven deps you can set :maven {:local-repo "maven"} in either shadow-cljs.edn or ~/.shadow-cljs/config.edn

amar12:05:13

Thank-you 🙂

Eliraz10:05:39

hey, can you make `shadow-js` work with `lumo` and get rid of that `JVM` runtime?

fbielejec11:05:25

can I mimic this JS inheritance in ClojureScript?

class AccessController extends EventEmitter {

  static async create (db, options) {}

  static get type () {
    throw new Error('\'static get type ()\' needs to be defined in the inheriting class')
  }

  get type () { return this.constructor.type }

  async canAppend (entry, identityProvider) {}
}

class OtherController extends AccessController {

  static get type () { return 'othertype' }

  async canAppend(entry, identityProvider) {
    return true
  }
}

fbielejec11:05:38

Seems like in JS parlance static is a property of the object itself and th prototype properties (methods) can be overridden by setting the -.prototype.

fbielejec11:05:01

What I'm not sure is what the get is, also since AccessController extends EventEmitter what to do with the static properties of EventEmitter, do I just add them to the object literal?

fbielejec11:05:47

For the former I would do something the lines of:

(defn create-controller []
  (let [type "othertype"
        ac-obj #js {:create (fn [db options]
                              (js/Promise.resolve true))
                    :type type}]

    (set! (.-prototype ac-obj) (.-prototype AccessController))

    (set! (.. CustomAccessController -prototype -type)
          (fn [] type))

    (set! (.. CustomAccessController -prototype -canAppend)
          (fn [entry identity-provider]
            (js/Promise.resolve true)))

    ac-obj))

thheller14:05:15

answered on SO

👍 4
Chris McCormick06:05:17

can somebody share the link, i would like to read this. thanks!

folcon18:05:33

When using shadow-cljs with aws lambda, anyone got experience with correctly loading in node_modules? I’ve just been getting ImportModuleError. I’ve specifically been trying to use the pg npm module if that helps =)…

folcon19:05:06

Ok, nvm =)… Managed to get it working!

haywood19:05:33

I need to run a bit of my front end code, which includes some native JS react components on my clojure server. The code compiles fine, like I can run it as a stand-alone node script, do I need to figure out how to get it to run on something like GraalVM?

haywood19:05:55

compiling that code for the browser target and trying to run it with Nashorn didn’t work too well

haywood20:05:06

more or less looking to see if anyone else has done something similar

haywood20:05:29

perhaps there’s a shadow namespace I can import on the server, and have it load the compiled node-library and run it?

thheller20:05:06

there is not. nashorn as well as graal.js are rather limited JS engines and they don't support anything async

haywood20:05:37

damn, fwiw it’s just a bit of reagent code (of which wraps a native react component [:> Thing]) I’m I’m returning the string dom representation

haywood20:05:45

so close, but so far

Eric Ihli21:05:58

I'm having a problem with cider-eval-* . I know there's a lot of tools between running that emacs command and shadow-cljs, so maybe this isn't the right place to ask. But I've tracked it down to the nrepl responding with :repl-type of clj in its response map which then gets sent to cider-set-repl-type. I haven't been able to track how :repl-type gets set in the response. Does it have anything to do with shadow-cljs? I'm running npx shadow-cljs server, version 2.8.107 and cider-nrepl 0.25.0-alpha1. After launching npx shadow-cljs server I'm connecting on the default port of 9000 and then running (shadow/repl :main). Everything else works fine. I'm just not able to evaluate stuff from a buffer. The buffer is connected. I've verified that looking at sesman. I put a debug-on-entry on cider-set-repl-type and I see it change from cljs-pending type to clj type on the first attempt at eval. And if I manually set the type back to cljs with (cider-set-repl-type 'cljs, then on the next eval it tries to set it back to clj.

dpsutton21:05:14

if you set it to cljs and then eval something that is 100% cljs specific like (js/alert "hi") does it still kick it back to `clj?

Eric Ihli21:05:35

Well... shit... I switched to a different project and after manually changing it, it doesn't kick back to clj. It was in a project I was in earlier. I have to run out in 5 minutes so I'll see if I can repro when I get back.

Chris McCormick06:05:17
replied to a thread:answered on SO

can somebody share the link, i would like to read this. thanks!