This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-03
Channels
- # announcements (3)
- # asami (4)
- # aws (1)
- # babashka (22)
- # beginners (111)
- # calva (3)
- # cider (1)
- # clj-kondo (55)
- # clj-on-windows (9)
- # cljsrn (1)
- # clojure (13)
- # clojure-europe (35)
- # clojure-losangeles (3)
- # clojure-nl (2)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (5)
- # clojurescript (51)
- # conjure (5)
- # cursive (5)
- # datascript (1)
- # datomic (27)
- # deps-new (8)
- # depstar (41)
- # emacs (4)
- # fulcro (24)
- # graphql (4)
- # gratitude (8)
- # helix (36)
- # jobs (2)
- # leiningen (2)
- # lsp (11)
- # off-topic (24)
- # pathom (23)
- # pedestal (2)
- # polylith (27)
- # re-frame (12)
- # reagent (7)
- # reitit (1)
- # releases (3)
- # remote-jobs (1)
- # rewrite-clj (4)
- # sci (1)
- # shadow-cljs (27)
- # spacemacs (12)
- # tools-deps (31)
- # web-security (2)
how do I run clojurescript tests with clj? I have tests set up but dont understand how to run them
Hi all, what is the preferred way of working with CLJS and node.js? I’m currently using shadow-cljs and CIDER, I select shadow
and node-repl
when prompted which gives me a working REPL. However I encounter this issue:
• I create some namespace that has an error in it (e.g. I forgot to require a var from another namespace)
• Then I try to require
it from the REPL
• It correctly notifies me of my mistake: WARNING - :undeclared-var
• I then go and fix the error and save the source file
• I try to require it again but the warning appears again
• This happens no matter what I do to the original source file until I restart the REPL
Is there some caching happening that I’m not aware of maybe?
Hi, is there a way speed up cljs compilation on ci by reusing some caches from prev compilation? if so - which folders i need to reuse?
or to be more precise - what is path for the :aot-cache
?
Can't say for the vanilla compiler, but shadow-cljs uses .shadow-cljs
dir within the project.
Regarding :aot-cache
- this function from cljs.analyzer
seems relevant:
(defn ^File cache-base-path
([path]
(cache-base-path path nil))
([path opts]
(io/file (System/getProperty "user.home")
".cljs" ".aot_cache" (util/clojurescript-version)
(build-affecting-options-sha path opts))))
thank you so much!
so ~/.cljs/aot_cache
, roger
regarding the .shadow-cljs
- is it safe to reuse/share it?
thanks too bad it is in the home dir, gitlab ci doesnt like it
You should be able to override the user.home
property. But it might affect other things.
Although if your CI doesn't like ~
in general, then it's probably fine to override that property.
the problem is here https://docs.gitlab.com/12.10/ee/ci/yaml/README.html#cachepaths
I’ll try first to cache .shadow-cljs
thanks!
JS API for nbb: https://github.com/borkdude/nbb/blob/main/test-scripts/api-test/test.mjs 🎉
I have the following inside let […]:
contract-deploy
(.. contract
(deploy (clj->js
{:arguments [ipfs
(:percentage db)
(:min-to-raise db)
(:bid-start db)
(:bid-end db)
(:payments-start db)
(:payments-end db)
(:payments-interval db)]
:data (.-bytecode (js/JSON.parse resp))})))
_
(.. contract-deploy
(send (clj->js {:from ego})
(fn [err tx-hash]
(prn "err is " err
"tx hash is " tx-hash))))
coverted from the following js from web3 docs:
myContract.deploy({
data: '0x12345...',
arguments: [123, 'My String']
})
.send({
from: '0x1234567890123456789012345678901234567891',
gas: 1500000,
gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
but I’m getting this error for the second expression
Uncaught TypeError: Cannot read property 'length' of null
at require.formatParam (index.js:224)
at eval (index.js:100)
at Array.map (<anonymous>)
at require.encodeParameters (index.js:94)
at eval (index.js:439)
at Array.map (<anonymous>)
at Object.global._encodeMethodABI (index.js:438)
at Object.global._processExecuteArguments (index.js:701)
at Object.global._executeMethod (index.js:720)
at switch__60994__auto__ (events.cljs:157)
browser
the js land code makes no sense in relation to the cljs world
the js code that’s throwing the exception. It’s the code from the web3js library
called from cljs
Well, that's something you have to learn to deal with then. But something that's passed into encodeParameters
is not right. Might be your :data
above is wrong.
Hi, how can I call a javascript function with varargs in ClojureScript, like:
Uint8Array.of(1, ...data)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply
It's seems regular apply
won't work, because (.-foo obj) doesn't have a binding with obj. I just tried js-invoke
it works. I'll try this prototype.apply, thanks for your help!
Hi! I’m experimenting with storybook, struggling to get a non-trivial example up and running. If I make a story with basically just reagent in it it works fine. But as soon as I require namespaces that pull in large third party namespaces, storybook takes forever to compile (webpack/babel) and often just crashes with out of memory. Using the approach outlined here https://github.com/DavidVujic/clojurescript-amplified. Anyone with pointers? First thing that comes to mind for me is that i really don’t need babel to transpile anything, but not sure if that’s what causes this. I have tried several different things to skip files on webpack and babel, no luck so far
Just in case (and sorry if I have mentioned it to you before, I don't recall) - beware of Specter usage in the browser since it increases the bundle size significantly.
in the past there were issues with code becoming too large for webpack. in react-native I worked around it by effectively hiding it so it doesn't get processes at all
Sounds like the sensible solution, yes. I really should learn more about how webpack and babel works. In this case it seems like the value of processing all files with those tools is pretty minimal for a lot of storybook users, but it is included by default anyway.
Or actually I’m not 100% sure. But specter is one that triggers the warning The code generator has deoptimised the styling
.
@ingesol that all seems very strange to me - ideally any usage of Storybook would just avoid needing to look at the CloureScript
it still shouldn't matter in dev? I don't think any CLJS should get processed by Webpack
if the storybook site is built via webpack at dev time, it needs to load the compiled JS of your stories and components right?
well the API of the whole thing is dynamic, I don't see how Webpack has anything to do w/ it
(I could be missing some other details but it seems to me this should work w/o processing CLJS)
Curious if this is a known issue but escaping forward slash on literal regex appears to be giving me an exception (I'm assuming the compiled JS code is invalid)?
#"\/"
#object[SyntaxError SyntaxError: Unexpected token ';']
Is there a way to get the generated JS code without evaling it in CLJS? (I'm on version "1.10.866"
).Ah found it NVM https://clojure.atlassian.net/browse/CLJS-1399