@@ -4,16 +4,16 @@ title: Serverless Plugin Aws Alerts
repo: ACloudGuru/serverless-plugin-aws-alerts
homepage: 'https://github.com/ACloudGuru/serverless-plugin-aws-alerts'
description: 'A Serverless plugin to easily add CloudWatch alarms to functions'
stars: 116
stars_trend:
stars_diff: 0
forks: 29
forks_trend:
forks_diff: 0
watchers: 116
issues: 15
issues_trend:
issues_diff: 0
stars: 121
stars_trend: up
stars_diff: 5
forks: 30
forks_trend: up
forks_diff: 1
watchers: 121
issues: 16
issues_trend: up
issues_diff: 1
---


@@ -4,13 +4,13 @@ title: Serverless Plugin Browserifier
repo: digitalmaas/serverless-plugin-browserifier
homepage: 'https://github.com/digitalmaas/serverless-plugin-browserifier'
description: 'Reduce the size and speed up your Node.js based lambda's using browserify.'
stars: 13
stars_trend:
stars_diff: 0
stars: 14
stars_trend: up
stars_diff: 1
forks: 1
forks_trend:
forks_diff: 0
watchers: 13
watchers: 14
issues: 0
issues_trend:
issues_diff: 0
@@ -4,13 +4,13 @@ title: Serverless Plugin Canary Deployments
repo: davidgf/serverless-plugin-canary-deployments
homepage: 'https://github.com/davidgf/serverless-plugin-canary-deployments'
description: 'A Serverless plugin to implement canary deployments of Lambda functions'
stars: 63
stars_trend:
stars_diff: 0
stars: 66
stars_trend: up
stars_diff: 3
forks: 9
forks_trend:
forks_diff: 0
watchers: 63
watchers: 66
issues: 2
issues_trend:
issues_diff: 0
@@ -11,9 +11,9 @@ forks: 2
forks_trend:
forks_diff: 0
watchers: 16
issues: 5
issues_trend:
issues_diff: 0
issues: 6
issues_trend: up
issues_diff: 1
---


@@ -11,9 +11,9 @@ forks: 12
forks_trend:
forks_diff: 0
watchers: 43
issues: 9
issues_trend:
issues_diff: 0
issues: 10
issues_trend: up
issues_diff: 1
---


@@ -4,186 +4,17 @@ title: Serverless Plugin Typescript
repo: graphcool/serverless-plugin-typescript
homepage: 'https://github.com/graphcool/serverless-plugin-typescript'
description: 'Serverless plugin for zero-config Typescript support.'
stars: 198
stars_trend:
stars_diff: 0
forks: 39
forks_trend:
forks_diff: 0
watchers: 198
issues: 40
issues_trend:
issues_diff: 0
stars: 0
stars_trend: down
stars_diff: -198
forks: 0
forks_trend: down
forks_diff: -39
watchers: 0
issues: 0
issues_trend: down
issues_diff: -40
---


