@jiangts, for UMD, packaging, you need a webpack config file. The config file mentioned by @juhoteperi is a great start. Have a look at this one as well: https://github.com/bvaughn/react-virtualized/blob/master/webpack.config.umd.js
You may want to mark React as an external library. else it will get included in the build.
@lwhorton: have a look at https://github.com/bvaughn/react-virtualized/blob/master/webpack.config.umd.js for creating an external webpack dependency for react-addons-css-transition-group
i've tested this one and I know it works
@rohit: I figure you are ducky on gh (gievn your avatar)? Figured it would be better to talk here over my cljsjs/react-toolbox PR.
@lwhorton: š
can you explain (or point me to some link) why in this instance we dont need a deps.cljs file?
@lwhorton: i think the whole boot-cljs creates the deps file. So you don't need to do it explicitly
do you see any other package with an explicit deps.cljs?
material-ui
https://github.com/cljsjs/packages/tree/master/material-ui/resources
good point.
let me see if there are any packages with deps.cljs
does the boot-cljs also publish these to clojars under the group cljsjs? Iām assuming thatās the case, but couldnāt find it anywhere in the source...
On commit to the master branch, it happens automatically
so you don't need to worry about it
don't confuse boot-cljs with boot-cljsjs š
@martinklepsch: good point.
ugh
cant tell you how many times in the last few days iāve spent time looking for bugs that were cljsjs->cljs or cljs->cljsjs
@lwhorton: i think the reason material-ui
includes its own copy of deps.cljs
is because it does some very custom stuff
I don't think it's applicable for your package afaik
how might I test that? i suppose I can just remove the file and try to rebuild, but is that āgood enoughā?
Look at this document: https://github.com/cljsjs/packages/wiki/Creating-Packages#7-install-your-package-locally-and-try-it-out
also you could then create a demo repo using your package to test if the files in your package are as you expect them
@lwhorton: i tried installing your new changes and they don't work. I get an exception: clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: No such task (package)
so i just tried to run this all through in a fresh repo after removing the deps file, and i did it on an entirely different computer. pulling in the cljsjs/react-toolbox during the boot ābuild my appā task fails because it cannot find react-toolbox.
if I add back in that resources/deps.cljs
and republish (to local .m2), it works
i dont know if thatās an artifact of the fact that the ci hasnāt run and published to clojars with the deps fileā¦ but thatās kind of a pain to deal with anyways eh? packaging and testing locally requires a different fileset than in āprod modeā
iām not sure why that might be @rohit, what steps did you take to get that error?
@lwhorton: theres a deps-cljs
task which most packages use to generate the file which is missing from your PR
https://github.com/cljsjs/packages/search?utf8=%E2%9C%93&q=deps-cljs
@lwhorton: exactly what @martinklepsch is saying
aha! so that I should tuck that in and remove the deps file.
Consider following the guide once from start to finish, this should give you a good understanding of the tooling available/necessary: https://github.com/cljsjs/packages/wiki/Creating-Packages
i actually did read that through 2-3 times, but now that I know what Iām looking for I can see where I went wrong. Perhaps itās a little confusing, given the section about āsee how deps.cljs was autogeneratedā comes before any mention of the deps-cljs task.
@rohit iām concerned about your error ā did you clone my fork, checkout the branch, cd into the lib and try to run build package, then get that error?
@lwhorton: my fault. i was doing something stupid. nothing to worry about
oh, okay
@lwhorton: you mean in section 6?
yes.. in section 5 it talks about the pom and a task for packaging (doesnt talk about what the package task* might look like), but then goes right into āafter the package task is doneā. It might be helpful to say āhereās some examples of a typical package task, take advantage of cljsjs-packaging to autogenerate things like {foo bar baz]ā.
wow iām stoopid.
you basically do say that ...
i dont know why this isnāt clear to me, then. š
I'm not a native speaker so maybe language is just a bit off? Feel free to edit if you have ideas how to make it clearer
no itās actually quite good. i donāt think i read carefully enough.
@lwhorton: sorry about being finicky but I still see 1 major issue and 1 minor one
not a problem at all
Major - your usage of deps-cljs
doesn't include react. see https://github.com/cljsjs/packages/blob/master/react-motion/build.boot#L55
also your in your sift task just about the deps-cljs
, you don't need to include deps.cljs
ugh, thatās just sloppy on my part
too eager to get it in
for the minor issue - the js file produced includes react-addons-css-transition-group
you need to mark it as an external package in your webpack.config.boot.js
have a look at this exact line: https://github.com/bvaughn/react-virtualized/blob/master/webpack.config.umd.js#L19
so you'll have react-addons-css-transition-group: var React.addons.ReactCSSTransitionGroup
[i think]
you should confirm this
hm.. their packaging is so confusing. thereās a react-with-addons but what does it include? do you have to include react-with-addons and then all the react-addons-* that you want?
i agree. its kinda confusing
react-with-addons already includes ReactCSSTransitionGroup
.
so you don't need to include it in the webpack build again
i see. but should my webpack then have an external react-with-addons instead of itās current react?
technically it doesnāt depend on react, but the -with-addons version
@lwhorton: its compilcated .... as usual. š
you can't do that as I recently learned
best guide is the line I've posted above for the webpack config
i really hate the js whole packaging ecosystem. hate hate hate.
^ Haha, I can agree
I hate especially the react with-addons stuff
@juhoteperi: the sad truth is that no one does
Would be much easier for us if the addons were separate package
I think the react people just expect everyone to use babel and webpack and they are building everything around those two.
so if you don't use those two tools for your entire process, you are out of luck
In that context I\m sometimes a bid sad that we're so stuck on React as CLJS community
Yeah, it has its cons and pros
thats true.
but react ecosystem is the best of the lot
and its still far for optimum
there are a bunch of alternative implementations of reactā everything from reactlite, to things like virtualdom/deku
it would be great if things like reagent were a little less tied to react, and instead focused on an implementation interface
@lwhorton: that would be ideal
byovd - bring your own virtual-dom
right^
and plugins could extend the subset of the interface, so you can extend to more implementation-specific hooks or whatever
true.
for some projects you need react for its rich ecosystem and backwards compatibility regarding browsers
and for some projects, you don't
and at 130kish, react is pretty intense compared to some lighter vdoms that are as small as 5k
i think riot.js was about ~5k last time i looked
there is preact as well. https://github.com/developit/preact
yeesh
@lwhorton: good luck trying to use it cljs. š
i have no idea how to use es6 classes in cljs
that whole es6 class thing is just another can of wormsā¦ i cant* believe they leaked classes into the spec
i actually don't know enough about it to comment.
thereās some really good reading by this guy https://medium.com/@_ericelliott
if you get some free time and are at all interested in javascript, heās got some really strong (but valid) opinions
sweet. thanks! :thumbsup::skin-tone-4:
@lwhorton: gotta bounce for the day. best of luck with the packaging.
have a good one
cheers. you too