Fork me on GitHub
#clojurescript
<
2018-05-26
>
benzap07:05:54

Anyone know of any good blogs or articles that discuss deploying a cljs library to npm?

nenadalm08:05:37

I suppose it's the same as deploying any other library to npm. You can create package.json, add prepublish task that compiles cljs into js (example with compiling typescript: https://github.com/imatic/pgqb/blob/c8d0eb85b01345c20648dde016420cdf91bfa64b/package.json#L28) and specify entry point: https://github.com/imatic/pgqb/blob/c8d0eb85b01345c20648dde016420cdf91bfa64b/package.json#L5 guide on publishing package: https://docs.npmjs.com/getting-started/publishing-npm-packages

benzap08:05:52

thanks, i'll take a look

kwladyka10:05:09

Everything have so many issues…. finally I am trying shadow-cljs. I heard from people it is good solution to include npm. I will try it soon.

kwladyka10:05:33

shadow-clj has good documentation, but unfortunately it is academic stile. You have huge book with all knowledge, but you have to glue this knowledge yourself to get success. Doc is not written in the way, step by step with some example when you can feel you understand it and have small successes.

kwladyka10:05:15

I think npm packages are only one huge disadvantages of cljs. But according to https://clojurescript.org/guides/javascript-modules it should change in the future

kwladyka10:05:52

@thheller thx, I will take a look on it

thheller10:05:01

step by step for npm is literally npm install the-thing (:require ["the-thing" :as x])

kwladyka10:05:48

Maybe I am not enough clever 🙂 Just my personal feeling when trying to understand how to use shadow-cljs. I did something, but I wasn’t sure it is ok, up to date, etc.

kwladyka10:05:53

All is about small details, for example here https://github.com/lauritzsh/reagent-shadow-cljs-starter React is in package.json, but in shadow-cljs.end there is reagent without :exclude cljs/react

kwladyka10:05:40

That is why I am saying i feel there is huge book with all answers, but I have to glue knowledge myself to be sure how to use it

thheller10:05:47

why would it exclude? it is not required. you can do it but it is optional

thheller10:05:17

yep. I know. doesn't matter.

kwladyka10:05:01

Hmm so shadow-cljs is clever enough to know about it and exclude it?

thheller10:05:40

well technically not exclude it. it will still be downloaded, it just won't be used.

kwladyka10:05:58

I have no idea how this magic work, but I am impressed

kwladyka10:05:21

But will be include into js files after compilation?

thheller10:05:00

well you still need to npm install react react-dom manually currently but those will be included. not cljsjs/react

kwladyka10:05:29

that is fine

kwladyka10:05:55

thank you for explanation

thheller10:05:13

shadow-cljs in general tries to automate all this stuff as much as possible. so most of the manual things you need to do with other tools do not apply. If you read a guide about :npm-deps in CLJS pretty much none of it applies to shadow-cljs.

kwladyka10:05:48

I was trying all this things and I have issues in all of cases. Still it could be my fault. Today I will finally try shadow-cljs to achieve what I want 🙂

benzap11:05:11

@kwladyka Thanks for the links, i'll look them over

benzap11:05:57

Certain aspects of the :npm-deps stuff is still pretty new, so a lot of stuff doesn't work. I agree @kwladyka

benzap11:05:35

shadow-cljs has it's own ways of handling that stuff, and it looks like it has much better support, since it seems like @thheller is interested in keeping strong ties with the npm ecosystem 🙂

thheller11:05:00

geez no. I wish I could use something else but npm is where most of the JS stuff ends up and I wanted easier access to that 😉

kwladyka13:05:05

woo shadow-cljs gives me so good experience so far. @thheller you are the boss 🙂 Thank you for creating this 🍺

😎 4
kwladyka13:05:38

error messages ❤️

jrbrodie7714:05:42

Is there a slack channel for reframe?

bhauman15:05:48

@grahamcarlyle I personally put a lot of work into figwheel to make it as user friendly as possible, I do highly recommend it as a first experience of clojurescript, cljs.main is still very very new and not friendly at all

👍 4
jrbrodie7720:05:01

I'm running into a head-scratcher with re-frame. I'm getting 'Error <! used not in go block' but I've got go blocks everywhere and I've tested the functions in question outside of re-frame. Has anyone seen this before?

jrbrodie7720:05:26

One addition: seems to be related to the go block being long running. If I remove a long running call and put fake data in, it seems to work.

jrbrodie7720:05:55

OK... somehow fixed it by factoring out the go block into its own function instead of inlining in the handler. No idea why that should have changed anything, maybe some kind of macro interaction within re-frame.

justinlee18:05:17

@jrbrodie77 keep in mind that go blocks don’t traverse function boundaries. so if you had the <! inside an inlined function it won’t work. i suspect that’s what happened to you.

justinlee18:05:17

@jrbrodie77 keep in mind that go blocks don’t traverse function boundaries. so if you had the <! inside an inlined function it won’t work. i suspect that’s what happened to you.