This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-22
Channels
- # beginners (42)
- # boot (73)
- # cider (17)
- # clara (1)
- # cljs-dev (47)
- # cljsrn (9)
- # clojars (4)
- # clojure (241)
- # clojure-italy (11)
- # clojure-norway (5)
- # clojure-russia (93)
- # clojure-spec (28)
- # clojure-uk (32)
- # clojurescript (170)
- # core-async (20)
- # cursive (62)
- # data-science (2)
- # datomic (47)
- # dirac (4)
- # events (1)
- # funcool (12)
- # gsoc (1)
- # hoplon (59)
- # immutant (8)
- # lambdaisland (4)
- # luminus (3)
- # lumo (11)
- # off-topic (13)
- # om (81)
- # onyx (1)
- # pedestal (47)
- # planck (30)
- # re-frame (2)
- # reactive (1)
- # reagent (2)
- # ring-swagger (15)
- # rum (1)
- # slack-help (5)
- # specter (5)
- # testing (5)
- # uncomplicate (8)
- # untangled (16)
- # vim (71)
- # yada (16)
Parens are bad if you format code like Java. Learning to read lisp indentation is what makes the parens comfortable.
Hia, can anyone point me to a good starting point (maybe a recent min lein template) for building nodejs apps with clojurescript.
lumo is a self hosting clojurescript
you can give it a cljs file, and it runs it in node
Still a bit heavy, my end deployment environment will probably be something like, aws lambda and/or google cloud functions.
Maybe you can try develop code with lumo -c src/ -i src/foo/main.cljs
and build file to deploy it.
so you want a minified js build targetting node - there's an example of that in the cljs quickstart https://github.com/clojure/clojurescript/wiki/Quick-Start#running-clojurescript-on-nodejs
I don't think you need lein at all for this - unless you prefer to manage js with lein over node?
was looking at using at using lein-npm for deps... Agree boot rules... maybe time leave lein world... The weight of legacy...
for npm deps, why not use npm?
all cljs needs is cljs.jar
unless someone else's clojure based dep management is significantly better of course, but that seems like it brings in a lot of java stuff you don't need at first glance (I say that as someone who codes in mostly clojure on java)
yep that would work.. just would like to keep tooling down.. npn for node stuff, then lein/boot for clj/cljs stuff... Just was after a unified way.
rayk what I'm saying is cljs.jar is all you need from clj - that's literally end of story
you don't need other clojure stuff if you really want to stay minimal
lein or boot are good if the added bulk adds features you need or avoids problems, of course, but I'm not sure either are really the case here
rayk node can manage all the deps you need. java -jar clojurescript.jar build-file.clj
will build your js
that's it
With Lumo you'd only need lein or boot for the java classpath resolution, I have been using it in conjunction with inf-clojure
successfully for last couple of months now
quickstart shows how to do it
richiardiandrea but lumo is reportedly too large for their target env
OK @noisesmith will give it a crack this afternoon.
My task is to write and deploy lambda functions that speak to DynamoDB
Oh missed that part sorry
well, if lumo works on lambda for you, maybe there's more to the story here!
richiardiandrea so lumo can generate an individual function you send to lambda, is that how it works?
I am not compiling with Lumo at the moment yes
to me it still seems like clojurescript.jar and java are the easier building method - though lumo is great for dev time
@richiardiandrea what are you using to compile to js, produce and manage and package.json etc.
I am using boot-cljs...Probably in order to be minimal the build.cljs
approach is best
For deps I am shelling out to yarn
see, if boot isn't needed for your program's deps, I still don't get why you'd use boot and not clojurescript.jar directly?
imho boot/lein is certainly help with the incident stuff. Running test/spec, alternative builds etc. That is about it. Really workflow support that is about it.
alternative builds are literally just different hash-maps in a clj file with clojurescript.jar - I honestly don't know the testing story though
but whatever works, of course
thanks @noisesmith I will that the guide for a spin using the jar.
I do my clojurescript testing with cljs.test, I don't use any plugins for it, but my project uses leiningen because that's the sanest way to manage my monstrosity of a java dependency tree. But I fantasize about not needing the heavy tooling.
It is true that you could get rid of boot (or use boot with-cp only for the classpath). Agree with the above ^
There are two interesting projects in this area, one is calvin
the other cljs-boot
I have been trying to push for a port of the task DSL or similar š I would love to have a way to compose tasks and fileset on node.js at this point
Haven't had the time to hack it myself though
I just upgraded a project from 1.7.228 to 1.9.495 and now source-map links in the chrome console are stacking two levels of :asset-path
like: /admin/adm.out/admin/adm.out/admin/core.cljs
where /admin/adm.out
is the asset path. Is this a known issue?
since you mentioned Boot React Native, do you already learn ClojureScript? I thought you were asking about how to start picking up cljs..
I am totally new to React Native. I come native development background. I am android developer
I'm from JavaScript side and learning cljs can be started with build small web apps, like todolist or something.
These are pieces I was using https://github.com/clojure-china/minimal-cljs http://cljs.info/cheatsheet/
not quite understand you question, I think it maybe help, because in React Native, the ClojureScript part and the React part is nearly the same with that in browsers.
If you haven't learning ClojureScript yet, I would suggest starting from Web pages with Reagent or Om, then React Native.
@jiyinyiyong Thanks Man.
@john05 I think #cljsrn is the best place to ask if you want to know more about clojurescript in react native
Problem with parse function in cljs-time, this works fine with simple format in cljs-time issue https://github.com/andrewmcveigh/cljs-time/issues/64
cljs.user=> (require '[cljs-time.format :as fmt])
nil
cljs.user=> (def yyyy-MM-dd (fmt/formatter "yyyy-MM-dd"))
#'cljs.user/yyyy-MM-dd
cljs.user=> (fmt/parse yyyy-MM-dd "2013-04-01")
#object[Object 20130401T000000]
But for this format "dd-MMM-yyyy kk:mm aa" I got an error.
cljs.user=> (def my-formatter (fmt/formatter "dd-MMM-yyyy kk:mm aa"))
#'cljs.user/my-formatter
cljs.user=> (fmt/parse my-formatter "05-Dec-1992 12:00 PM")
#error {:message "The parser could not match the input string.", :data {:type :parser-no-match}}
new (jar:file:/home/sivakumar/.m2/repository/org/clojure/clojurescript/1.9.494/clojurescript-1.9.494.jar!/cljs/core.cljs:34703:10)
Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (jar:file:/home/sivakumar/.m2/repository/org/clojure/clojurescript/1.9.494/clojurescript-1.9.494.jar!/cljs/core.cljs:34779:9)
Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$2 (jar:file:/home/sivakumar/.m2/repository/org/clojure/clojurescript/1.9.494/clojurescript-1.9.494.jar!/cljs/core.cljs:10244:17)
cljs.core/ex-info (jar:file:/home/sivakumar/.m2/repository/org/clojure/clojurescript/1.9.494/clojurescript-1.9.494.jar!/cljs/core.cljs:10237:34)
cljs-time.format/parse* (jar:file:/home/sivakumar/.m2/repository/com/andrewmcveigh/cljs-time/0.4.0/cljs-time-0.4.0.jar!/cljs_time/format.cljs:421:11)
Function.cljs_time.format.parse.cljs$core$IFn$_invoke$arity$2 (jar:file:/home/sivakumar/.m2/repository/com/andrewmcveigh/cljs-time/0.4.0/cljs-time-0.4.0.jar!/cljs_time/format.cljs:428:7)
cljs_time$format$parse (jar:file:/home/sivakumar/.m2/repository/com/andrewmcveigh/cljs-time/0.4.0/cljs-time-0.4.0.jar!/cljs_time/format.cljs:424:1)
Can someone tell me about a work around for the with-redefs and cljs.test async bug? other than the patch listed here http://dev.clojure.org/jira/browse/CLJS-884
@janetacarr the problem is not specific to with-redefs
, bindings canāt persist across async calls
I tried both a synchronous fixture and async fixture. It didn't seem to work š Does that mean that with-redefs doesn't function like the with-redefs clojure documentation?
@janetacarr with-redefs
wonāt work with go
macros, you donāt know which threads will handle the body of the go
block
so the answer is yes, "These temporary changes will be visible in all threads."(https://clojuredocs.org/clojure.core/with-redefs) <- is not true.
and it's not really a bug, it's mostly a misunderstanding of what with-redefs does: http://blog.cognitect.com/blog/2016/9/15/works-on-my-machine-understanding-var-bindings-and-roots
I am using the async macro
@dnolen would I do that with binding
no you just need to write your own thing here - itās probably less scary then it sounds
that's a little vague.
@janetacarr yes Iām going to explain
Really what's happening is I'm trying to redefs a fn that makes http requests asynchronously.
(deftest foo (async (let [old http-fn] (set! http-fn new-fn) ā¦ (set! http-fn old) (done))))
so just do it explicitly instead of trying to use with-redefs
(which canāt handle async code in itās body)
if this is super repetitive and needed for many tests then thatās why I suggested trying to do this in fixture
sure, but I thought set! only works on mutable things like vars, refs, java fields, and agents
I'll give that a shot then. thanks.
ClojureScript is a bit more lax here because no threading - and itās doesnāt have real vars
youāre definitely in a spot where the differences between Clojure/ClojureScript are subtle and not really resolveable in a generic way
Although we should mention that with-redefs is painful in both CLJS and CLJ, it can sometimes be cleaner to refactor the tests so that redefing vars isn't needed. For example you can test that you're constructing the correct http request given certain inputs.
I guess I should have been more specific, I'm writing unit tests for functions that call a form to make the http request
Is there a list of ES6 features not yet supported by the Closure compiler? I tried importing a library with :foreign-libs
and :es6
but it threw some errors, among them were:
ERROR: JSC_CANNOT_CONVERT_YET. ES6 transpilation of 'Wildcard export' is not yet implemented.
Does anyone have experience with mocking in clojurescript tests? Trying to add a testsuite, I want to redefine js/document
to be a noop as we are running tests using nashorn and it isnāt callable there
some quick googling and trying to use with-redefs
like so havenāt worked:
(deftest incoming-location
(testing "what this method is actually doing"
(with-redefs [js/document "nada"]
(= (core/incoming-location [{:Location
{:Scope "some-scope"}}
{:Location
{:Scope "another-scope"}}]) "result!"))))
@mikepjb with-redefs
is intended for vars which js/document
isnāt. Interestingly with-redefs uses set!
which I was going to suggest to try so not sure how that would play out
@dnolen @anmonteiro now that the async
bug is fixed, is there any timeline for updating to use the new build? weāre itching to use the new tree-shaking for external libs, but weāre using core.async š
@robert-stuttaford did Closure cut a release though?
@robert-stuttaford weāll update Closure when the March release is out
iām checking that now
shouldnāt be too far off
ohh i see thereās a big lag between fixes and releases, ok, my bad
thank you š
they do a monthly release
last 2 were Jan 24, Feb 18
so a week out at most, rad
@robert-stuttaford note that while itās a cool feature, itās also in alpha, so expect some packages to not be supported at first
even in the Closure side of things, we keep finding stuff that breaks sometimes
totally get that. we use rum on top of react, so iām anticipating some gains from the react constellation
see for example https://github.com/google/closure-compiler/issues/2377 and https://github.com/google/closure-compiler/issues/2345
plus some more that havenāt been tracked down, but weāve been following in #cljs-dev
great. iām pretty sure our use is quite vanilla, but iād be happy to file bugs if we find them
right, starting slowly with React may be a good start
but note that Rum will probably need to be updated for that use case too
i.e. if it calls js/React
, needs to update to consume React from NPM etc
itās using cljsjs.react right now, but i do see js/React.PropTypes.string
in the source
once cljs support with async is in, iāll chat with Nikita about it
itās what Iām saying
if itās using cljsjs/react
, itās using js/React
we use rum/react on mobile, so weāve a good reason to see this working
makes sense
Iām excited to see people using it
itās hella cool. all on the back of Mariaās work right?
started with that, yes
@juhoteperi improved on it a lot too
I'm trying to use core.async, and the compiler is throwing an error: No such namespace: clojure.core.async
In my namespace declaration, I'm requiring [clojure.core.async :as async]
. Am I requiring it wrong?
(I also tried using cljs.core.async
instead, but that threw the same error.)
@jr Caused by: clojure.lang.ExceptionInfo: No such namespace: cljs.core.async, could not locate cljs/core/async.cljs, cljs/core/async.cljc, or Closure namespace "cljs.core.async"
No. Is it not in cljs.jar?
I need to set up my project as well. I don't have a dependency file at all yet.
That would be with Lein, right?