@kpdecker/linoleum
v2.2.0
Published
Shared javascript build and testing infrastructure
Downloads
13
Readme
Linoleum
Shared javascript build and testing infrastructure
Base project to avoid duplicating infrastructure boilerplate across javascript projects. Provides linting, es6, code coverage, with source maps all running in node, browser, or electron environments.
- For Node, see linoleum-node.
- For Webpack browser builds, see linoleum-webpack.
- For Electron, see linoleum-electron.
That's right I've got a floor.
Usage
Within Gulpfile.js
:
// Init global state
var Linoleum = require('@kpdecker/linoleum');
// Include optional linoleum tasks
require('@kpdecker/linoleum-node');
require('@kpdecker/linoleum-webpack');
require('@kpdecker/linoleum-electron');
Global APIs:
WATCHING
: Set to true if the build is in watch mode.SOURCE_FILES
: Glob representing source files. May be overridden.TEST_FILES
: Glob representing test files. May be overridden.BUILD_TARGET
: Path that build artifacts will be output to. May be overridden.COVERAGE_TARGET
: Path that coverage reports will be output to. May be overridden.jsFiles
: Helper used to generate the final list js files globtestFiles
: Helper used to generate the final list test files globwatch
: Helper utility to watch and immediately run a particular command on a set of files:Linoleum.watch(Linoleum.SOURCE_FILES, 'cover');
Will create
watch:cover
task.Accepts an option 3rd argument
options
, which may define:setup
: Task that is called once prior to the first exec of the watched task.onChange
: Called prior to exec with an array of the changes that occurred to trigger this cycle.
linoleum/tasks/clean
Defines the clean
and clean:always
task which will remove all build and coverage output from the project. The clean
task will only run once in watch mode, while the clean:always
task will run on each invocation.
linoleum/tasks/lint
Defines the lint
task which will lint all source and test files.
linoleum/tasks/cover
Defines:
cover:untested
task which runs empty coverage report to ensure that untested files are included incover:report
.cover:report
task which combines raw data from the other coverage tasks and asserts coverage.
Common issues
Node Compile Issues
Newer versions of Node (5+, potentially earlier) may run into native compiler errors under Travis due to older versions of the C++ compiler. This can be resolved via this config:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
env:
- CXX=g++-4.8