diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc84987..88f6b0e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [2.1.2](https://github.com/serverless/serverless-plugin-typescript/compare/v2.1.1...v2.1.2) (2022-04-04) + +### Bug Fixes + +* Fix lambda layers support ([#267](https://github.com/serverless/serverless-plugin-typescript/issues/267)) ([a4407c9](https://github.com/serverless/serverless-plugin-typescript/commit/a4407c9062ddc9aeb8dd298b4c28f3730bccf5f5)) ([mmeyers-xomly](https://github.com/mmeyers-xomly)) + ### [2.1.1](https://github.com/serverless/serverless-plugin-typescript/compare/v2.1.0...v2.1.1) (2022-01-28) ### Bug Fixes diff --git a/package.json b/package.json index f35b7d33..5c48cccc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-plugin-typescript", - "version": "2.1.1", + "version": "2.1.2", "license": "MIT", "main": "dist/src/index.js", "files": [ diff --git a/src/Serverless.d.ts b/src/Serverless.d.ts index 7c3e9f2d..3b05529e 100644 --- a/src/Serverless.d.ts +++ b/src/Serverless.d.ts @@ -15,8 +15,10 @@ declare namespace Serverless { functions: { [key: string]: Serverless.Function } + layers: { [key: string]: Serverless.Layer } package: Serverless.Package getAllFunctions(): string[] + getAllLayers(): string[] custom?: { serverlessPluginTypescript?: { tsConfigFileLocation: string @@ -38,6 +40,11 @@ declare namespace Serverless { package: Serverless.Package } + interface Layer { + handler: string + package: Serverless.Package + } + interface Package { include: string[] exclude: string[] diff --git a/src/index.ts b/src/index.ts index adafe7a3..d4ebc0b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -250,6 +250,15 @@ export class TypeScriptPlugin { path.join(this.originalServicePath, SERVERLESS_FOLDER) ) + const layerNames = service.getAllLayers() + layerNames.forEach(name => { + service.layers[name].package.artifact = path.join( + this.originalServicePath, + SERVERLESS_FOLDER, + path.basename(service.layers[name].package.artifact) + ) + }) + if (this.options.function) { const fn = service.functions[this.options.function] fn.package.artifact = path.join(