nickdodd79 / vscode-gulptasks

A gulp task visualization and execution extension for Visual Studio Code
MIT License
8 stars 6 forks source link

Support local gulp #9

Closed NN--- closed 6 years ago

NN--- commented 6 years ago

Add support for locally installed gulp inside node_modules/.bin/gulp

nickdodd79 commented 6 years ago

Hi,

This is supported in a new version of the extension I am hoping to release shortly.

If I get chance I might be able to back port to this version.

Watch this space....

Nick.

nickdodd79 commented 6 years ago

Hi @NN---

I have put a change in the current version to now use a gulp install in node_modules. Check out version 0.0.12.

Nick.

NN--- commented 6 years ago

It works, but I need gulp to run in terminal same way npm or yarn extensions can do:

Auto detecting gulp for folder abc failed with error: Error: Command failed: node_modules\.bin\gulp.cmd --tasks-simple --no-color
'node' is not recognized as an internal or external command,
operable program or batch file.

Similar to:

"npm.runInTerminal": true,
"yarn.runInTerminal": true,
nickdodd79 commented 6 years ago

Hi @NN---

I have had a crack at running the tasks in a terminal -- v0.0.13.

Hopefully it covers what you need. There is a runInTerminal setting that defaults to false. Set that to true and you should be able to do the terminal stuff.

Nick.

NN--- commented 6 years ago

I set "gulptasks.runInTerminal": true but still doesn't run in terminal and cannot find node.

nickdodd79 commented 6 years ago

Hmm. Have you tried restarting vscode? I have been using it for the last hour or so in both terminal and output. Need to try and work out whats different between out environments.

NN--- commented 6 years ago

I tried, didn't help. I have node defined locally for terminal:

"terminal.integrated.env.windows": {
        "PATH": "c:\\node\\"
    },
nickdodd79 commented 6 years ago

OK. I'll investigate.

nickdodd79 commented 6 years ago

Hi @NN---

I have spent the last few days trying to get terminal windows and environmental variables working for the extension. Unfortunately, the built in vscode terminal is quite primitive and doesn't provide any process outputs - something I need to build the gulp tasks tree. I also tried to follow the vscode-yarn project recipe and use a third party terminal package, but that failed as well. I therefore don't think I can support your request with terminal windows.

However, I may have implemented a workaround, which has just been released as a revamped v1. I still use node child processes, but now merge any vscode configured environmental paths into the main process ones. That means you can still have your "terminal.integrated.env.windows" setup and it will be used when the gulp processes run.

Have a go and see if it works for you.

Nick.

NN--- commented 6 years ago

Thanks for you effort. I have a workaround via opening terminal and running gulp manually. I’ll try the changes you pushed, but if it doesn’t work, it is not a big problem. Thanks

NN--- commented 6 years ago

Unfortunately it cannot find node cause I configured it only for terminal and not globally.

operable program or batch file.

Auto detecting gulp for folder test failed with error: Error: Command failed: node_modules\.bin\gulp.cmd --tasks-simple --no-color
'node' is not recognized as an internal or external command,
operable program or batch file.

Perhaps you can add settings "gulp.nodePath" similar to "tslint.nodePath" setting in vscode-tslint ?

nickdodd79 commented 6 years ago

OK. I was hoping this block of code would specify where path variables were defined in the workspace settings, that could then be added to the env object for the process. This in turn would allow the process to resolve your custom install of node.

if (process.platform === 'win32') {
  this.configKey = 'terminal.integrated.env.windows';
} else  if (process.platform === 'darwin') {
  this.configKey = 'terminal.integrated.env.osx';
} else if (process.platform === 'linux') {
  this.configKey = 'terminal.integrated.env.linux';
}

Looking at the vscode-tslint project, am I correct in understanding that it is actually the node_modules path that is missing? This would mean the NODE_PATH variable needs to be set to the node_modules location in the workspace?

NN--- commented 6 years ago

This is output of 'Gulp Auto Detection' . If I open 'Run tasks' I don't see gulp there. only npm and tsc.

NN--- commented 6 years ago

Sorry, my bad. Everything working well ! :)

nickdodd79 commented 6 years ago

Cool.