Boilerplate-Javascript-Library
A boilerplate for a generic javascript library which compiles for use as an ES6 module or UMD (for legacy apps)
Webpack / Babel / Jest / Sass
Requirements
- node > 6.0.0
- yarn (or npm latest) > 0.10.0
Installation
yarn install
Usage
ES6
// Static functionconst staticFunction = // Create new instance of classconst instance = const classFunction = instance
Node
var BoilerplateJavascriptLibrary = // Static functionvar staticFunction = BoilerplateJavascriptLibrary // Create new instance of classvar instance = var classFunction = instance
UMD
// Imported to global objectvar instance output // Static function with default paramoutput = BoilerplateJavascriptLibrary // Static function with parameteroutput = BoilerplateJavascriptLibrary // Class with default constructor parameterinstance = output = instance // Class with constructor parameterinstance = ', 'output = instance
Development
# Development yarn start
Testing
# Run test normal yarn test # Run watcher yarn watch
Releasing
# Compile AMD yarn compile:amd # Compile UMD yarn compile:umd # Compile examples yarn compile:examples # Create new versioned release yarn release
Documentation for release library https://github.com/conventional-changelog/standard-version
Commit message format https://conventionalcommits.org/
Documentation
You can see the legacy UMD module in use in examples/index.html
TODO
- Improve handling for styles in es6