Boilerplate for Creating ES6 NPM Modules


#1

I just wanted to pass on a gem that I found while creating a new NPM module.

Using ES6 in NPM modules can be quite a pain but this will setup

  • Babel
  • Mocha
  • ESLint
  • Travis (though I used Codeship)
  • Istanbul (code coverage checker)
  • and of course an npm build and prepublish commands to compile it before submitting to NPM.

https://github.com/Travelport-Ukraine/npm-module-boilerplate

Using NPM for private modules is going to be a really big win moving forward… this allows for really easy sharing across multiple apps


#2

This is cool. Note that the recommended babelrc is a little different, though, for Meteor. That thread also mentions a few quirks where things will be a little different from standard Meteor behavior.

  • you can’t use absolute import paths
  • any global declarations will fail in mocha (although you can set window.myGlobal inside a Meteor.isClient block).
  • you can’t do nested imports

#3

Ah great to know! thanks!! Perhaps someone can make a Meteor fork :smiley:


#4

I made one for the Meteor app itself, but I didn’t put code coverage in for the time being. https://github.com/trajano/meteor-boilerplate The other branches are for angular2, react and plain blaze. Though I did add JSDoc.