elidoran / cosmos-browserify

Browserify npm modules for client side in Meteor packages
MIT License
78 stars 12 forks source link

Add support for app.browserify.options.json #7

Closed stubailo closed 9 years ago

stubailo commented 9 years ago

You can now create a file to pass options to browserify, including transforms. The transforms can be loaded from NPM in the same way as other dependencies.

It's going to be used in the new React in Meteor guide, preview here: http://react-in-meteor.readthedocs.org/en/latest/client-npm/

TODO

stubailo commented 9 years ago

Sample options file to use global React when require("react") is called.

(helpful for using React Router with a global React)

{
  "transforms": {
    "exposify": {
      "global": true,
      "expose": {
        "react": "React"
      }
    }
  }
}
stubailo commented 9 years ago

@elidoran I think this is ready now. It's actually pretty hard to write automated tests for this feature, but I ran some apps to verify that things work. If you want, I can put in some more effort to write better tests, but they will probably be in the form of a second package that uses this one (that way we can test the build plugin more directly)

elidoran commented 9 years ago

I've committed changes on top of your PR.

  1. I added a test for options with transforms
  2. I added in the exorcist module to extract the source map and give it to CompileStep.
  3. added a note in the README about adding the options file via api.addFiles()

I tested these in my example app as well.

I haven't published it as 0.4.0 yet. Please take a look.

stubailo commented 9 years ago

@elidoran looks awesome. Thanks for cleaning everything up and adding tests! Excited to use these new features.

stubailo commented 9 years ago

@elidoran please let me know when you publish the new version!

elidoran commented 9 years ago

@stubailo published as 0.4.0

stubailo commented 9 years ago

Stellar. Thanks for the quick turnaround.