This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-21
Channels
- # bangalore-clj (11)
- # beginners (82)
- # boot (1)
- # braveandtrue (29)
- # cider (16)
- # cljdoc (2)
- # cljs-dev (2)
- # clojure (74)
- # clojure-dev (3)
- # clojure-italy (2)
- # clojure-mke (1)
- # clojure-nl (4)
- # clojure-sg (1)
- # clojure-spec (1)
- # clojure-uk (53)
- # clojure-ukraine (1)
- # clojurescript (33)
- # cursive (29)
- # datomic (59)
- # editors (4)
- # emacs (14)
- # fulcro (2)
- # graphql (12)
- # hoplon (2)
- # nyc (4)
- # onyx (5)
- # parinfer (10)
- # pedestal (22)
- # re-frame (11)
- # reagent (35)
- # ring-swagger (5)
- # shadow-cljs (150)
- # tools-deps (9)
- # vim (1)
- # yada (20)
https://github.com/thheller/shadow-cljs/commit/26cbb11c1f9848bda7a81546b18065b9dd34bc84
working well for me @thheller
➜ Manage git:(shadow-cljs) ✗ shadow-cljs browser-repl app
shadow-cljs - config: /Users/chrisetheridge/code/Cognician/Manage/shadow-cljs.edn cli version: 2.6.2 node: v10.8.0
shadow-cljs - connected to server
ClassNotFoundException shadow.cljs.devtools.cli java.net.URLClassLoader.findClass (URLClassLoader.java:381)
on the new version?hmm nvm. doing a new build sorted it out
don’t think so, but highly possible
Hey all. Having some trouble with express using advanced optimizations. Error handling middleware (4 arity functions) are being compiled to 3 arity functions if the last arg (`next`) is not used e.g. in the case where we want to finish handling the request and send the response from within that middleware function. Because express uses the arity of the middleware to determine that it is an error handling middleware, when we are running the app with advanced optimizations this middleware is not being called as it should when an error is thrown from one of our routes.
we are wondering what the best way to prevent the dropping of the last arg would be...
I have this error when try to load namespace in Cursive:
CompilerException java.lang.RuntimeException: No such var: s/explain-data, compiling:
with code
(defn- value->spec-msg [specs->msg spec value]
"Check value with spec.
If fail return msg error."
(-> (s/explain-data spec value)
(get-in [:cljs.spec.alpha/problems 0 :via])
(last)
specs->msg))
But I have it in :require and it works in webbrowser
(ns services.form
(:require [cljs.spec.alpha :as s]
[reagent.core :as r]
[taoensso.timbre :as l]))
How can I use REPL cljs in Cursive in friendly way?@kwladyka remember that the REPL you connect to in Cursive starts as a Clojure REPL. you need to switch it to CLJS first.
@rs the only thing I can think of at the moment is using goog.reflect
. You can call (gr/sinkValue next)
as the first thing in the function. it doesn't actually do anything besides telling the compiler that the next
should be kept and not removed.
@kwladyka CompilerException java.lang.RuntimeException: No such var: s/explain-data, compiling:
pretty sure that you get this error when in a Clojure REPL
What I want to achieve: during write tests I often use REPL to check code during write tests / code of functions
hmm you are right, for some reason I am not in CLJS REPL…. hmm I was in :app
instead :node-test
REPL
No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
Oh but I see I can’t use node-test with cljs REPL ?:node-test
isn't really meant for REPL development since its supposed to exit after running your tests
(shadow/node-repl)
To quit, type: :cljs/quit
=> [:selected :node-repl]
Loading test/services/form_test.cljs... repl/require failed { Error: ENOENT: no such file or directory, open '/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.test.env.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/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.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/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.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/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.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/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/env.cljs:148:10)
at WebSocket.<anonymous> (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.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/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/node_modules/ws/lib/WebSocket.js:141:47)
errno: -2,
syscall: 'open',
code: 'ENOENT',
path:
'/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow.test.env.js' }
Not so easy[email protected]
ok will try to update
(shadow/node-repl)
To quit, type: :cljs/quit
=> [:selected :node-repl]
Loading src/services/form.cljs... done
Loading test/services/form_test.cljs... done
(-> {:names->value {:email ""
:password ""}
:names->validations {:email [::spec-email]
:password [::spec-password test-fn]}
:specs->msg {::spec-email "Typo? It doesn't look valid."
::spec-password "Password is required."}}
(form/init-form))
(node:9656) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
<eval>:1
form.init_form(new cljs.core.PersistentArrayMap(null, 3, [new cljs.core.Keyword(null,"names->value","names->value",-1214004968),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"email","email",1415816706),"",new cljs.core.Keyword(null,"password","password",417022471),""], null),new cljs.core.Keyword(null,"names->validations","names->validations",-1835037433),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"email","email",1415816706),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword("cljs.user","spec-email","cljs.user/spec-email",1595736430)], null),new cljs.core.Keyword(null,"password","password",417022471),new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword("cljs.user","spec-password","cljs.user/spec-password",1742175166),cljs.user.test_fn], null)], null),new cljs.core.Keyword(null,"specs->msg","specs->msg",1137057203),new cljs.core.PersistentArrayM
ReferenceError: form is not defined
at <eval>:1:1
at Script.runInThisContext (vm.js:91:20)
at runInThisContext (vm.js:298:38)
at global.SHADOW_NODE_EVAL ([stdin]:74:30)
at Object.shadow$cljs$devtools$client$node$node_eval [as node_eval] (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:25:16)
at /Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:48:30
at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/env.cljs:91:16)
at Object.shadow$cljs$devtools$client$node$repl_invoke [as repl_invoke] (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:48:13)
at shadow$cljs$devtools$client$node$process_message (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/node.cljs:116:6)
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (/Users/kwladyka/Library/Mobile Documents/com~apple~CloudDocs/storage/Projects/content-manager-fe/.shadow-cljs/builds/node-repl/dev/out/cljs-runtime/shadow/cljs/devtools/client/env.cljs:148:10)
I don't know if thats my mistake or cursive but for CLJS you need to manually switch the ns
BTW @thheller I will be 6-10 in Berlin. Would you like to have a bear / tea if you are somewhere around?
How to simulate webbrowser input changes in shadow-cljs? I just described my needs on #clojurescript
@thheller thanks for the suggestion re: using goog.reflect
. Its a shame the removal of unused args can't be turned off in the closure compiler to preserve arity!
yea it’s actually not that unusual to check arities. there’s a whole style of programming that will, for example, return a promise if you pass 2 args but use a callback if you pass 3. 🙂
well thats different. that checks if the third arg was passed in at all which is normal
Hey so I have a dir structure like
├── shadow-cljs.edn
├── src
├── test
└── yarn.lock
and according to the shadow-edn has:
:source-paths ["src" "test"]
:test {:target :browser-test
:test-dir "resources/public/js/test"
:ns-regexp "-test$"
:devtools {:http-port 8021
:http-root "resources/public/js/test"}}
also I don't have a test runner because from the docs, shadow will use the default cljs one(s)?
my test/app/core_test
requires cljs.test
https://github.com/thheller/shadow-cljs/issues/57#issuecomment-339673404
basically experiencing this but I'm not using karma https://github.com/thheller/shadow-cljs/issues/57#issuecomment-356174200
@urbanslug I have trouble understanding what you are saying
I wasn't doing this before > what? :browser-test you run by opening http://localhost:8021?
well I think compilation of the test failed becuse one of the required namespaces is missing
I'm confused. So the only problem is that the watch
didn't finish compiling? which explains why the js/test.js
doesn't exist and your tests will only run once it completes
everything around testing isn't exactly user friendly currently. it'll get better soon I hope.
This should run successfully though, right?
(ns app.core-test
(:require-macros [cljs.test :refer-macros [deftest testing is]])
(:require [cljs.test :as t]
[app.core :as core]))
(deftest fake-test
(testing "fake description"
(is (= 1 2))))
Uncaught TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined
Testing app.core-test
FAIL in (fake-test) (at http:438:85)
fake description
expected: (= 1 2)
actual: (not (= 1 2))
Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
(ns app.core-test
(:require [cljs.test :as t :refer [deftest testing is]]
[app.core :as core]))
gotta step away from this for a bit. It seems moving to re-frame won't be a quick thing haha
stashed my changes and redid it with just the tests (without all the move-to-reframe-code) and it works
I guess that could be considered a nsform bug if it doesn't complain about the combo of :require-macros
+ :refer-macros