-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
list tasks as json #584
Comments
You would still have the problem even if it were JSON. I think gulp should just disable stdio of the gulpfile when |
Thanks for the quick answer.
If json text would occupy a single line, then it would be possible to iterate over lines and check whether a line is the needed one.
That would be nice and backward compatible. |
One more idea: insert two unique lines right before and after task name lines, like:
Also that would allow IDE to forcibly terminate node process in case of #583. |
Do you have a case where this actually happens? If you pass a task list then your gulpfile will not be executed, which means nothing should get logged. If you have logging outside of your tasks you should move it. I will reopen this if you have a legit usecase |
Yes, the case is logging outside tasks. Maybe some initialization logic could be placed there. It isn't guaranteed that it won't happen in users' gulpfiles. |
Why not create a task to write a file in a non-human readable format? i.e. gulp.task('log:tasks.json', function(){
var ws = fs.createWriteStream('tasks.json');
var tasks = gulp.tasks;
ws.write(
JSON.stringify(tasks, function(key, value){
if(typeof value === 'function')
return ''+value;
else
return value;
}, ' ')
);
}); |
not sure how this would happen since the task listing happens on |
JFYI: IDE uses |
About |
Yep, this should work better. But then, if you can't have a handle on the same var gulp = require('gulp');
var timer;
gulp.on('task_stop', function(e){
if(timer)
clearTimeout(timer);
timer = setTimeout(function(){
if(e.task !== 'log:tasks.json'){
gulp.start(['log:tasks.json']);
}
});
}); |
in gulp4, we are adding a |
@stringparser Sorry, I'm not sure the approach with plugin will work, because the plugin should be required from the user's gulpfile, right? Also in order to run |
@phated Thanks for letting me know. I've checked out gulp4. It turned out that IDE integration still works, but passing |
@phated Did you mean |
@segrey --tasks still works if the gulpfile and local gulp are updated to reflect breaking changes but we are also exposing |
Note, the liftoff + requiring a gulpfile dance will still be needed for |
@phated My apologies. You're right, |
I think --json should be added in gulp 4 to output |
Guys, I think I need to provide more details why using
|
@segrey I already told you I would add it 😕 please read my previous comments before posting more - I understand exactly what you are saying and I agree with you |
@contra I did what you asked me in #472 (comment) |
@segrey Sorry for not being clear - I am putting |
Added in 4.0 branch. Try it out. Flag is |
Cool, thanks! Example: var gulp = require('gulp');
gulp.task('a4', function () {});
gulp.task('a3', gulp.series('a4'));
gulp.task('a2', gulp.series('a3', 'a4'));
gulp.task('a1', gulp.series('a2', 'a3')); Listing all dependencies deep inside may lead to exponential growth of output. BTW, gulp support is available in WebStorm 9 EAP, 138.1988. |
tasks-json was added but the issue not closed for some reason. Closing this. |
Now gulp tasks could be listed using
--tasks
or--tasks-simple
arguments.Passing
--tasks
argument lists tasks in a human readable format that cannot be easily parsed in code (gulp integration in IDE).Passing
--tasks-simple
argument lists one task per line, but has the only downside: any output other then task will be considered to be a task name. For example, placingconsole.log('hello')
as the top level in a gulpfile will result in havinghello
task.Is it possible to add a new argument that will output tasks as json? Thanks.
The text was updated successfully, but these errors were encountered: