HyperBrain / serverless-vscode

Serverless framework integration for VSCode
MIT License
28 stars 3 forks source link

Support globally installed serverless #1

Open HyperBrain opened 6 years ago

HyperBrain commented 6 years ago

The current version only supports locally installed per project serverless instances. It should support global serverless installations too.

fatangare commented 6 years ago

Does "serverless.useGlobal": true, work? It is not working for me.

HyperBrain commented 6 years ago

Hi @fatangare, thanks for the question 👍 . This is not implemented yet (this issue is the feature request).

serverlesspolska commented 6 years ago

ah...it doesn't work for me either. It would be great to have this implemented.

HyperBrain commented 6 years ago

@panzupa I already implemented the feature, but it is still in PR #21 but not yet merged and released. Would you mind to test if it works for you, if I attach a temporary vsix package here, that you can install using "install extension from file"? If my fix is ok, I would release it asap.

serverlesspolska commented 6 years ago

@HyperBrain Sure, no problem. I will gladly test it :-)

HyperBrain commented 6 years ago

@panzupa Here you go. Please add your feedback to this issue ;-) And thank you

serverless-vscode-1.1.0-alpha.vsix.zip

Oh. GitHub only supports ZIP files for upload, so please extract it locally and install the vsix as extension.

serverlesspolska commented 6 years ago

I get:

Serverless: spawn serverless ENOENT

I tried to find more logs but I could. Please tell me where I should look.

Also, would be nice if plugin would ignore the region if one is already defined in serverless.yml

Running "serverless deploy function --function=fetch --region=eu-central-1 --stage=dev"
HyperBrain commented 6 years ago

Ok. The error you get is caused, because the extension cannot find the "serverless" executable in your path. Maybe that approach is wrong and it should use npx serverless to execute it in the current global node context. I will provide a new version for testing.

Regarding the feature idea: Nice catch. Maybe an option useRegionFromServerlessYaml could enable this?

serverlesspolska commented 6 years ago

Regarding the feature idea: Nice catch. Maybe an option useRegionFromServerlessYaml could enable this?

If you're asking me, then please consider such case. Someone who already has a serverless project is installing your plugin. And suddenly it deploys to the other region then one defined in serverless.yml Personally, I think it's a bad approach. I would stay with the existing setting defaultRegion but set it to be empty. Your plugin seeing empty value should not add --region parameter at all. If someone wants to setup it, he can put something in the configuration.

HyperBrain commented 6 years ago

Sounds reasonable. I will create a new GitHub issue and provide a fix (should be trivial)

serverlesspolska commented 6 years ago

Thanks @HyperBrain .

Ok. The error you get is caused, because the extension cannot find the "serverless" executable in your path. Maybe that approach is wrong and it should use npx serverless to execute it in the current global node context. I will provide a new version for testing

I don't use npx. BTW I'm testing this on Windows10 and I have serverless in my PATH.

softprops commented 6 years ago

I believe npx ( now bundled with node ) solves for both cases. It first tries local node modules, the what's on your path, the finally installs when not available

JaderCM commented 4 years ago

@HyperBrain any news about this new feature?