0.0.6 • Published 5 years ago
harnosoft-build v0.0.6
Harnosoft-build
Npm module that helps you build your project
Install
npm install harnosoft-build
Usage
Create gulpfile.js in your project
// you should have gulp@4.0.0 in devDependencies
const gulp = require('gulp')
const Build = require('harnosoft-build').default
// here you can overwrite default config values
const config = {
unitTestsCoverage: {
thresholds: {
lines: 90,
functions: 90,
branches: 90,
statements: 90
}
}
}
const build = new Build(config)
build.initGulpTasks(gulp)
API
new Build(config)
- config - object with user config values Create new build instance with its own configuration
build.initGulpTasks(gulp)
- gulp - instance of gulp@4.0.0 Inits all available gulp tasks
Default config values
app:
src: 'app/'
codeStyle:
files: 'app/**/*.js'
watchFiles: 'app/**/*.js'
unitTests:
files: 'app/**/*.test.js'
watchFiles: 'app/**/*.js'
unitTestsCoverage:
jsFiles: 'app/**/*.js'
testFiles: 'app/**/*.test.js'
watchFiles: 'app/**/*.js'
dest: 'coverage/'
thresholds:
statements: 80
branches: 80
functions: 80
lines: 80
swagger:
startFile: 'app/start.js'
watchFiles: 'app/**/*.js'
compile:
files:
withBabel: 'app/**/*.js'
noBabel: 'app/**/!(*.js)'
dest: 'compiled/'
jsdoc:
src: 'app/'
watchFiles: 'app/**/*.js'
dest: 'jsdocs/'
threshold: 90
filesGlobs:
js: '*.js'
test: '*.test.js'
nonJs: '!(*.js)'
nonTestJs: '!(*.test).js'
Gulp tasks available
- 'all' - task runs code-style and unit-tests tasks.
- 'compile', 'c' - task compiles an app using babel.
- 'code-style', 'cs' - task checks JavaScript code with the standard syntax on files with .js extension.
- 'code-style-fail-safe', 'cs-fail-safe' - task the same as code-style, but it doesn't exit with an error code, in case of any code style errors
- 'code-style-watch', 'csw' - task watches on files (default with .js extension) and executes code-style-fail-safe task.
- 'unit-tests', 'ut' - task runs tests on files with .test.js endings using mocha.
- 'unit-tests-fail-safe', 'ut-fail-safe' - task the same as unit-tests, but it doesn't exit with an error code, in case of any task fail.
- 'unit-tests-watch', 'utw' - task watches on files (default with .js extension) and executes unit-tests-fail-safe task.
- 'unit-tests-coverage', 'utc' - task validates tests coverage on files with .test.js endings using nyc.
- 'unit-tests-coverage-fail-safe', 'utc-fail-safe' - task the same as unit-tests-coverage, but it doesn't exit with an error code, in case of coverage fail.
- 'unit-tests-coverage-watch', 'utcw' - task watches on files (default with .js extension) and executes unit-tests-coverage-fail-safe task.
- 'swagger', 'sg' - task validates swagger documentation.
- 'swagger-fail-safe', 'sg-fail-safe' - task the same as swagger, but it doesn't exit with an error code, in case of any error in docs.
- 'swagger-watch', 'sgw' - task watches on files (default with .js extension) and executes swagger-fail-safe task.
- 'jsdoc', 'j' - task generates and tests js docs with esdoc npm module.
- 'jsdoc-fail-safe', 'j-fail-safe' - task the same as jsdoc, but it doesn't exit with an error code, in case of any esdoc errors.
- 'jsdoc-watch', 'jw' - task watches on files (default with .js extension) and executes jsdoc-fail-safe task.