Code Monkey home page Code Monkey logo

serverless-vscode's Introduction

Serverless Framework integration for VS Code

Version Installs Ratings

This extension enables an integration of Serverless projects with VSCode. It eliminates the need to start Serverless commands from a separate command line.

Installation

In order to install an extension you need to open the extension palette and search for serverless-vscode. You can then install it.

Currently the extension only supports Serverless projects with Serverless installed locally!

That means, that Serverless must be a development dependency of the project itself. A subsequent version of the extension will also support the globally installed Serverless framework and a configuration for that.

Configuration

The extension supports user and workspace configuration. To access the configuration settings, open File->Preferences->Settings (workspace or user) and expand the Serverless Configuration node.

The following configuration settings are available:

serverless.aws.askForRegion

When set to false (the default), the extension will not ask for the region to deploy to but use the one, set as serverless.aws.defaultRegion. This reduces the typing needed to execute a single command, as normally you'll not deploy cross-region that often.

serverless.aws.defaultStage

The defult stage that is assumed, if you just press ENTER in the stage input field when executing a command.

serverless.aws.defaultRegion

The defult region that is assumed, if you just press ENTER in the stage input field when executing a command. See also serverless.aws.askForRegion.

Usage

The Serverless outline

As soon as you have added a Serverless project to your workspace, you can select the serverless.yml in the Explorer tree view. Then an outline is shown in the Explorer view, that shows the parsed structure of your Serverless service definition. The outline will contain a functions and an API hive, which contain the defined functions in the project and the defined API endpoint hierarchy. Each item in the outline has a context menu that allows access to context specific commands. Most of the command will ask you for the target stage when triggered.

Top container objects

Each of the top hives has a context menu that lets you invoke service/project related functions.

Function

Package

Package will ask for the stage and optionally region and packages the service with serverless package.

Deploy

Package will ask for the stage and optionally region and deploys the service with serverless deploy.

Variable resolution (Resolve)

Resolve allows you to show a generated resolved.yml, i.e. your serverless.yml with all Serverless variables resolved to their values for a selected stage.

Functions

The functions hive lets you analyze your service function-wise and contains a node for each function. Each function then contains a list of all defined HTTP endpoints in the function definition.

Function

All function related commands of the extension can be called via the context menu of the function.

FunctionContext

Deploy function

Deploys the selected function with serverless deploy function. Attention: In general, single function deployment does not replace a service deployment. See the Serverless documentation for details.

Invoke local

Invoke the selected function locally. The command lets you select an event.json that will be used for the local invocation. Setting a custom context is not yet possible.

Show logs

Retrieve and show the online logs of the deployed function in the output pane.

Open handler

Open the handler source file that is associated with the function.

API

The API hive shows the combined API that will eventually be deployed to API Gateway.

Releases

See the CHANGELOG.MD file.

serverless-vscode's People

Contributors

hyperbrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

serverless-vscode's Issues

Unable to build

This is a Bug Report / Question

Description

Trying to build the extension in order to test/submit a PR.

  • What went wrong?

Cannot build master branch

  • What did you expect should have happened?

Source should have built

  • What was the config you used?

node@8 and node@11, usual npm install, building inside VSC

  • What stacktrace or error message from your provider did you see?

Build exits with this error:

src/lib/serverlessOutline.ts(124,31): error TS2459:
   Type 'string' has no property 'http' and no string index signature.

Is there a configuration etc. that I'm missing?

Parallel execution of serverless commands should be blocked

This is a Bug Report

Description

Currently it is possible to execute a Serverless command while another one is still running (e.g. package is running and you invoke deploy). This leads to a messed up serverless run, because Serverless is designed to run only one command at a time.

The extension should store a flag in the extension context that indicates if a command is currently active. Any further command execution should show an error, as long as the current command has not been finished.

Additional Data

  • Extension version: 0.0.4
  • Serverless Framework:
    Version: any
  • Serverless installed globally
  • Operating System: any
  • Stack Trace (if available):

Check interoperability with providers others than AWS

This is a Question

Description

The extension should be universal. To be proven as that, we should try to get feedback on how it behaves for other providers.
There might be the need to have some adaptions in the configuration, etc. depending on the selected provider.

If you see this task, use VSCode but anything else than AWS, please provide feedback.

Add API overview hive functionality

The API hive is currently empty.
It should display the whole service API structure (combination of all function endpoints, shown like the deployed API Gateway)

Add feature to launch deployed functions

This is a (Feature Proposal)

Description

For bug reports:

  • What went wrong?
  • What did you expect should have happened?
  • What was the config you used?
  • What stacktrace or error message from your provider did you see?

For feature proposals:

  • User creates a Serverless service, containing n functions. User deploys the service, AWS allocates a randonly named API gateway URL for the service, suffixed with each function. User wants to open one or more functions in a browser.
  • Might be sensible to enable 'open all functions in browser' or 'open this function in browser' by default?

Similar or dependent issue(s):

  • none

Additional Data

  • Extension version:
  • Serverless Framework:
    Version:
  • Serverless installed globally
  • Operating System:
  • Stack Trace (if available):

Support service deployment

This is a Feature Proposal

Description

The extension should allow invoking serverless deploy. The command shall be contained in the top hives' context menus.

Package/Deploy service commands shown on invalid tree nodes

This is a Bug Report

Description

  • What went wrong?
    The Package service and Deploy service commands are shown in all context menus. This can be seen when you right-click any file node in the VSCode explorer tree.

image

  • What did you expect should have happened?
    They should only appear in the Serverless outline.

  • What stacktrace or error message from your provider did you see?
    N/A

Additional Data

  • Extension version: 1.0.0
  • Serverless Framework: N/A
    Version:
  • Serverless installed globally
  • Operating System:
  • Stack Trace (if available):

Support region selection

This is a Feature Proposal

Description

Instead of only asking for the stage when running commands, the extension should also be able to ask for a region.
As the default region most likely covers most service setups, the availability of the region text input box can be added as configurable feature. The extension configuration should contain a boolean flag (askForRegion) that can be used to enable or disable the text input per workspace or globally.

Use empty intial defaultRegion to let people use their project region config

This is a Feature Proposal

Description

The plugin should set the defaultRegion parameter to an empty string, so that it would not add any region parameter to the serverless command line. This will automatically use the user's configured project region (serverless.yml) in the first place. Otherwise it could lead to an unexpected deployment into the wrong region (thanks @panzupa).

Similar or dependent issue(s):

Additional Data

  • Extension version:
  • Serverless Framework:
    Version:
  • Serverless installed globally
  • Operating System:
  • Stack Trace (if available):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.