Skip to content
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

Gulp task displayName is not recognized / supported #204

Open
doze opened this issue Sep 5, 2023 · 1 comment
Open

Gulp task displayName is not recognized / supported #204

doze opened this issue Sep 5, 2023 · 1 comment

Comments

@doze
Copy link

doze commented Sep 5, 2023

Display names for gulp tasks does not seem to be supported by the Task Explorer.

If you set a display name to a Gulp task in the gulpfile:

const buildZip = series(build, zip);
buildZip.displayName = "build-zip";

Using gulp -T shows tasks with the defined display name and they can be run with that name (only):

gulp -T  
[14:55:20] Tasks for E:\Project\gulpfile.js
[14:55:20] ├─┬ default
[14:55:20] │ └─┬ <series>
[14:55:20] │   ├─┬ <series>
[14:55:20] │   │ ├─┬ <series>
[14:55:20] │   │ │ ├─┬ <series>
[14:55:20] │   │ │ │ ├── clean
[14:55:20] │   │ │ │ └─┬ <parallel>
[14:55:20] │   │ │ │   ├─┬ <parallel>
[14:55:20] │   │ │ │   │ ├── copy-files
[14:55:20] │   │ │ │   │ └── copy-redist
[14:55:20] │   │ │ │   └── webpack
[14:55:20] │   │ │ └── zip
[14:55:20] │   │ └── install
[14:55:20] │   └── watch
[14:55:20] ├─┬ build-install
[14:55:20] │ └─┬ <series>
[14:55:20] │   ├─┬ <series>
[14:55:20] │   │ ├─┬ <series>
[14:55:20] │   │ │ ├── clean
[14:55:20] │   │ │ └─┬ <parallel>
[14:55:20] │   │ │   ├─┬ <parallel>
[14:55:20] │   │ │   │ ├── copy-files
[14:55:20] │   │ │   │ └── copy-redist
[14:55:20] │   │ │   └── webpack
[14:55:20] │   │ └── zip
[14:55:20] │   └── install
[14:55:20] ├── watch
[14:55:20] ├─┬ build-zip
[14:55:20] │ └─┬ <series>
[14:55:20] │   ├─┬ <series>
[14:55:20] │   │ ├── clean
[14:55:20] │   │ └─┬ <parallel>
[14:55:20] │   │   ├─┬ <parallel>
[14:55:20] │   │   │ ├── copy-files
[14:55:20] │   │   │ └── copy-redist
[14:55:20] │   │   └── webpack
[14:55:20] │   └── zip
[14:55:20] ├── clean
[14:55:20] ├─┬ build
[14:55:20] │ └─┬ <series>
[14:55:20] │   ├── clean
[14:55:20] │   └─┬ <parallel>
[14:55:20] │     ├─┬ <parallel>
[14:55:20] │     │ ├── copy-files
[14:55:20] │     │ └── copy-redist
[14:55:20] │     └── webpack
[14:55:20] ├─┬ zip-install
[14:55:20] │ └─┬ <series>
[14:55:20] │   ├── zip
[14:55:20] │   └── install
[14:55:20] ├── webpack
[14:55:20] ├── lint
[14:55:20] └── lint-fix

But task explorer still shows the tasks under gulp with the function names, not with the display names:
gulp

And it also runs the task with the function name, not the display name, so gulp complains it does not find the task:

*  Executing task: npx gulp buildZip 

[15:05:20] Using gulpfile E:\Project\gulpfile.js
[15:05:20] Task never defined: buildZip
[15:05:20] To list available tasks, try running: gulp --tasks

 *  The terminal process "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command npx gulp buildZip" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Would it be possible to get the displayName attribute supported for gulp tasks?

@doze
Copy link
Author

doze commented Sep 5, 2023

Okay, I found out that I can solve this for now by modifying how the exports are done.

So instead of this:

exports.buildZip = buildZip;

Do this if you have changed the display name of the task:

exports['build-zip'] = buildZip;

But I guess Task Explorer could still look up the display name for the export and use that if configured (Gulp Tasks extension works with the display names without changing the export).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant