A boilerplate for a generic javascript library which compiles for use as an ES6 module or UMD (for legacy apps)
Webpack / Babel / Jest / Sass
- node > 6.0.0
- yarn (or npm latest) > 0.10.0
yarn install
import { getOutput, Module } from 'boilerplate-javascript-library'
// Static function
const staticFunction = getOutput('Hello', 'World')
// Create new instance of class
const instance = new Module()
const classFunction = instance.get('Hello', 'World')
var BoilerplateJavascriptLibrary = require('boilerplate-javascript-library')
// Static function
var staticFunction = BoilerplateJavascriptLibrary.getOutput('Hello', 'World')
// Create new instance of class
var instance = new BoilerplateJavascriptLibrary.Module()
var classFunction = instance.get('Hello', 'World')
// Imported to global object
var instance, output
// Static function with default param
output = BoilerplateJavascriptLibrary.getOutput('Hello', 'World')
// Static function with parameter
output = BoilerplateJavascriptLibrary.getOutput('Hello', 'World', ', ')
// Class with default constructor parameter
instance = new BoilerplateJavascriptLibrary.Module()
output = instance.get('Hello', 'World')
// Class with constructor parameter
instance = new BoilerplateJavascriptLibrary.Module(', ')
output = instance.get('Hello', 'World')
# Development
yarn start
# Run test normal
yarn test
# Run watcher
yarn watch
# 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/
You can see the legacy UMD module in use in examples/index.html
- Improve handling for styles in es6