Fork me on GitHub
#announcements
<
2022-02-12
>
niwinz15:02:48

Just released funcool/promesa v6.1.434 that comes with -> , ->> and as-> threading macros, variants of the same macros from clojure.core that works with promises. https://github.com/funcool/promesa

💯 19
🎉 10
borkdude18:02:11

@U06B73YQJ Thanks for promesa, it's probably the most important built-in library in #nbb for dealing with JS promises

niwinz19:02:46

glad to hear it, and glad it is useful 😄

jaide21:02:17

https://github.com/athos/kitchen-async that's been my goto promise library for a few years. Any thoughts on key differences?

borkdude21:02:26

What I like about promesa is that it is very light weight, no external dependencies, just makes it more convenient to work with JS native promises and that's it. No extra baggage and results in small bundle size.

jaide06:02:20

That's fair but unless I'm mistaken, kitchen async also has no external deps

borkdude07:02:06

I saw it has a dep on core async but I don't know if it's really used

jaide18:02:18

Ah you're right. Looks like it has a specific from channel to promise API https://github.com/athos/kitchen-async/blob/master/src/kitchen_async/promise/from_channel.cljs which satisfies my question 😛

phronmophobic18:02:16

Snowball: Tool for inspecting the sizes of your dependencies https://github.com/phronmophobic/snowball Supports 3 views: interactive treemap, static image treemap, terminal table

💯 24
👍 14
🆒 7
🎉 6
nice 5
1
😍 1
Ben Sless18:02:03

You could easily make a treemap du out of it, too

phronmophobic18:02:08

@UK0810AQ2, I thought that's what I was doing.

phronmophobic19:02:37

Oh, I think I misunderstood your suggestion. You mean make a version that is given a local directory and spits out a tree map?

Ben Sless19:02:09

Exactly! You could probably add it with a tiny change

Ben Sless19:02:47

Maybe even extract the treemap to its own library for visualization components :thinking_face:

Ben Sless19:02:05

Oh, carry on, then 😄

jumar20:02:03

Is there a way to run this on a lein project? I guess no?

phronmophobic20:02:46

@U06BE1L6T, not directly, but it will work with mvn deps. So the workaround is something like:

$ lein install
Created /Users/adrian/workspace/membrane-re-frame-example/target/membrane-re-frame-example-0.1.0-SNAPSHOT.jar
Wrote /Users/adrian/workspace/membrane-re-frame-example/pom.xml
Installed jar and pom into local repo.
$ clojure -X:snowball :lib membrane-re-frame-example :mvn/version '"0.1.0-SNAPSHOT"'

jumar20:02:17

Ah, I see. I in fact tried it on one of our private repos/libs but got an error due to, I suppose, snowball not able to resolve dependencies stored in a private maven repo.

phronmophobic20:02:31

It requires knowing how the clojure deps.edn works, but you could make a small deps.edn file like:

{:deps
 {my/library {:mvn/version "0.1.2"}}
 :mvn/repos
 {"my-private-repo" {:url ""}}}
and then run
clojure -X:snowball :deps deps.edn
or pass it all on the command line:
clojure -Sdeps '{:mvn/repos {"central" {:url ""}}}' -X:snowball :lib membrane-re-frame-example :mvn/version '"0.1.0-SNAPSHOT"'

robert-stuttaford05:02:23

this is very cool thank you!

jumar06:02:10

Thanks @U7RJTCH6J I also found this: https://github.com/hagmonk/depify It can be helpful to convert project.clj to deps.edn.

nice 2
jumar07:02:55

A really useful tool - I already found one big dependency (almost 40M) which hasn't been needed in our app for years.

🎉 3
phronmophobic07:02:36

Nice! Let me know if you have any suggestions or find any bugs.

jumar07:02:27

A way to produce machine-readable output if there's not one already. E.g. CSV. Right now I'm doing naively something like this:

cat deps-size.txt | sed -E 's/( |,)+//g' | tr '|' ',' > deps-size.csv
Then I can explore it with https://www.visidata.org/, Excel, etc.

❤️ 1
jumar07:02:32

Also I'm not sure I understand the treemap visualization (it's quite messy for a larger project or I just didn't know how to read it well) Does it try to visualize the dependency chain? (that is if box B is inside A it means that dependency A brings dependency B?) Either way, it could be useful to have a plaintext version of such treemap.

phronmophobic07:02:30

> Also I'm not sure I understand the treemap visualization (it's quite messy for a larger project or I just didn't know how to read it well) I agree that the treemap is a little messy. If the project is open source, I would be interested to see what the output looks like so I can think about how to improve it. > Does it try to visualize the dependency chain? (that is if box B is inside A it means that dependency A brings dependency B?) Yes, that's how it currently works. Every box is a dependency. The dependency box will have sub-boxes for each of its dependencies and a "self" box for its own code (you may seems some labels such as "self:<projectname>". > Either way, it could be useful to have a plaintext version of such treemap. I'm not sure what that means. Do you have an example?

henryw37409:02:04

cool! I noticed a lot of people citing build size as a cljs issue in the last clojure survey, but not much discussion about that generally that I'm aware of. Larger build size doesn't necessarily mean significantly slower page load or more data transfer over multiple visits - see https://widdindustries.com/clojurescript-datetime-lib-comparison/ for example. but if you do decide reducing build size is necessary then this tool looks handy

jumar11:02:03

@U7RJTCH6J My project is closed-source but I don't think there's anything sensitive - I can share it via DM. About this: > Either way, it could be useful to have a plaintext version of such treemap. I meant that instead of just a picture I'd like to get the actual structure that's used to generate the picture - perhaps as EDN or whatever. So I can navigate it in a terminal and even build an alternative representation if needed.

👍 2