This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-02
Channels
- # announcements (14)
- # beginners (133)
- # cider (27)
- # cljs-dev (7)
- # cljsjs (13)
- # clojure (105)
- # clojure-dev (58)
- # clojure-italy (1)
- # clojure-nl (17)
- # clojure-russia (33)
- # clojure-spec (5)
- # clojure-uk (154)
- # clojured (1)
- # clojurescript (35)
- # cloverage (4)
- # cursive (35)
- # datomic (58)
- # duct (8)
- # editors (9)
- # emacs (15)
- # events (1)
- # figwheel (47)
- # figwheel-main (132)
- # hyperfiddle (5)
- # immutant (29)
- # instaparse (21)
- # luminus (3)
- # off-topic (5)
- # onyx (5)
- # overtone (5)
- # pedestal (8)
- # re-frame (7)
- # reagent (6)
- # reitit (3)
- # schema (2)
- # shadow-cljs (178)
- # spacemacs (49)
- # specter (2)
- # sql (1)
- # tools-deps (110)
š we really like it. been using it at work for about 5 months since the start of our project
@thheller Draw a picture. A picture says more than 1000 words. Or even better: upload an interpretive dance! Iām sure that says more than 20000 words.
Iām having trouble with release
building of a node library target. Getting
TypeError: a.Ga is not a function
extensionHostProcess.js:452
at Object.ih [as greetings_activationGreetings] (/Users/pez/.vscode/extensions/cospaia.clojure4vscode-1.3.33-TS-CLJS/out/lib/calva.js:276:520)
at activate (/Users/pez/.vscode/extensions/cospaia.clojure4vscode-1.3.33-TS-CLJS/calva/extension.ts:114:14)
I donāt get this if I build with compile
. What is the most obvious thing I could have missed? I have release building working in another vscode extension project (Calva Formatter) and am trying to use the same build pipeline in Calvaā¦https://code.thheller.com/blog/shadow-cljs/2017/10/15/externs-the-bane-of-every-release-build.html
@pez if you prefer not to deal with externs you can set :compiler-options {:optimizations :simple}
although I do recommend trying :compiler-options {:infer-externs :auto}
first
Thanks! (I was looking for where functions in my library were not properly exportedā¦ š ) I could get past the first hurdle by adding a type hint. Now will see if :infer-externs
does the trick. I should get less of these problems once I have factored the code better between what I do in TypeScript code and what I do in ClojureScript code.
@thheller: I will be moving Calva development to implementing more and more of the ābusiness rulesā/logic in CLJS and do the integration in VSCode in TypeScript. (Building the whole extension using shadow-cljs worked, but meant that I couldnāt use the debugger for all that JS code that still remains to be ported and I canāt afford the slowdown in development that that brought.) Anyway, so I will build the logic as a node library using shadow-cljs. Thing is the library API will get pretty āfatā/have many functions. Since namespacing is dropped, I am now trying with prefixing the function names. Is there a cleaner way, that you can see?
you can use :npm-module
so the TS part can import namespace separately when required
The code will be deployed anywhere the Calva extension is installed, so I will have to learn some about building npm modules, I guess. But the name spacing it allows is so much nicer than what I have now, so Iām happy to investigate.
its basically just a directory you need. it doesn't have to be entirely separate package
I'm trying out Cursive. And I decided to also try out :node-script
at the same time, since I just want to play around with ClojureScript and Cursive's REPL integration. I've written a minimal shadow-cljs.edn
, ran npx shadow-cljs pom
, left a running npx shadow-cljs server
in a terminal, imported pom.xml
into Cursive, connected to the REPL, I am able to do (shadow/watch :the-id)
and and then (shadow/nrepl-select :the-id)
- Cursive recognizes it at that point as a CLJS REPL. But if I try to evaluate anything - I get "No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript"
So I guess :node-script
isn't the best option for that kind of experimentation, do I really need to switch to :browser
and keep a browser running even though I just want to play around with the language itself?
otherwise you need to actually run the node script manually. ie. call node the-script.js
oh I see. I read that section of the manual, but had a brain fart and didn't think it applies to me. In that case I don't even need to tell shadow to watch the app, since I'm sending code to the repl via cursive and not running the compiled output, right?
just what Cursive output when I told it to switch the REPL namespace to the current file's one
Just to be sure I'm doing it right: generate pom, import pom into cursive; start shadow-cljs server; start cursive nrepl connection; issue (shadow/node-repl)
- at that time cursive shows that it is in CLJS repl. but then setting the REPL namespace fails
I tried loading the file in the repl (via Cursive's REPL / Load file in REPL) and got the following:
Loading src/myns/core.cljs... repl/require failed { Error: ENOENT: no such file or directory, open '/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/clojure.set.js'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:348:35)
at global.SHADOW_IMPORT ([stdin]:45:15)
at Object.shadow$cljs$devtools$client$node$closure_import [as closure_import] (/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:33:4)
at Object.shadow$cljs$devtools$client$node$repl_require [as repl_require] (/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:61:7)
at shadow$cljs$devtools$client$node$process_message (/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:122:6)
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/env.cljs:148:10)
at WebSocket.<anonymous> (/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:159:12)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (/Users/bupkis/dev/myns/node_modules/ws/lib/WebSocket.js:141:47)
errno: -2,
syscall: 'open',
code: 'ENOENT',
path:
'/Users/bupkis/dev/myns/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/clojure.set.js' }
done
not a clue whats happening. the recent nrepl change seems to have messed up something on my side and I can't use nrepl anymore
I wonder if connecting from Cursive to the socket-repl with something like tubular would be better
[2:1]~cljs.user=> (require 'demo.script)
nil
[2:1]~cljs.user=> (in-ns 'demo.script)
nil
[2:1]~demo.script=>
https://pastebin.com/xbXkAHQy is the stack trace
at java.util.Formatter.checkText(Formatter.java:2579)
at java.util.Formatter.parse(Formatter.java:2565)
at java.util.Formatter.format(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at clojure.core$format.invokeStatic(core.clj:5684)
at clojure.core$format.doInvoke(core.clj:5678)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at shadow.cursive_repl$get_socket_port.invokeStatic(cursive_repl.clj:25)
at shadow.cursive_repl$get_socket_port.invoke(cursive_repl.clj:10)
at shadow.cursive_repl$repl.invokeStatic(cursive_repl.clj:31)
at shadow.cursive_repl$repl.invoke(cursive_repl.clj:29)
at shadow.cursive_repl$_main.invokeStatic(cursive_repl.clj:93)
at shadow.cursive_repl$_main.invoke(cursive_repl.clj:87)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.core$apply.invokeStatic(core.clj:657)
at clojure.main$main_opt.invokeStatic(main.clj:317)
at clojure.main$main_opt.invoke(main.clj:313)
at clojure.main$main.invokeStatic(main.clj:424)
at clojure.main$main.doInvoke(main.clj:387)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:702)
at clojure.main.main(main.java:37)
the error above is just a missing .shadow-cljs/socket-repl.port
file which should exist when the server is running
yes the file is there and the port is the correct one. the run configuration for that clojure repl has the working dir set correctly
but I think I'll stay with the nrepl way and manually requiring the NS before trying to load the modified file in the repl
btw. is :node-script
the best way to do what I'm trying to - e.g. to have a live repl in Cursive that I can load files into and play. It's not a problem to run some Node process manually outside of Cursive if need be, I'm already running the server so one more won't hurt hehe
thheller, how hard do you think it would be for someone to carve out a pared down version of shadow-cljs that just built code? as in no watcher, repl, etc.
I think it would be very useful for running on e.g. a toaster jenkins or gitlab runner
IME when running on CI, starting the shadow-cljs process to run shadow-cljs release app
takes the majority of the time spent on that task
I did address the caching issue, and that sped up the building of the code itself a bit. but the startup can still be in the ~3-5 min range
obviously it gets worse the more jobs that are running. weāre working on getting beefier CI servers and some other enhancements
not at work, no. weāre using leiningen, but I didnāt notice any changes between using regular shadow-cljs and the leiningen integration
before you try to optimize anything in the dark you should really gather some data first
I can tell you that running the container locally on my 16gb macbook, the build times are completely reasonable
but not joking I have time npx shadow-cljs release <builds>
running on our CI and I easily see ranges from 5-10mins
I totally believe you but I would still like to see a npx shadow-cljs release <builds> --verbose
report
my main task for this sprint is improving our CI š so if thereās some low hanging fruit I can grab once we know more Iāll be happy to do the work
so if you cache only .shadow-cljs/builds
you might want to add .shadow-cljs/jar-manifest
we are persisting .shadow-cljs/builds
and node_modules
at the moment - not sure about jar-manifest
. I canāt remember if I only kept the builds
folder or the whole .shadow-cljs
its only a guess. also the disk performance really matter. just the other day @caleb.macdonaldblack changed something in his container setup to go from 3sec+ recompile times down to 0.3secs
but really run with --verbose
. the output prints just about everything where any time is spent
@thheller new here, just wanted to say thanks for all the work you've done on shadow-cljs! I've been waiting so long for a viable dev setup for working with ClojureScript in a "normal" JavaScript project
it's a relief to not have to deal with leiningen for a project that doesn't use any Clojure code on the JVM
Has anyone been able to set up rebel-readline in the shadow-cljs REPL? Not sure if it's incompatible with how shadow-cljs works, but it'd be awesome to have that readline experience
I have not looked at it yet. the CLJ repl should work out of the box. no idea how to hook up the CLJS REPL though
I always recommend hooking up your editor first. I only use the REPL from Cursive the readline was never important to me
I've gotten shadow-cljs to work with Calva in VS Code, but the REPL experience isn't that great there. I'll try setting it up with ProtoREPL next
I suppose I should try to get it working in Atom since I'm a member of the Atom team š
Yeah, I think I'll try to give it a shot and set up a demo repo if I can get something working
the question has come up multiple times now so if there is an issue I maybe won't forget about looking at it at some point š
@daviwil: as the author of Calva, Iād like to know what about the REPL experience isnāt great in your opinion. I have tons of ideas of where to focus my efforts, but time is limited and knowing what would make people stick with Calva is gold. #calva-dev is a good place to talk about these things. š
Hey! Sorry I didn't give more context to what I meant there. What I didn't say is that I'm really impressed with the overall setup experience of REPLs in Calva, worked super smoothly in my experience
The one thing that surprised me is how the CLJ and CLJS REPLs appear in different terminal items, I actually didn't know they were there until I clicked into the dropdown
I've tried different Clojure(Script) extensions in VS Code in the past and Calva is the only one that worked for me first try, so kudos for that!
The terminal API:s are very limited. I am thinking about doing something with some āspecialā text files. A bit like how it seems to be implemented in Emacs/CIDER.
Yeah, definitely. I am the original author of the PowerShell extension which is also heavily REPL-driven. They seem to be making progress on getting a WebView extensibility API online so that you can do custom UI panes. That might be an opportunity to make a ProtoREPL-like REPL UI for your extension š
@pez you still can't do custom UI in vscode right? last time I checked it wasn't possible to add anything custom besides a weird previewHTML trick
You can see a bunch of PRs where they've been adding it: https://github.com/Microsoft/vscode/pulls?q=is%3Apr+sort%3Aupdated-desc+webview+is%3Aclosed
https://github.com/Microsoft/vscode/issues/1833 this is still open I guess š
Downside is that it has to be in an editor column, not in the terminal/output panel area
so the current proof of concept is reachable under
assuming you have a shadow-cljs server running
that UI idea has been brewing for soo long now I should really just start working on it š
Could it be possible to include a simple html/js file combo with the extension that can link up to the REPL server?
it seems to allow loading resources from urls so just a simple html with <script src="
or so might do it already
about to add select-nrepl
support in cider š feel free to try it out https://github.com/clojure-emacs/cider/pull/2397
about the above, I wonder whether a watch-all
could be a good idea ...
It looks like http://shadow-cljs.org is down?
the domain is maintained by @jiyinyiyong and hosted in China