MDL-61460 Grunt: Make startup tasks configurable by tasks

This commit is contained in:
Andrew Nicols 2021-03-19 12:36:54 +08:00 committed by Adrian Greeve
parent 341578bfde
commit 2f2ecdae4a
5 changed files with 13 additions and 4 deletions

View File

@ -85,5 +85,8 @@ module.exports = grunt => {
},
});
// Add the 'gherkinlint' task as a startup task.
grunt.moodleEnv.startupTasks.push('gherkinlint');
return handler;
};

View File

@ -126,6 +126,9 @@ module.exports = grunt => {
},
});
// Add the 'js' task as a startup task.
grunt.moodleEnv.startupTasks.push('js');
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).

View File

@ -34,10 +34,8 @@ module.exports = grunt => {
} else if (grunt.moodleEnv.inAMD) {
grunt.task.run('amd');
} else {
// Run them all!.
grunt.task.run('css');
grunt.task.run('js');
grunt.task.run('gherkinlint');
// Run all of the requested startup tasks.
grunt.moodleEnv.startupTasks.forEach(taskName => grunt.task.run(taskName));
}
};

View File

@ -29,4 +29,7 @@ module.exports = grunt => {
// Load the SASS tasks.
require('./sass')(grunt);
// Add the 'css' task as a startup task.
grunt.moodleEnv.startupTasks.push('css');
};

View File

@ -246,6 +246,8 @@ module.exports = function(grunt) {
require(path.resolve(`./.grunt/tasks/${name}.js`))(grunt);
};
// Startup tasks.
grunt.moodleEnv.startupTasks = [];
// Add Moodle task configuration.
addTask('gherkinlint', grunt);