Observed since 20 Oct, 22:44 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0xc/serverless-plugin-typescript
This is a fork of the `serverless-plugin-typescript` package.
This is a fork of the serverless-plugin-typescript package.
export, import, async, await, Promise, ...)sls package, sls deploy and sls deploy functionsls invoke local + --watch modeserverless-offlineyarn add --dev serverless-plugin-typescript typescript
# or
npm install -D serverless-plugin-typescript typescript
Add the following plugin to your serverless.yml:
plugins:
- serverless-plugin-typescript
See example folder for a minimal example.
tsconfig.jsonThe default tsconfig.json file used by the plugin looks like this:
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"sourceMap": true,
"allowJs": true,
"target": "es5",
"outDir": ".build",
"moduleResolution": "node",
"lib": ["es2015"],
"rootDir": "./"
}
}
Note 1: The
outDirandrootDiroptions cannot be overwritten.
Note 2: Don't confuse the
tsconfig.jsonin this repository with the one mentioned above.
All files from package/include will be included in the final build file. See Exclude/Include
When using with Google Cloud Functions via the serverless-google-cloudfunctions
plugin, you simply have to provide a main field in your package.json:
{
// ...
"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.
The normal Serverless deploy procedure will automatically compile with Typescript:
serverless create -t aws-nodejsserverless deployThe plugin integrates very well with 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:
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)
Configure your service the same as mentioned above, but additionally add the serverless-dynamodb-local
plugin as follows:
plugins:
- serverless-plugin-typescript
- serverless-dynamodb-local
- serverless-offline
Run serverless offline start.
You can reduce the clutter generated by serverless-offline with --dontPrintOutput and
disable timeouts with --noTimeout.
To run your compiled functions locally you can:
$ 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 dataYou can easily enable support for source-maps (making stacktraces easier to read) by installing and using the following plugin:
yarn add --dev source-map-support
// inside of your function
import 'source-map-support/register'
If you are using webpack (most likely). Add devtool: 'source-map' to webpack.config.js:
module.exports = {
.... snip ....
devtool: 'source-map',
.... snip ....
}
Join our Spectrum community if you run into issues or have questions. We love talking to you!
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
fs-extraEnvironment{
"local_name": "fs-extra",
"alias": false,
"peer_metadata": null
} | ^7.0.1 | runtime |
globbyEnvironment{
"local_name": "globby",
"alias": false,
"peer_metadata": null
} | ^9.2.0 | runtime |
@types/fs-extraEnvironment{
"local_name": "@types/fs-extra",
"alias": false,
"peer_metadata": null
} | 5.0.5 | development |
@types/jestEnvironment{
"local_name": "@types/jest",
"alias": false,
"peer_metadata": null
} | 24.0.12 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | 12.6.2 | development |
@typescript-eslint/eslint-pluginEnvironment{
"local_name": "@typescript-eslint/eslint-plugin",
"alias": false,
"peer_metadata": null
} | ^3.2.0 | development |
@typescript-eslint/parserEnvironment{
"local_name": "@typescript-eslint/parser",
"alias": false,
"peer_metadata": null
} | ^3.2.0 | development |
eslintEnvironment{
"local_name": "eslint",
"alias": false,
"peer_metadata": null
} | latest | development |
jestEnvironment{
"local_name": "jest",
"alias": false,
"peer_metadata": null
} | 24.5.0 | development |
mock-fsEnvironment{
"local_name": "mock-fs",
"alias": false,
"peer_metadata": null
} | 4.9.0 | development |
rimrafEnvironment{
"local_name": "rimraf",
"alias": false,
"peer_metadata": null
} | 2.6.3 | development |
ts-jestEnvironment{
"local_name": "ts-jest",
"alias": false,
"peer_metadata": null
} | 24.0.2 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^3.4.1 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | >=2.2.2 | peer |
Source distribution
{
"integrity": "sha512-ttbugqRHhvjzNr3LYmSktK/53ZmA/DhF2+T4NtbV2mc8cuw28NeREKt2i0rnL6gdeM+9IziKTJCIwyCBQlrs7A==",
"shasum": "c1ce94ff0f0c96a215337f31169bfbe22d83664b",
"tarball": "https://registry.npmjs.org/@0xc/serverless-plugin-typescript/-/serverless-plugin-typescript-2.0.0.tgz",
"fileCount": 11,
"unpackedSize": 43213,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4nCNCRA9TVsSAnZWagAAeY8QAI63Q/IHGdbdBIMtNPQu\nJS1WsULP8u/uj63T40EW5HJf6/a1OgLIN7rErFyP734G1KttXx3hXO/Yl564\nzmiqK5ov1XXd372Wu+O9zaFizVOlhim+wMuXVqVdfoHDJGsX92t5lk68Dc9u\nVbq5vmVH1EyW1/HbGgocpwh4gSmuBSXyZhzJI5UU1lR+jvNKU8g5WV2RyYxf\njFYHppl2iSln6yRwnkp+J7ikWM555UyKoZfzN9qk3U7u0h+TrhDY9I+mUKFt\nCWyWbLrYGro99Ws75HSMnzm4UqQw8RAXIrakOeJ5FV0lsb5L6CoEW2IJMUa/\nlNrS0bU4iiBSDV1f/KPFe3ZHdEeB68/TpGhUKies8PLlJ+7nj8p3XFt9TmEv\nNnSaIKs32cGDHRhkne/zsF7QZkotVykF9occn40B9NX3WnSmt1kpGm73HFj9\nU0aXmqV3M+ByUO3hViD/VXICbW11vkw9Eih0Sk/bjBUpfYCcOm0KyjsVNOH8\nAbtiklDdH/UZqIz3hFGl3I0SnHd/T+cxwsENCXeLas5EvMdwbfQWrQT6fptX\niri2e8D9qm3941iCv4WJwRoJw+injPXBHqggP6ZLCmRG4mFqW/0rizS4zLCQ\ncZPy1SAVlf30yoD1S9LC/ohCBg7LqzILsWGfl9Zvsah8quOYxjrHvpBqSrOv\nzWQ0\r\n=spA/\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCIQDjnC4MXxc3zBPfpsOYy0CdfiMLCX9jXk1otYRY3HvQeAIgKEKd8CT2nuMZu8qFxuQISe04SRCOfAdQrKIfd48rJqM="
}
]
}Shared repository data · GitHub
Observed since 20 Oct, 22:44 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:94bcd6c6dae2d2ce787e1587b2b252a7733cada7ba48f86cfd916cf2e4c70f2b