Use this boilerplate to initiate an open source ES6 module for npm. It features Yarn, ESlint and Babel. The boilerplate is React-ready, which means that Babel and ESlint already understand JSX files.
- Download the boilerplate
- If your project directory is still empty:
$ git clone git@github.com:lifelynl/npm-module-es6-boilerplate.git .
$ rm -rf .git
- If your project directory is not empty:
- Download the boilerplate as a zip
- Extract the zip to your project directory.
- If your project directory is still empty:
- Update the
env
object in .eslintrc.json, to specify your targeted JavaScript environment(s). - [Optional] Update .babelrc and .eslintrc.json if you are not going to use React.
- [Optional] Remove React-related node modules if you are not going to use React.
Testing your npm module is as easy as running:
$ yarn compile
This will create a /lib directory containing the compiled module.
Bump the version semantically in package.json, then publish your npm package using:
$ yarn publish
You don't have to run $ yarn compile
first.
Because you are about to contribute to the wide world of open source. 👍