This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-26
Channels
- # beginners (91)
- # cider (34)
- # cljsrn (6)
- # clojure (95)
- # clojure-gamedev (4)
- # clojure-serbia (7)
- # clojure-spec (5)
- # clojure-uk (27)
- # clojurescript (42)
- # data-science (1)
- # datascript (2)
- # datomic (4)
- # duct (10)
- # emacs (11)
- # fulcro (21)
- # luminus (3)
- # lumo (24)
- # off-topic (2)
- # other-languages (2)
- # ring (2)
- # shadow-cljs (39)
- # spacemacs (9)
- # tools-deps (2)
Anyone know of any good blogs or articles that discuss deploying a cljs library to npm?
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
@benzap hard topic, personally I am looking the right solution myself. Here is collection of my links: https://github.com/reagent-project/reagent/blob/master/docs/InteropWithReact.md https://google.github.io/closure-library/api/goog.object.html https://github.com/lipas-liikuntapaikat/lipas/blob/dev/ui/src/cljs/lipas_ui/mui.cljs https://shadow-cljs.github.io/docs/UsersGuide.html#js-deps https://clojurescript.org/news/2018-03-26-release#_module_processing_improvements_and_closure_update https://gist.github.com/jmlsf/f41b46c43a31224f46a41b361356f04d https://clojurescript.org/news/2017-07-14-checked-array-access https://lambdaisland.com/episodes/clojurescript-interop http://blob.tomerweller.com/reagent-import-react-components-from-npm https://clojurescript.org/guides/javascript-modules
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.
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.
@kwladyka https://github.com/shadow-cljs/quickstart-browser the readme has step by step
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
step by step for npm is literally npm install the-thing
(:require ["the-thing" :as x])
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.
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
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
https://github.com/reagent-project/reagent/blob/master/project.clj#L10 it is part of reagent
well technically not exclude it. it will still be downloaded, it just won't be used.
well you still need to npm install react react-dom
manually currently but those will be included. not cljsjs/react
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.
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 🙂
Certain aspects of the :npm-deps stuff is still pretty new, so a lot of stuff doesn't work. I agree @kwladyka
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 🙂
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 😉
woo shadow-cljs
gives me so good experience so far. @thheller you are the boss 🙂 Thank you for creating this 🍺
Is there a slack channel for reframe?
@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
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?
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.
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.
@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.
@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.