This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-27
Channels
- # admin-announcements (1)
- # announcements (1)
- # babashka (16)
- # beginners (222)
- # bristol-clojurians (6)
- # calva (13)
- # cestmeetup (5)
- # cider (19)
- # cljs-dev (2)
- # cljsrn (4)
- # clojure (65)
- # clojure-europe (31)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-uk (33)
- # clojurescript (64)
- # community-development (5)
- # core-async (18)
- # cursive (15)
- # datomic (6)
- # devcards (1)
- # emacs (18)
- # figwheel-main (102)
- # fulcro (51)
- # graalvm (2)
- # helix (8)
- # instaparse (33)
- # jobs (8)
- # jobs-discuss (3)
- # leiningen (42)
- # off-topic (88)
- # pedestal (15)
- # re-frame (18)
- # reagent (26)
- # reitit (15)
- # rum (3)
- # shadow-cljs (119)
- # spacemacs (9)
- # sql (2)
- # tools-deps (7)
I have a really weird issue with a npm dependency vega-embed. I have defined it in https://github.com/pink-gorilla/gorilla-ui and now https://github.com/pink-gorilla/shiny-clj uses gorilla-ui. In gorilla-ui I have defined deps.cljs When I compile cljs with shadow-cljs in shiny-clj it wants additional npm dependencies (buffer and process). This dependencies are not needed in gorilla-ui. And I think they are only needed when compiling for target :node and not for target :browser.
base) [andreas@lggram shiny-clj]$ lein shadow-compile [:web] Compiling ... The required JS dependency "buffer" is not available, it was required by "node_modules/vega-loader/build/vega-loader.js". Search in: /home/andreas/Documents/gorilla/shiny-clj/node_modules You probably need to run: npm install buffer
Is there a way for testing an advanced compiled build? shadow-cljs release $test-build
fails
@adam678 fails how? you just run shadow-cljs release
for the build and then run the tests normally?
@hoertlehner you need to have shadow-cljs installed in your project. both buffer and process are polyfills packages that shadow-cljs will provide ...
will the npm dependency bring th full compiler of shadow? or des it only bting this fixes?
the npm package is mostly the for CLI stuff but also brings in some extra npm packages
@thheller I get:
--- cljs_test_display/core.cljs:411
illegal initialization of @define variable cljs_test_display.core.root_node_id
Yes, :browser-test indeed. So I was not doing anything wrong. I am surprised no one has noticed this before, testing advanced builds is pretty useful.
you can open an issue on the cljs-test-display
repo. should be an easy fix. I can do that later too
I have a custom test runner in my backlog too though. want something with a little more control over what it does on hot-reload so it doesn't always run all the tests
If it is an easy fix then I'll preferably someone else do it (well, you it seems 😄 ) since I have 0 knowledge about the codebase
Would you consider trying out chui? It works under advanced and should be a richer UI experience than cljs-test-display https://github.com/lambdaisland/chui
i'm getting the following error trying to cider-jack-in
to this project:
> Error building classpath. Manifest type not detected when finding deps for metosin/pohjavirta in coordinate #:local{:root "/System/Volumes/Data/home/arne/github/pohjavirta"}
ah, this is in chui-remote's deps. need to clone and compile the java classes for that?
hmmm right, you don't need chui-remote, and chui-remote no longer needs pohjavirta. Let me clean that up
Thanks Arne, this is perfect! I've already caught a nasty bug (r/w big ints with DataViews without type hinting)
If it turns out to be more involving, I can try to dive in the codebase and help, let me know. I opened an issue anyway https://github.com/bhauman/cljs-test-display/issues/7
Right!
I'll close mine 😉
(by the way, thanks for shadow-cljs, I have been using more and more lately after a sabbatical from CLJS, and I keep being impressed with how drastically it simplifies the workflow 🚀)
Well, you never know. I admit I became a bit paranoid regarding :advanced
hehe yeah not many people do that with :browser-test
I guess. first time this has come up. 🙂
Hi, I am trying to get puppeteer running with Shadow-cljs, by adapting this: https://gist.github.com/apeckham/ec1725b22642d9344e294c701de18fb2#file-puppeteer-cljs, so I got this code:
(-> (puppeteer/launch)
(.then (fn [browser]
(-> (.newPage browser)
(.then (fn [page]
(.goto page url #js{:waitUntil "networkidle2"})
(.screenshot page #js {:path "screenshot.png"})
(.close page)))))))
and I am getting these error warnings:
(node:5068) ExperimentalWarning: The fs.promises API is experimental
(node:5068) UnhandledPromiseRejectionWarning: Error: Could not find browser revision 756035. Run "npm install" or "yarn install" to download a browser binary.
at ChromeLauncher.launch (C:\Shared\orgpad\node_modules\puppeteer\lib\Launcher.js:59:23)
(node:5068) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5068) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
What is the Clojurescript idiomatic way of rewritting this:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('', {waitUntil: 'networkidle2'});
await page.pdf({path: 'hn.pdf', format: 'A4'});
await browser.close();
})();
@pavel.klavik have you address the errors that you pasted at all?
ya, I noticed the error there, got it working
thought at first that I am using promises in wrong way.
but I am still interested in idiomatic way of writing this in ClojureScript? core.async?
I got this in the end while loading the browser in a different thread:
(-> (.newPage @browser/browser)
(.then (fn [page]
(log/info "Openning page" url "...")
(-> (.goto page url #js{:waitUntil "networkidle2"})
(.then #(.screenshot page #js {:path "screenshot.png"}))
(.then #(do (log/info "Screenshot of " id "with token" token "generated.")
(.close page)))))))
How would you do flattening?(-> (puppeteer/launch)
(.then (fn [browser]
(.newPage browser)))
(.then (fn [page]
(.goto page url #js{:waitUntil "networkidle2"})
page))
(.then (fn [page]
(.screenshot page #js {:path "screenshot.png"})
page))
(.then (fn [page]
(.close page))))
I see, that looks better.
Hi, working on setting up shadow-cljs for our project, and I'm getting the following error when I attempt to generate the shadow build report. Everything else is working fine in terms of creating my release build. Any ideas?
I'm not sure if this is affecting anything, but we have a shared
project used between our different cljs apps in a monorepo, and so we're adding the source-path from here like ../shared/src/client
and then getting a lot of these warnings as well
[2020-05-27 12:32:24.902 - INFO] filename violation for ns shcl.core.c.dropzone, got: client/shcl/core/c/dropzone.cljs expected: shcl/core/c/dropzone.cljs (or .cljc)
These didn't seem to affect anything with the release build though.No, just these
"src/server"
"src/client"
"src/shared"
"../shared/src/app"
"../shared/src/server"
"../shared/src/client"
"../shared/src/shared"
We use the same ns convention / folder structure inside src/client
and it doesn't have any issues with that.
yeah but somehow client/shcl/core/c/dropzone.cljs
exists on the classpath. try (
from a clojure REPL. shadow-cljs clj-repl
or so
#object[.URL 0x5a069486 "jar:file:/Users/alex.porter/.m2/repository/fullcontact/redboat.shared/latest/redboat.shared-latest.jar!/client/shcl/core/c/dropzone.cljs"]
ok, yeah, I'll get that figured out
Thinking this is maybe the cause of the build report issue as well?
I doubt it. the error is deep in the closure compiler code so I'm not exactly sure what it means
ok, no worries. Thanks for the help.
failed to run function: shadow.cljs.build-report/-main
{:tag :shadow.cljs.devtools.cli/clj-run, :main-sym shadow.cljs.build-report/-main}
ExceptionInfo: failed to run function: shadow.cljs.build-report/-main
shadow.cljs.devtools.cli/do-clj-run (cli.clj:112)
shadow.cljs.devtools.cli/do-clj-run (cli.clj:67)
shadow.cljs.devtools.cli/blocking-action (cli.clj:128)
shadow.cljs.devtools.cli/blocking-action (cli.clj:118)
shadow.cljs.devtools.cli/main (cli.clj:179)
shadow.cljs.devtools.cli/main (cli.clj:134)
clojure.core/apply (core.clj:669)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli/-main (cli.clj:221)
shadow.cljs.devtools.cli/-main (cli.clj:219)
clojure.lang.Var.invoke (Var.java:399)
user/eval152 (form-init209812503692384868.clj:1)
user/eval152 (form-init209812503692384868.clj:1)
clojure.lang.Compiler.eval (Compiler.java:7177)
clojure.lang.Compiler.eval (Compiler.java:7167)
clojure.lang.Compiler.load (Compiler.java:7636)
clojure.lang.Compiler.loadFile (Compiler.java:7574)
clojure.main/load-script (main.clj:475)
clojure.main/init-opt (main.clj:477)
clojure.main/init-opt (main.clj:477)
clojure.main/initialize (main.clj:508)
clojure.main/null-opt (main.clj:542)
clojure.main/null-opt (main.clj:539)
clojure.main/main (main.clj:664)
clojure.main/main (main.clj:616)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
Caused by:
NullPointerException:
com.google.debugging.sourcemap.SourceMapObjectParser.parse (SourceMapObjectParser.java:44)
com.google.debugging.sourcemap.SourceMapConsumerV3.parse (SourceMapConsumerV3.java:68)
com.google.javascript.jscomp.SourceMapInput.getSourceMap (SourceMapInput.java:58)
com.google.javascript.jscomp.Compiler.addSourceMapSourceFiles (Compiler.java:2828)
com.google.javascript.jscomp.Compiler.initBasedOnOptions (Compiler.java:553)
com.google.javascript.jscomp.Compiler.initModules (Compiler.java:533)
com.google.javascript.jscomp.Compiler.compileModules (Compiler.java:729)
sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke (Method.java:498)
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:167)
clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:102)
shadow.build.closure/compile-js-modules (closure.clj:1008)
shadow.build.closure/compile-js-modules (closure.clj:997)
shadow.build.closure/optimize/fn--3682 (closure.clj:1195)
shadow.build.closure/optimize (closure.clj:1181)
shadow.build.closure/optimize (closure.clj:1172)
shadow.build.api/optimize (api.clj:267)
shadow.build.api/optimize (api.clj:261)
shadow.build/optimize (build.clj:419)
shadow.build/optimize (build.clj:411)
shadow.cljs.build-report/generate/body-fn--8571--auto----9378 (build_report.clj:219)
shadow.cljs.build-report/generate (build_report.clj:195)
shadow.cljs.build-report/generate (build_report.clj:190)
shadow.cljs.build-report/-main (build_report.clj:261)
shadow.cljs.build-report/-main (build_report.clj:260)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli/do-clj-run/body-fn--8571--auto----9150 (cli.clj:110)
shadow.cljs.devtools.cli/do-clj-run (cli.clj:109)
shadow.cljs.devtools.cli/do-clj-run (cli.clj:67)
shadow.cljs.devtools.cli/blocking-action (cli.clj:128)
shadow.cljs.devtools.cli/blocking-action (cli.clj:118)
shadow.cljs.devtools.cli/main (cli.clj:179)
shadow.cljs.devtools.cli/main (cli.clj:134)
clojure.core/apply (core.clj:669)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli/-main (cli.clj:221)
shadow.cljs.devtools.cli/-main (cli.clj:219)
clojure.lang.Var.invoke (Var.java:399)
user/eval152 (form-init209812503692384868.clj:1)
user/eval152 (form-init209812503692384868.clj:1)
clojure.lang.Compiler.eval (Compiler.java:7177)
clojure.lang.Compiler.eval (Compiler.java:7167)
clojure.lang.Compiler.load (Compiler.java:7636)
clojure.lang.Compiler.loadFile (Compiler.java:7574)
clojure.main/load-script (main.clj:475)
clojure.main/init-opt (main.clj:477)
clojure.main/init-opt (main.clj:477)
clojure.main/initialize (main.clj:508)
clojure.main/null-opt (main.clj:542)
clojure.main/null-opt (main.clj:539)
clojure.main/main (main.clj:664)
clojure.main/main (main.clj:616)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
@ajporter2011 is this for a :browser
build? build-report currently has issues with other targets?
Here's my :shadow-cljs
config in my project.clj
{:nrepl {:port 8777}
:builds {:app {:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:modules {:app {:init-fn plcl.main/init
:preloads [devtools.preload
day8.re-frame-10x.preload]}}
:dev {:compiler-options {:closure-defines
{goog.DEBUG true
re-frame.trace.trace-enabled? true
day8.re-frame.tracing.trace-enabled? true}}}
:release {:compiler-options
{:infer-externs :auto
:optimizations :advanced}
:build-options
{:ns-aliases
{day8.re-frame.tracing day8.re-frame.tracing-stubs}}}
:devtools {:http-root "resources/public"
:http-port 9222}}}}
Only the build report
It is
Hey all, wondering if someone has some advice. I want to pass an api key as a command line argument. I understand that you can use --config-merge
to pass command line arguments to the shadow-cljs.edn file. My question is, how do I then use that argument in my application? Thanks in advance for your help
then don't make it part of the build at all. this is runtime configuration. I really need to write the blog post about this ... 😛
Ah okay, thanks for explaining the options 🙂 I was hoping to pass the api key to a docker container at runtime, using a secret in my CI pipeline, rather than having stored in the html file. Do you tend to inject it into the html file? echo >> … etc?
I typically have a server that generates my HTML but if you just have a static file you can use a placeholder and replace that via some command line tool
Yeah, I get your point about it not being a secret when it gets to the client, I’ll have at node target as well and consider options. Thanks for your time and pointing me in the right direction 🙂 I listened to the podcast you were on with @jacek.schae, it’s an excellent tool you’ve built!
If I was using shadow-cljs for a fulcro project, and I'd like to use a local version of fulcro (to change and test some fulcro code), how would I do that? Thanks!
move all your dependencies to deps.edn
and configure shadow-cljs to use it. see the user-guide
Would you consider trying out chui? It works under advanced and should be a richer UI experience than cljs-test-display https://github.com/lambdaisland/chui