cljsjs

rohit 2016-06-27T10:27:01.000215Z

@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

šŸ™ 1
rohit 2016-06-27T10:28:36.000217Z

You may want to mark React as an external library. else it will get included in the build.

rohit 2016-06-27T13:56:34.000221Z

@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

rohit 2016-06-27T13:57:20.000223Z

i've tested this one and I know it works

lwhorton 2016-06-27T13:57:34.000224Z

@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.

rohit 2016-06-27T13:57:47.000226Z

@lwhorton: šŸ™‚

lwhorton 2016-06-27T13:58:08.000227Z

can you explain (or point me to some link) why in this instance we dont need a deps.cljs file?

rohit 2016-06-27T13:58:50.000228Z

@lwhorton: i think the whole boot-cljs creates the deps file. So you don't need to do it explicitly

rohit 2016-06-27T13:59:09.000229Z

do you see any other package with an explicit deps.cljs?

lwhorton 2016-06-27T13:59:36.000230Z

material-ui

rohit 2016-06-27T14:00:00.000233Z

good point.

rohit 2016-06-27T14:00:28.000234Z

let me see if there are any packages with deps.cljs

lwhorton 2016-06-27T14:00:29.000235Z

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...

rohit 2016-06-27T14:00:56.000236Z

On commit to the master branch, it happens automatically

rohit 2016-06-27T14:01:09.000237Z

so you don't need to worry about it

martinklepsch 2016-06-27T14:01:35.000238Z

don't confuse boot-cljs with boot-cljsjs šŸ™‚

rohit 2016-06-27T14:02:24.000239Z

@martinklepsch: good point.

lwhorton 2016-06-27T14:02:29.000240Z

ugh

lwhorton 2016-06-27T14:02:52.000241Z

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

rohit 2016-06-27T14:03:25.000242Z

@lwhorton: i think the reason material-ui includes its own copy of deps.cljs is because it does some very custom stuff

rohit 2016-06-27T14:03:42.000243Z

I don't think it's applicable for your package afaik

lwhorton 2016-06-27T14:05:19.000246Z

how might I test that? i suppose I can just remove the file and try to rebuild, but is that ā€œgood enoughā€?

rohit 2016-06-27T14:06:39.000249Z

also you could then create a demo repo using your package to test if the files in your package are as you expect them

rohit 2016-06-27T14:34:10.000251Z

@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)

lwhorton 2016-06-27T14:43:29.000252Z

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.

lwhorton 2016-06-27T14:43:50.000253Z

if I add back in that resources/deps.cljs and republish (to local .m2), it works

lwhorton 2016-06-27T14:44:35.000254Z

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ā€™

lwhorton 2016-06-27T14:45:02.000255Z

iā€™m not sure why that might be @rohit, what steps did you take to get that error?

martinklepsch 2016-06-27T14:45:06.000256Z

@lwhorton: theres a deps-cljs task which most packages use to generate the file which is missing from your PR

rohit 2016-06-27T14:45:27.000260Z

@lwhorton: exactly what @martinklepsch is saying

lwhorton 2016-06-27T14:45:37.000261Z

aha! so that I should tuck that in and remove the deps file.

martinklepsch 2016-06-27T14:46:44.000262Z

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

lwhorton 2016-06-27T14:48:53.000265Z

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.

lwhorton 2016-06-27T14:49:47.000266Z

@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?

rohit 2016-06-27T14:50:12.000267Z

@lwhorton: my fault. i was doing something stupid. nothing to worry about

lwhorton 2016-06-27T14:50:29.000268Z

oh, okay

martinklepsch 2016-06-27T14:50:54.000269Z

@lwhorton: you mean in section 6?

lwhorton 2016-06-27T14:53:42.000270Z

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]ā€.

lwhorton 2016-06-27T14:54:27.000272Z

wow iā€™m stoopid.

lwhorton 2016-06-27T14:54:34.000273Z

you basically do say that ...

lwhorton 2016-06-27T14:54:42.000274Z

i dont know why this isnā€™t clear to me, then. šŸ˜•

martinklepsch 2016-06-27T14:55:38.000275Z

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

lwhorton 2016-06-27T14:56:55.000276Z

no itā€™s actually quite good. i donā€™t think i read carefully enough.

rohit 2016-06-27T15:11:37.000282Z

@lwhorton: sorry about being finicky but I still see 1 major issue and 1 minor one

lwhorton 2016-06-27T15:11:52.000283Z

not a problem at all

rohit 2016-06-27T15:12:27.000284Z

Major - your usage of deps-cljs doesn't include react. see https://github.com/cljsjs/packages/blob/master/react-motion/build.boot#L55

rohit 2016-06-27T15:13:26.000286Z

also your in your sift task just about the deps-cljs, you don't need to include deps.cljs

lwhorton 2016-06-27T15:13:46.000287Z

ugh, thatā€™s just sloppy on my part

lwhorton 2016-06-27T15:13:55.000288Z

too eager to get it in

rohit 2016-06-27T15:14:26.000289Z

for the minor issue - the js file produced includes react-addons-css-transition-group

rohit 2016-06-27T15:14:49.000290Z

