boilerplate-javascript-library
v0.1.7
Published
A boilerplate for a generic javascript library which compiles for use as an ES6 module or UMD (for legacy apps)
Downloads
19
Readme
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
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')
Node
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')
UMD
// 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
# 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