Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Webmodules - JSConf.ar 2014

November 29, 2014

Webmodules - JSConf.ar 2014


November 29, 2014

More Decks by tootallnate

Other Decks in Programming


  1. THERE’S SOME GUIDELINES… • Very small, focusing on a single

    task • Client-side bundling via browserify • Repository name matches npm package name • Add a README.md file • Add unit tests, with “cloud testing” enabled
  2. SMALL, FOCUSED • Must export a Function: module.exports • Helps

    enforce the small and focused philosophy • Example: https://github.com/webmodules/node-contains
  3. SMALL, FOCUSED • Cross-browser Polyfills • Remember to say focused

    though! • Example: https:// github.com/webmodules/ progress-event
  4. SMALL, FOCUSED • If a module has an inverse function,

    implement it as a separate module / repository • Example: https://github.com/webmodules/wrap-range and https://github.com/webmodules/unwrap-range wrapRange(‘b’) → unwrapRange(‘b’) →
  5. BROWSERIFY • Assume browserify will be used for client-side bundling

    • It’s possible that other bundlers like component or require.js might work in some cases, but untested
  6. GITHUB == NPM • Make it easy for users to

    find the repository • Basically leaves us at the 2nd level namespace, since most of the good single-word names are taken in the npm registry at this point
  7. ALWAYS ADD README.MD • Installation instructions • Usage example •

    API docs ( dox(1) ) • Travis-CI and Saucelabs build badges
  8. CLOUD TESTING • Zuul • Use it to run Mocha

    unit tests in the browser • npm test command runs zuul • https://github.com/defunctzombie/zuul
  9. CLOUD TESTING • Travis-CI • Use it to run SauceLabs

    browsers in the cloud • Set up GitHub commit hooks to test every commit • https://github.com/defunctzombie/zuul/wiki/Travis-ci
  10. CLOUD TESTING • SauceLabs • Zuul is designed to integrate

    with Saucelabs • Somewhat annoying… you have to create a new SauceLabs account for every module created