NPM library boilerplate using Rollup, ES6 (with Babel), ESLint, Mocha
MIT License
NPM library boilerplate using Rollup, ES6 (with Babel), ESLint, Mocha
Library boilerplate using rollup for bundling, babel for transpiling to ES5, ESlint for linting and mocha/chai/sinon stack for tests that makes it easy and fast to make your own NPM plugin for use both in Node.js and browser environment.
This repo should be considered deprecated and is not maintained anymore.
I strongly recommend using https://github.com/hodgef/js-library-boilerplate.
rm -rf .git
command)library-boilerplate
and in rollup.config.js
in package.json to name of your libraryYou can import export whatever you want using es2015 default or named exports as you need
// src/index.js
import myCoolLib from './myCoolLib.js';
export const somethingElse = myCoolLib.somethingElse;
export default myCoolLib;
// then the use of this library
import myCoolLib, { somethingElse } from 'nameOfMyCoolLib';
npm i
npm run lint
Tests should be added in test
directory
npm run test
It will be done automatically before npm publish to prevent you from publishing library without bundled files or out-dated bundle
npm run build
This will create lib directory with UMD and ES2015 versions of minified bundles
There is very simple circle.yml configuration file for CircleCI (ver 2). Feel free to use it or just remove it.
It seems that package-lock mechanism is still broken (e.g. https://github.com/npm/npm/issues/17091 among others). I had many issues with it (including strange changes in package-lock every time I run npm i
) so I decided to just stick to save-exact
setting for now
You can modify .babelrc file to change, among other things, target browsers (see babel-preset-env documentation to learn more)
There are some library boilerplates out there but they have some or all of the following issues:
Yes and you should definitely check them out:
There are at least 3 options: