Rollup starter kit for creating libraries (Input: ES6, Output: UMD, CommonJS, ESM)
- Rollup 2.x.x
- Babel 7
- ES6 as a source
- Exports in UMD, CommonJS, ESM formats
- ES6 test setup with Jest
- Linting with ESLint
- Basic Travis configuration
- Open
rollup.config.js
and change the value ofLIBRARY_NAME
variable with your library's name. - Open
package.json
and change the following properties with your library's equivalentname
version
description
main
module
browser
repository
author
license
bugs
homepage
- Run
npm install
to install the library's dependencies.
- Having all the dependencies installed run
npm run dev
. This command will generateUMD
(unminified),CommonJS
andESM
modules under thedist
folder. It will also watch for changes in source files to recompile.
- Having all the dependencies installed run
npm run build
. This command will generate the same modules as above and one extra minifiedUMD
bundle for usage in browser.
npm run build
- Produces production version of library modules underdist
folder.npm run dev
- Produces a development version of library and runs a watcher to watch for changes.npm run test
- Runs the tests.npm run test:watch
- Runs the tests in watch mode for development.npm run test:coverage
- Runs the tests and provides with test coverage information.npm run lint
- Lints the source code with ESlint.npm run prepare
- Run both BEFORE the package is packed and published, on local npm install without any arguments, and when installing git dependencies.npm run clean
- Deletesdist
andcoverage
folders.
- By default all source code is located under the
src
folder. - Be default
dist
folder is excluded from source control but included for npm. You can change this behavior by not excluding this folder inside the.gitignore
file. - The starter kit assumes that all tests are located under
test
folder with.spec.js
extension.