Skip to content

Commit

Permalink
fix: Fix lambda layers support (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeyers-xomly authored Apr 4, 2022
1 parent 8914e65 commit a4407c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Serverless.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,6 +40,11 @@ declare namespace Serverless {
package: Serverless.Package
}

interface Layer {
handler: string
package: Serverless.Package
}

interface Package {
include: string[]
exclude: string[]
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a4407c9

Please sign in to comment.