This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-08
Channels
- # atlanta-clojurians (1)
- # beginners (116)
- # cider (70)
- # cljs-dev (11)
- # cljsrn (2)
- # clojure (218)
- # clojure-italy (7)
- # clojure-nl (14)
- # clojure-nlp (11)
- # clojure-spec (8)
- # clojure-uk (113)
- # clojurescript (86)
- # core-async (14)
- # cursive (24)
- # datomic (64)
- # duct (1)
- # emacs (3)
- # fulcro (20)
- # graphql (10)
- # jobs-rus (1)
- # london-clojurians (1)
- # luminus (1)
- # nyc (1)
- # off-topic (24)
- # onyx (1)
- # parinfer (1)
- # pedestal (14)
- # portkey (11)
- # re-frame (36)
- # reagent (9)
- # reitit (5)
- # ring (1)
- # shadow-cljs (197)
- # spacemacs (21)
- # specter (22)
- # sql (15)
- # tools-deps (5)
I'm haveing diffuculty connecting to a node based nrepl in cider
shadow.user> (shadow.cljs.devtools.api/watch :node)
:already-watching
shadow.user> (shadow.cljs.devtools.api/nrepl-select :node)
To quit, type: :cljs/quit
[:selected :node]
cljs.user> :a
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
cljs.user> (shadow.cljs.devtools.api/nrepl-select :node)
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
cljs.user>
here I already started a watch, also when I start server and manually ignite the watch, I get the same error message.@hlolli You've only started the build. You need to run the compiled code before you can evaluate cljs. Do $ node <your-build.js>
and then try evaling again.
amazing how fast things change, this is not how I did things in the old days (6-8 weeks ago) 😛
There is also a node-repl
command directly
@richiardiandrea of course, and that's how I did things in "the old days". That brain cell must have gotten erased on some berlin dancefloor.
Ah ah ok ;)
Yeah well I have to say that I prefer to work at the REPL too and have a shadow server
always on
yeh, for a website that I did recently, I got into this rythm, so the environment is the browser when it's opened, so this all makes sense.
@hlolli do you have completions in emacs + shadow? I think I see them intermittently
Cool thanks so I will try to check if my config is broken somehow
@kwladyka you probably just need to set the correct charset for your html <meta charset="utf-8">
Has anyone figured out how to get cider to run (shadow.cljs.devtools.api/repl :app)
after connecting?
I’m doing it manually now
@thheller how do you suggest including dependencies from private maven repos? Currently, I use lein and an s3 wagon to handle it, but hoping to move off of lein entirely
@colindresj I have never used a private maven repo so I don't know what setup is involved. if it just requires a :repository
entry you can do that in shadow-cljs.edn
just like lein
So something like:
:repositories
[["private-maven"
{:url "",
:snapshots false,
:sign-releases false,
:username :env/aws_access_key_id,
:password :env/aws_secret_access_key}]]
I get a shadow-cljs - dependency update failed - Vector arg to map conj must be a pair
with that
Oh ok
Yeah that’s for reading env variables
Ah cool didn’t know there was a reader tag for env vars with shadow
That’s sweet
Do I have to specify maven central and clojars in the repositories
map as well, or will shadow merge my map with defaults?
Cool thank you
question about new :exports
I have :exports-var
in my config
but I receive:
should contain keys: :exports, :exports-fn, :exports-sym
| key | spec |
|--------------+------|
| :exports | nil |
| :exports-fn | nil |
| :exports-sym | nil |
cli version: 2.3.36
I see the code has :exports-var
in there, so maybe it has not been deployed yet?
oh, no I think there is a bug, let me fix it
opened a PR
lol kk no problem 😉
does :output-to
in a :release
map?
ah yes it works
(ns material-ui.colors
(:require ["@material-ui/core/colors/deepPurple" :default deepPurple]
["@material-ui/core/colors/green" :default green]
["@material-ui/core/colors/blue" :default blue]))
(def deepPurple deepPurple)
(def green green)
(def blue blue)
Is there any way to do something like that?
In that case blue
is nil
when load from another namespace [material-ui.colors :as colors]
In the same namespace blue has value.(def deepPurple (js->clj mui-deepPurple)) - how compiler work? Will it be count in the browser or during compile?
but if js->clj in this situation will be optimised during build code it will be even better
It can be use to make a them for example:
(def theme (mui/create-mui-theme
(clj->js
{:palette {:primary {:main (aget colors/blue "A400")}
:secondary {:main (aget colors/deepPurple "500")}}
:overrides {:MuiAppBar {:root {
;:color "#00ff00"
;:background-color "white"
}}
:MuiButton {:root {:text-transform "none"}}}})))
but just copying the colors you want seems like a much better solution that dealing with those JS objects
probably you are right. This is the trap of using ready solutions. Start to turn off brain and use it 🙂
is there a way to add dev
folder to shadow
's classpath?
yep ok, sorry should have asked better...only in dev mode, not for :release
@thheller so my next q. would be, is there :aliases
in :release
I see it global only
so if it is an antipattern, maybe I can ask if there a better way to do the following 😄
I have the classic my-org.dev
namespace that uses the dotenv
library to load environment variables only when using the REPL
I don't wont to use it in :release
, so I added:
(when goog.DEBUG
(dev/load-env-vars!))
but I see that I have to require it...which indeed feels like an anti-pattern
it is kind of a :preload
yeah maybe I should do that
definitely
no, node server app
(defn main [config-path] (let [config (-> (fs/readFileSync config-path) str (reader/read-string))] ...))
I use env vars, I just need to load them from somewhere
yeah...i do something similar
we prefer env vars here 😄
but I see your point
yes I can, I just need to load them at runtime for REPL dev
I think :preloads
is fine
but the dev
folder will need to always be on the classpath
because I need them for running 😄
like DB connection and all that
at the moment it is :node-library
I am starting it with node-repl
or similar thing 😄
so would (shadow/node-repl {:node-env {"hello" "world"}})
help? (adding extra env vars to the node process so js/process.env.hello
works?
something like that would definitely help...but dotenv
is kind of nice because it automagically reads from .env
the variables
ah ah 😄
yeah I mean it's a JS thing right?
https://github.com/rentpath/clj-dotenv has a big fat [DEPRECATED]
?
probably shadow should have its own way of loading vars and I can use that instead, I can drop dotenv
actually. it could be env.edn
or something
my server has to connect to the db
at runtime in production, env vars will be set for it
at runtime in the repl, I need a way to load env vars
we don't like config files here for now 😄
don't ask me why 😉
yeah, so again the problem would be that that code should not leak to production
that is why normal clj/cljs you would use an clj
alias
oh cool
and i guess the namespace will be trimmed
if not required
if its not required anywhere (besides :preloads
) then it won't even be compiled in release
awesome
perfect sorry if it took so long 😉
https://code.thheller.com/blog/shadow-cljs/2018/02/08/problem-solved-source-paths.html
but that is not an issue in shadow-cljs since it won't just randomly include stuff just because its on the classpath
oh that's exactly what I need 😄
no random mess
Other q. 😄 I connected to a REPL with nrepl-select
in emacs, and I have a server in another window that compiles. Is there a way to stop receiving the compilation logs in the nrepl-select
-ed buffer?
No I am doing it manually
I have a watch in the terminal
Then I connected with a nrepl-select
The messages are visible in the buffer in emacs
So you are saying it is not expected?
I receive watch messages in my buffer
Watch was started in a terminal
Oh ok right so compilation warnings
Kk I was afk let me go and do it
user> (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch :init-store)(shadow/nrepl-select :init-store))
To quit, type: :cljs/quit
[:selected :init-store]
JS runtime disconnected.
JS runtime connected.
JS runtime disconnected.
JS runtime connected.
JS runtime disconnected.
JS runtime connected.
[:init-store] Compiling ...
[:init-store] Build failure:
------ ERROR -------------------------------------------------------------------
File: /home/arichiardi/git/laputa/lambda-cqrs/src/ep_cloud/init_store.cljs:23:3
--------------------------------------------------------------------------------
20 |
21 | This function is idempotent, you can call it multiple times."
22 | [ctx request]
23 | (let [azure-callback
---------^----------------------------------------------------------------------
Call to cljs.core/let did not conform to spec
-- Spec failed --------------------
([... ... (partial ... ...) ... ... ... ...] ... ...)
^^^^^^^
should satisfy
vector?
...
Oh crap lol
I was sure I did not use it :(
Sorry for the noise ;)
so is there a "watch test" mode in shadow by any chance?
I have a problem cause the tests are there but it does not seem to pick them up