Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Browserify CommonJS Babel work

Ian Wehrman edited this page Jun 12, 2015 · 1 revision

Here is all the work I've done to get things running, besides hand de-amd-fying code

SPACES

  • Get rid of JSON.parse calls, Browserify parses them for us
  • Get rid of controllerPromise in menu and tool actions, I hacked around this by exposing FluxController in window
  • All require("adapter/ps") paths need to be in format require("adapter").ps
  • In FluxController, we check to see if actionPromise instanceof Promise, I changed that to actionPromise.then instanceof Function
  • Remove all jsx! prefixes in require() calls
  • For React.addons , had to require separately for addons (shared/Button.jsx)
  • Map tinycolor to tinycolor2 (add in browser: of packjage.json)
  • all require("EventEmitter")s need to be replaced by require("events").EventEmitter as wolfy returns an object with ctor inside
  • Remove all "i18n! prefixes, and require roots/strings.js from nls/strings.js

Test the future

  • Checkout barkin/browserify branches on both adapter and design
  • npm install in design folder
  • grunt compile

ADAPTER CHANGES:

  • Set node to true in .jshintrc
  • Add dependencies in package.json to wolfy-eventemitter, bluebird and lodash
  • Add these lines in package.json (IMPORTANT FOR BROWSERIFY TO WORK)
"browserify": {
    "transform": [
      "deamdify"
    ]
  },
  "browser": {
    "eventEmitter": "wolfy-eventemitter"
  }
  • add index.js files to each folder requiring all files
  • Suffix all require("eventEmitter")s by .EventEmitter
Clone this wiki locally