Title here
Summary here
_dev
and _package
to add new tasks_dev
is executed on grunt serve
_package
is executed on grunt package
Explanation
grunt package
command is used by Dana build platform to generate release ready application.
Do not add task based on fixed index, find the index of the task just before.
WRONG :
grunt.registerTask("_dev", function () {
// Get tasks
let tasks = this.options().tasks;
tasks.splice(12, 0, 'copy:lightningjs');
// Run tasks
grunt.task.run(tasks);
});
GOOD :
grunt.registerTask("_dev", function () {
// Get tasks
let tasks = this.options().tasks;
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
// Run tasks
grunt.task.run(tasks);
});
Do not add task based on profile naming but based on profile flags.
WRONG :
grunt.registerTask("_dev", function () {
// Get tasks
var tasks = this.options().tasks;
let profile = grunt.file.readJSON(grunt.config("resolveConfig.options.resolvedConfigFilePath"));
if (profile.includes("lightning") {
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
}
// Run tasks
grunt.task.run(tasks);
});
GOOD :
grunt.registerTask("_dev", function () {
// Get tasks
var tasks = this.options().tasks;
let profile = grunt.file.readJSON(grunt.config("resolveConfig.options.resolvedConfigFilePath"));
if (profile.isLightning) {
tasks.splice(tasks.indexOf('bundle'), 0, 'copy:lightningjs');
}
// Run tasks
grunt.task.run(tasks);
});