-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Independent build tasks dependent on the performed changed (build.dev) #851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Recently, while using the seed, I had to create a task which execution takes 5s. This is a lot for dev build since it blocks everything else. I thought what I can do and with the current stateless task management (which is great but a bit limiting) there was no right way to approach. I was thinking that we can have a global state, which mutates in export function watch(taskname: string) {
return function () {
let paths:string[]=[
join(Config.APP_SRC,'**')
].concat(Config.TEMP_FILES.map((p) => { return '!'+p; }));
plugins.watch(paths, (e: any) => {
Config.getPluginConfig('files-changed').push(e.path);
runSequence(taskname, () => {
Config.getPluginConfig('files-changed').length = 0;
notifyLiveReload(e);
});
});
};
} Later in the individual tasks, based on the file type we can: // build.js.dev
export = (done: any, filesChanged: string[]) => {
if (anyOfTheFilesIsTs...) {
return gulp.src(...)
.pipe(ts())
.pipe(gulp.dest(...));
} else {
done();
}
}; What do you think? We can extend this even further by exporting not only a single function but a task object which processes only tasks of given type: const task: ITask = {
precondition(files: string[]) {
// decide if it should be activated
},
processFiles: [/\.ts$/],
run(done) {
// ...
}
}; type FileType = RegExp;
interface ITask {
precondition(files: string[]);
processFiles: FileType[];
run(done: any): GulpStream | any;
} @ludohenin @TheDonDope what do you think? PS: Probably it'll be better to move the list of changed files outside PS2: It'll be better to move the filtering logic in the task runner in PS3: By default given task will be executed in all cases. |
PR here #1443. |
We already commented out the
clearn.dev
task so it might be appropriate to implement the following behavior for speeding-up the development build:dist/dev
directory.dist/dev
.This way we will achieve some performance improvements, however, their impact should not be as dramatical as disabling type checking or using gulp-cache as described here.
Based on suggestion by @mpetkov #645.
// @ludohenin @NathanWalker @d3viant0ne
The text was updated successfully, but these errors were encountered: