Commit 946cd548 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] simplify tas runner management

parent da21d421
......@@ -22,27 +22,44 @@ module.exports = class Css extends Task {
*/
async run(_subTask = null) {
if (_subTask) {
const files = await globby([
`${this._path}/${this._config.directories.sass}/**/*.scss`
].concat(this._config.css.excludeFromQa));
if (_subTask === 'qa') {
files.forEach(file => {
this._qa(file);
});
this._runQa();
} else if(_subTask === 'compile') {
this._runCompile();
} else {
this._logTaskNotDefined(`css:${_subTask}`);
}
} else {
const files = await globby([
`${this._path}/${this._config.directories.sass}/*.scss`,
'!**/_*.scss'
]);
files.forEach(file => {
this._compile(file, this._getOutputPath(file));
});
this._runQa();
this._runCompile();
}
}
/**
* Kicks off the compile task
*/
async _runCompile() {
const files = await globby([
`${this._path}/${this._config.directories.sass}/*.scss`,
'!**/_*.scss'
]);
files.forEach(file => {
this._compile(file, this._getOutputPath(file));
});
}
/**
* Kicks off the QA task
*/
async _runQa() {
const files = await globby([
`${this._path}/${this._config.directories.sass}/**/*.scss`
].concat(this._config.css.excludeFromQa));
files.forEach(file => {
this._qa(file);
});
}
/**
* Returns the name of the output file
*
......
......@@ -17,25 +17,44 @@ module.exports = class Js extends Task {
*/
async run(_subTask = null) {
if (_subTask) {
const files = await globby([
`${this._path}/${this._config.directories.javascriptSrc}/**/*.js`,
'!**/*.min.js'
].concat(this._config.js.excludeFromQa));
// if _subTask is set, just execute that one task
if (_subTask === 'qa') {
this._qa(files);
this._runQa();
} else if(_subTask === 'compile') {
this._runCompile();
} else {
this._logTaskNotDefined(`js:${_subTask}`);
}
} else {
const files = await globby([
`${this._path}/${this._config.directories.javascriptSrc}/*.js`
]);
files.forEach(file => {
this._compile(file, this._getOutputPath(file));
});
// otherwise execute everything
this._runQa();
this._runCompile();
}
}
/**
* Kicks off the compile task
*/
async _runCompile() {
const files = await globby([
`${this._path}/${this._config.directories.javascriptSrc}/*.js`
]);
files.forEach(file => {
this._compile(file, this._getOutputPath(file));
});
}
/**
* Kicks off the QA task
*/
async _runQa() {
const files = await globby([
`${this._path}/${this._config.directories.javascriptSrc}/**/*.js`,
'!**/*.min.js'
].concat(this._config.js.excludeFromQa));
this._qa(files);
}
/**
* Returns the name of the output file
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment