Closed damassi closed 10 years ago
Thank you! I will try to merge this today.
:+1:
:+1:
@damassi , I am having a very frustrating time trying to bring the codebase under test using browserify. Can you point me to an example of a working test setup that uses browserify for the tests? (As I need to require
in react-cursor as a library)
I have spent a lot of time and got pretty close with karma, karma-bro, jasmine, but can't quite get things to work after spending a whole day on it. @danielmiladinov took a couple whacks at it too.
Sure thing. I'll take a look when I get home
Sent from my iPhone
On Oct 21, 2014, at 4:06 PM, Dustin Getz notifications@github.com wrote:
@damassi , I am having a very frustrating time trying to bring the codebase under test using browserify. Can you point me to an example of a working test setup that uses browserify for the tests? (As I need to require in react-cursor as a library)
— Reply to this email directly or view it on GitHub.
I know in many cases the debate between CommonJS and AMD is a strong one with valid points on both sides of the isle, but I felt that in the case of React one should stick with conventions, and the convention is generally CommonJS via Browserify and Webpack.
I've updated the library so that it now uses the
module.exports
idiom, and updated your grunt file to use Browserify. It simplifies things substantially, including removing the need for bower to handle external dependencies since those are now being pulled in through NPM.In the
dist
folder I've also included three new files:react-cursor.dev.js
-- This is a "full build", one that you can include inside of your html with all of the different vendor dependencies packaged inreact-cursor.js
-- This is an unminified distribution build that specifies, viaexternals
, that Underscore and React is not neededreact-cursor.min.js
-- This is a minified buildIn the latter two files above, one uses the library by pointing to the exports like so:
... or, if you plan on publishing to NPM, simply
I know this is an opinionated PR (so feel free to ignore!), but I do believe that by eliminating Bower and Require.js the project has been simplified quite a bit as well as made compatible for use with NPM.
Let me know if you'd like any updates to be made!