you need to mark it as an external package in your webpack.config.boot.js

rohit 2016-06-27T15:15:07.000291Z

have a look at this exact line: https://github.com/bvaughn/react-virtualized/blob/master/webpack.config.umd.js#L19

rohit 2016-06-27T15:15:54.000293Z

so you'll have react-addons-css-transition-group: var React.addons.ReactCSSTransitionGroup [i think]

rohit 2016-06-27T15:16:01.000294Z

you should confirm this

lwhorton 2016-06-27T15:16:23.000296Z

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?

rohit 2016-06-27T15:16:46.000297Z

i agree. its kinda confusing

rohit 2016-06-27T15:17:02.000298Z

react-with-addons already includes ReactCSSTransitionGroup.

rohit 2016-06-27T15:17:13.000299Z

so you don't need to include it in the webpack build again

lwhorton 2016-06-27T15:18:05.000300Z

i see. but should my webpack then have an external react-with-addons instead of itā€™s current react?

lwhorton 2016-06-27T15:18:21.000301Z

technically it doesnā€™t depend on react, but the -with-addons version

rohit 2016-06-27T15:18:27.000302Z

@lwhorton: its compilcated .... as usual. šŸ˜›

rohit 2016-06-27T15:18:35.000303Z

you can't do that as I recently learned

rohit 2016-06-27T15:19:05.000304Z

best guide is the line I've posted above for the webpack config

rohit 2016-06-27T15:19:40.000305Z

i really hate the js whole packaging ecosystem. hate hate hate.

juhoteperi 2016-06-27T15:20:32.000306Z

^ Haha, I can agree

juhoteperi 2016-06-27T15:20:43.000307Z

I hate especially the react with-addons stuff

rohit 2016-06-27T15:21:00.000308Z

@juhoteperi: the sad truth is that no one does

juhoteperi 2016-06-27T15:21:12.000309Z

Would be much easier for us if the addons were separate package

rohit 2016-06-27T15:22:04.000310Z

I think the react people just expect everyone to use babel and webpack and they are building everything around those two.

rohit 2016-06-27T15:22:24.000311Z

so if you don't use those two tools for your entire process, you are out of luck

martinklepsch 2016-06-27T15:24:49.000313Z

In that context I\m sometimes a bid sad that we're so stuck on React as CLJS community

juhoteperi 2016-06-27T15:25:17.000314Z

Yeah, it has its cons and pros

rohit 2016-06-27T15:26:04.000315Z

thats true.

rohit 2016-06-27T15:26:15.000316Z

but react ecosystem is the best of the lot

rohit 2016-06-27T15:26:33.000317Z

and its still far for optimum

lwhorton 2016-06-27T15:26:49.000318Z

there are a bunch of alternative implementations of reactā€” everything from reactlite, to things like virtualdom/deku

lwhorton 2016-06-27T15:27:23.000319Z

it would be great if things like reagent were a little less tied to react, and instead focused on an implementation interface

rohit 2016-06-27T15:28:38.000320Z

@lwhorton: that would be ideal

rohit 2016-06-27T15:28:57.000321Z

byovd - bring your own virtual-dom

lwhorton 2016-06-27T15:29:05.000322Z

right^

lwhorton 2016-06-27T15:29:25.000323Z

and plugins could extend the subset of the interface, so you can extend to more implementation-specific hooks or whatever

rohit 2016-06-27T15:29:36.000324Z

true.

rohit 2016-06-27T15:29:59.000325Z

for some projects you need react for its rich ecosystem and backwards compatibility regarding browsers

rohit 2016-06-27T15:30:08.000326Z

and for some projects, you don't

lwhorton 2016-06-27T15:33:18.000329Z

and at 130kish, react is pretty intense compared to some lighter vdoms that are as small as 5k

lwhorton 2016-06-27T15:33:41.000330Z

i think riot.js was about ~5k last time i looked

rohit 2016-06-27T15:34:26.000331Z

there is preact as well. https://github.com/developit/preact

lwhorton 2016-06-27T15:34:38.000333Z

yeesh

rohit 2016-06-27T15:35:21.000334Z

@lwhorton: good luck trying to use it cljs. šŸ˜

rohit 2016-06-27T15:35:43.000336Z

i have no idea how to use es6 classes in cljs

lwhorton 2016-06-27T15:36:08.000337Z

that whole es6 class thing is just another can of wormsā€¦ i cant* believe they leaked classes into the spec

rohit 2016-06-27T15:37:03.000339Z

i actually don't know enough about it to comment.

lwhorton 2016-06-27T15:37:35.000340Z

thereā€™s some really good reading by this guy https://medium.com/@_ericelliott

lwhorton 2016-06-27T15:37:58.000342Z

if you get some free time and are at all interested in javascript, heā€™s got some really strong (but valid) opinions

rohit 2016-06-27T15:38:14.000343Z

sweet. thanks! :thumbsup::skin-tone-4:

rohit 2016-06-27T15:40:23.000344Z

@lwhorton: gotta bounce for the day. best of luck with the packaging.

lwhorton 2016-06-27T15:40:33.000345Z

have a good one

rohit 2016-06-27T15:40:41.000346Z

cheers. you too