# serverless-plugin-typescript
[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com) [![npm version](https://badge.fury.io/js/serverless-plugin-typescript.svg)](https://badge.fury.io/js/serverless-plugin-typescript) [![Build Status](https://travis-ci.org/graphcool/serverless-plugin-typescript.svg?branch=master)](https://travis-ci.org/graphcool/serverless-plugin-typescript)

Serverless plugin for zero-config Typescript support

## Features

* Zero-config: Works out of the box without the need to install any other compiler or plugins
* Supports ES2015 syntax + features (`export`, `import`, `async`, `await`, `Promise`, ...)
* Supports `sls package`, `sls deploy` and `sls deploy function`
* Supports `sls invoke local` + `--watch` mode
* Integrates nicely with [`serverless-offline`](https://github.com/dherault/serverless-offline)

## Install

```sh
yarn add --dev serverless-plugin-typescript
```

Add the following plugin to your `serverless.yml`:

```yaml
plugins:
- serverless-plugin-typescript
```

## Configure

See [example folder](example) for a minimal example.

### `tsconfig.json`

The default `tsconfig.json` file used by the plugin looks like this:

```json
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"sourceMap": true,
"target": "es5",
"outDir": ".build",
"moduleResolution": "node",
"lib": ["es2015"],
"rootDir": "./"
}
}
```

> Note 1: The `outDir` and `rootDir` options cannot be overwritten.
> Note 2: Don't confuse the [`tsconfig.json`](tsconfig.json) in this repository with the one mentioned above.
### Including extra files

All files from `package/include` will be included in the final build file. See [Exclude/Include](https://serverless.com/framework/docs/providers/aws/guide/packaging#exclude--include)


## Usage

### Google Cloud Functions

When using with Google Cloud Functions via the [serverless-google-cloudfunctions](https://github.com/serverless/serverless-google-cloudfunctions)
plugin, you simply have to provide a `main` field in your `package.json`:

```js
{
// ...
"main": "handler.js",
// ..
}
```

And this plugin will automatically compile your typescript correctly. Note
that the field must refer to the compiled file name, namely, ending with a `.js`
extension.

If a `main` field was not found, then this plugin will use `index.js`. Before
compilation begins, it will check to see that the file indicated exists with a
`.ts` extension before actually trying to compile it.

### Automatic compilation

The normal Serverless deploy procedure will automatically compile with Typescript:

- Create the Serverless project with `serverless create -t aws-nodejs`
- Install Serverless Typescript as above
- Deploy with `serverless deploy`

### Usage with serverless-offline

The plugin integrates very well with [serverless-offline](https://github.com/dherault/serverless-offline) to
simulate AWS Lambda and AWS API Gateway locally.

Add the plugins to your `serverless.yml` file and make sure that `serverless-plugin-typescript`
precedes `serverless-offline` as the order is important:
```yaml
plugins:
...
- serverless-plugin-typescript
...
- serverless-offline
...
```

Run `serverless offline` or `serverless offline start` to start the Lambda/API simulation.

In comparison to `serverless offline`, the `start` command will fire an `init` and a `end` lifecycle hook which is needed for `serverless-offline` and e.g. `serverless-dynamodb-local` to switch off resources (see below)

#### serverless-dynamodb-local

Configure your service the same as mentioned above, but additionally add the `serverless-dynamodb-local`
plugin as follows:
```yaml
plugins:
- serverless-plugin-typescript
- serverless-dynamodb-local
- serverless-offline
```

Run `serverless offline start`.

#### Other useful options

You can reduce the clutter generated by `serverless-offline` with `--dontPrintOutput` and
disable timeouts with `--noTimeout`.

### Run a function locally

To run your compiled functions locally you can:

```bash
$ serverless invoke local --function <function-name>
```

Options are:

- `--function` or `-f` (required) is the name of the function to run
- `--watch` - recompile and run a function locally on source changes
- `--path` or `-p` (optional) path to JSON or YAML file holding input data
- `--data` or `-d` (optional) input data

### Enabling source-maps

You can easily enable support for source-maps (making stacktraces easier to read) by installing and using the following plugin:

```sh
yarn add --dev source-map-support
```

```ts
// inside of your function
import 'source-map-support/register'
```

If you are using webpack (most likely). Add `devtool: 'source-map'` to `webpack.config.js`:
```js
module.exports = {
.... snip ....
devtool: 'source-map',
.... snip ....
}
```

## Help & Community [![Slack Status](https://slack.graph.cool/badge.svg)](https://slack.graph.cool)

Join our [Slack community](http://slack.graph.cool/) if you run into issues or have questions. We love talking to you!

![](http://i.imgur.com/5RHR6Ku.png)
{}
@@ -4,16 +4,16 @@ title: Serverless Plugin Warmup
repo: FidelLimited/serverless-plugin-warmup
homepage: 'https://github.com/FidelLimited/serverless-plugin-warmup'
description: 'Keep your lambdas warm during Winter.'
stars: 193
stars_trend:
stars_diff: 0
stars: 200
stars_trend: up
stars_diff: 7
forks: 28
forks_trend:
forks_diff: 0
watchers: 193
issues: 9
issues_trend:
issues_diff: 0
watchers: 200
issues: 8
issues_trend: down
issues_diff: -1
---


@@ -4,13 +4,13 @@ title: Serverless Prune Plugin
repo: claygregory/serverless-prune-plugin
homepage: 'https://github.com/claygregory/serverless-prune-plugin'
description: 'Deletes old versions of functions from AWS, preserving recent and aliased versions'
stars: 53
stars_trend:
stars_diff: 0
stars: 54
stars_trend: up
stars_diff: 1
forks: 3
forks_trend:
forks_diff: 0
watchers: 53
watchers: 54
issues: 0
issues_trend:
issues_diff: 0
@@ -4,13 +4,13 @@ title: Serverless Python Requirements
repo: UnitedIncome/serverless-python-requirements
homepage: 'https://github.com/UnitedIncome/serverless-python-requirements'
description: 'Serverless plugin to bundle Python packages'
stars: 231
stars_trend:
stars_diff: 0
stars: 236
stars_trend: up
stars_diff: 5
forks: 57
forks_trend:
forks_diff: 0
watchers: 231
watchers: 236
issues: 36
issues_trend:
issues_diff: 0
@@ -11,9 +11,9 @@ forks: 13
forks_trend:
forks_diff: 0
watchers: 32
issues: 5
issues_trend:
issues_diff: 0
issues: 4
issues_trend: down
issues_diff: -1
---


@@ -4,13 +4,13 @@ title: Serverless Sam
repo: SAPessi/serverless-sam
homepage: 'https://github.com/SAPessi/serverless-sam'
description: 'Exports an AWS SAM template for a service created with the Serverless Framework.'
stars: 62
stars_trend:
stars_diff: 0
stars: 63
stars_trend: up
stars_diff: 1
forks: 14
forks_trend:
forks_diff: 0
watchers: 62
watchers: 63
issues: 12
issues_trend:
issues_diff: 0
@@ -4,16 +4,16 @@ title: Serverless Sentry Plugin
repo: arabold/serverless-sentry-plugin
homepage: 'https://github.com/arabold/serverless-sentry-plugin'
description: 'Automatic monitoring of memory usage, execution timeouts and forwarding of Lambda errors to Sentry (https://sentry.io).'
stars: 68
stars_trend:
stars_diff: 0
forks: 8
forks_trend:
forks_diff: 0
watchers: 68
issues: 6
issues_trend:
issues_diff: 0
stars: 69
stars_trend: up
stars_diff: 1
forks: 9
forks_trend: up
forks_diff: 1
watchers: 69
issues: 7
issues_trend: up
issues_diff: 1
---


@@ -4,13 +4,13 @@ title: Serverless Shell
repo: UnitedIncome/serverless-shell
homepage: 'https://github.com/UnitedIncome/serverless-shell'
description: 'Drop to a runtime shell with all the environment variables set that you&#39;d have in lambda.'
stars: 7
stars_trend:
stars_diff: 0
stars: 8
stars_trend: up
stars_diff: 1
forks: 2
forks_trend:
forks_diff: 0
watchers: 7
watchers: 8
issues: 2
issues_trend:
issues_diff: 0
@@ -4,13 +4,13 @@ title: Serverless Ssm Fetch
repo: gozup/serverless-ssm-fetch
homepage: 'https://github.com/gozup/serverless-ssm-fetch'
description: 'Sets &quot;AWS Systems Manager Parameter Store (SSM)&quot; parameters into functions&#39; environment variables.'
stars: 9
stars_trend:
stars_diff: 0
stars: 10
stars_trend: up
stars_diff: 1
forks: 3
forks_trend:
forks_diff: 0
watchers: 9
watchers: 10
issues: 0
issues_trend:
issues_diff: 0
@@ -4,13 +4,13 @@ title: Serverless Step Functions
repo: horike37/serverless-step-functions
homepage: 'https://github.com/horike37/serverless-step-functions'
description: 'AWS Step Functions with Serverless Framework.'
stars: 276
stars_trend:
stars_diff: 0
stars: 281
stars_trend: up
stars_diff: 5
forks: 40
forks_trend:
forks_diff: 0
watchers: 276
watchers: 281
issues: 25
issues_trend:
issues_diff: 0
@@ -4,16 +4,16 @@ title: Serverless Webpack
repo: serverless-heaven/serverless-webpack
homepage: 'https://github.com/serverless-heaven/serverless-webpack'
description: 'Serverless plugin to bundle your lambdas with Webpack'
stars: 685
stars_trend:
stars_diff: 0
forks: 163
forks_trend:
forks_diff: 0
watchers: 685
issues: 24
issues_trend:
issues_diff: 0
stars: 690
stars_trend: up
stars_diff: 5
forks: 164
forks_trend: up
forks_diff: 1
watchers: 690
issues: 26
issues_trend: up
issues_diff: 2
---


@@ -3,6 +3,6 @@
layout: topic
topic: aws-lambda
title: aws-lambda Serverless Plugins
description: '28 aws-lambda ServerLess Plugins'
count: 28
description: '27 aws-lambda ServerLess Plugins'
count: 27
---
@@ -3,6 +3,6 @@
layout: topic
topic: babel
title: babel Serverless Plugins
description: '3 babel ServerLess Plugins'
count: 3
description: '2 babel ServerLess Plugins'
count: 2
---
@@ -3,6 +3,6 @@
layout: topic
topic: serverless-framework
title: serverless-framework Serverless Plugins
description: '24 serverless-framework ServerLess Plugins'
count: 24
description: '23 serverless-framework ServerLess Plugins'
count: 23
---
@@ -3,6 +3,6 @@
layout: topic
topic: serverless-plugin
title: serverless-plugin Serverless Plugins
description: '41 serverless-plugin ServerLess Plugins'
count: 41
description: '40 serverless-plugin ServerLess Plugins'
count: 40
---
@@ -3,6 +3,6 @@
layout: topic
topic: serverless
title: serverless Serverless Plugins
description: '64 serverless ServerLess Plugins'
count: 64
description: '63 serverless ServerLess Plugins'
count: 63
---
@@ -3,6 +3,6 @@
layout: topic
topic: webpack
title: webpack Serverless Plugins
description: '3 webpack ServerLess Plugins'
count: 3
description: '2 webpack ServerLess Plugins'
count: 2
---