Fork me on GitHub
#cljsjs
<
2016-06-27
>
rohit10:06:01

@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

rohit10:06:36

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

rohit13:06:34

@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

rohit13:06:20

i've tested this one and I know it works

lwhorton13:06:34

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

lwhorton13:06:08

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

rohit13:06:50

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

rohit13:06:09

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

lwhorton13:06:36

material-ui

rohit14:06:00

good point.

rohit14:06:28

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

lwhorton14:06:29

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

rohit14:06:56

On commit to the master branch, it happens automatically

rohit14:06:09

so you don't need to worry about it

martinklepsch14:06:35

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

lwhorton14:06:52

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

rohit14:06:25

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

rohit14:06:42

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

lwhorton14:06:19

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

rohit14:06:39

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

rohit14:06:10

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

lwhorton14:06:29

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.

lwhorton14:06:50

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

lwhorton14:06:35

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

lwhorton14:06:02

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

martinklepsch14:06:06

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

rohit14:06:27

@lwhorton: exactly what @martinklepsch is saying

lwhorton14:06:37

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

martinklepsch14:06:44

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

lwhorton14:06:53

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.

lwhorton14:06:47

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

rohit14:06:12

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

martinklepsch14:06:54

@lwhorton: you mean in section 6?

lwhorton14:06:42

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

lwhorton14:06:27

wow iā€™m stoopid.

lwhorton14:06:34

you basically do say that ...

lwhorton14:06:42

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

martinklepsch14:06:38

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

lwhorton14:06:55

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

rohit15:06:37

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

lwhorton15:06:52

not a problem at all

rohit15:06:27

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

rohit15:06:26

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

lwhorton15:06:46

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

lwhorton15:06:55

too eager to get it in

rohit15:06:26

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

rohit15:06:49

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

rohit15:06:54

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

rohit15:06:01

you should confirm this

lwhorton15:06:23

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?

rohit15:06:46

i agree. its kinda confusing

rohit15:06:02

react-with-addons already includes ReactCSSTransitionGroup.

rohit15:06:13

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

lwhorton15:06:05

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

lwhorton15:06:21

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

rohit15:06:27

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

rohit15:06:35

you can't do that as I recently learned

rohit15:06:05

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

rohit15:06:40

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

juhoteperi15:06:32

^ Haha, I can agree

juhoteperi15:06:43

I hate especially the react with-addons stuff

rohit15:06:00

@juhoteperi: the sad truth is that no one does

juhoteperi15:06:12

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

rohit15:06:04

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

rohit15:06:24

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

martinklepsch15:06:49

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

juhoteperi15:06:17

Yeah, it has its cons and pros

rohit15:06:04

thats true.

rohit15:06:15

but react ecosystem is the best of the lot

rohit15:06:33

and its still far for optimum

lwhorton15:06:49

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

lwhorton15:06:23

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

rohit15:06:38

@lwhorton: that would be ideal

rohit15:06:57

byovd - bring your own virtual-dom

lwhorton15:06:25

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

rohit15:06:59

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

rohit15:06:08

and for some projects, you don't

lwhorton15:06:18

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

lwhorton15:06:41

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

rohit15:06:21

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

rohit15:06:43

i have no idea how to use es6 classes in cljs

lwhorton15:06:08

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

rohit15:06:03

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

lwhorton15:06:35

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

lwhorton15:06:58

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

rohit15:06:14

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

rohit15:06:23

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

lwhorton15:06:33

have a good one

rohit15:06:41

cheers. you too