Skip to content

Commit a4407c9

Browse files
fix: Fix lambda layers support (#267)
1 parent 8914e65 commit a4407c9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Diff for: src/Serverless.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ declare namespace Serverless {
1515
functions: {
1616
[key: string]: Serverless.Function
1717
}
18+
layers: { [key: string]: Serverless.Layer }
1819
package: Serverless.Package
1920
getAllFunctions(): string[]
21+
getAllLayers(): string[]
2022
custom?: {
2123
serverlessPluginTypescript?: {
2224
tsConfigFileLocation: string
@@ -38,6 +40,11 @@ declare namespace Serverless {
3840
package: Serverless.Package
3941
}
4042

43+
interface Layer {
44+
handler: string
45+
package: Serverless.Package
46+
}
47+
4148
interface Package {
4249
include: string[]
4350
exclude: string[]

Diff for: src/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@ export class TypeScriptPlugin {
250250
path.join(this.originalServicePath, SERVERLESS_FOLDER)
251251
)
252252

253+
const layerNames = service.getAllLayers()
254+
layerNames.forEach(name => {
255+
service.layers[name].package.artifact = path.join(
256+
this.originalServicePath,
257+
SERVERLESS_FOLDER,
258+
path.basename(service.layers[name].package.artifact)
259+
)
260+
})
261+
253262
if (this.options.function) {
254263
const fn = service.functions[this.options.function]
255264
fn.package.artifact = path.join(

0 commit comments

Comments
 (0)