Skip to content

Commit

Permalink
fix: support docker lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
ShakedZrihen committed Jun 7, 2023
1 parent c23faad commit 9766817
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Serverless.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ declare namespace Serverless {
}

interface Function {
handler: string
handler?: string
package: Serverless.Package
runtime?: string
image?: Serverless.Image
}

interface Image {
name: string
}
interface Layer {
handler: string
package: Serverless.Package
Expand Down
3 changes: 2 additions & 1 deletion src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function extractFileNames(cwd: string, provider: string, functions?: { [k

return _.values(functions)
.map(fn => fn.handler)
.filter(Boolean)
.map(h => {
const fnName = _.last(h.split('.'))
const fnNameLastAppearanceIndex = h.lastIndexOf(fnName)
Expand Down Expand Up @@ -169,4 +170,4 @@ export function getTypescriptCompileFiles(
return configParseResult.fileNames.map(f => f.replace(cwd + '/', ''))
}
return []
}
}
10 changes: 10 additions & 0 deletions tests/typescript.extractFileName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ const functions: { [key: string]: Serverless.Function } = {
patterns: []
}
},
dockerBasedFunction: {
image: {
name: 'path/to/lambda/image'
},
package: {
include: [],
exclude: [],
patterns: []
}
}
}

describe('extractFileName', () => {
Expand Down

0 comments on commit 9766817

Please sign in to comment.