This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Has anyone used
with-open in Clojurescript? I’d like to implement something like
IClosable and the only example I found is in
ah, that attempt didn’t work ;(
No such namespace: paredit, could not locate paredit.cljs, paredit.cljc
@ag The Planck JAR really only exists to help with tooling. So, it is useful when using Cursive (and its static analysis), and so that http://cljdoc.org can generate documentation for the namespaces, etc. (https://github.com/planck-repl/planck/issues/875 as well)
It can't really be used as a library because it is rife with dependencies on Planck itself.
Hrm. Much of the Planck library is there to expose its native facilities via Clojure-idiomatic namespaces. Having said that, there was an idea of factoring out those abstractions into a library that could be used, where the concrete implementations could be implemented by anything: https://github.com/abiocljs/abio
with-open is in there 🙂 https://github.com/abiocljs/abio/blob/master/src/abio/io.clj#L4
If you just want a
with-open that can close something you know how to close, I'd just a macro to your project, though, and not take on a dep.
what’s the correct way to slurp file at the root of the project targeting nodejs? I can’t seem to find a way to detect the right dir.
(js* "__dirname") returns something like “myproj/target/node/dev/figwheel”
(def ^:private project-path (.cwd js/process)) to get root directory (https://nodejs.org/api/process.html#process_process_cwd).
Note that you have to be in the project root directory when you're starting the node process though.
I think nodejs is not aware of classpath, so you probably have to do it manually somehow
yet somehow the following not working:
it path/join returns correct [full] path to deps.edn, yet io/slurp fails
(:require [cljs-node-io.core :as io :refer [slurp spit]] path) (slurp (path/join (.resolve path ".") "deps.edn"))
I think more reliable approach would be to run node process with env var set to project root
How do you combine promise chains of funcool/promesa with sync stuff, e.g.: if I have something like
How can I run this within
(p/chain fill-username fill-password #(.click %)
deftestand assert the results?