Skip to content

Commit 9766817

Browse files
committed
fix: support docker lambdas
1 parent c23faad commit 9766817

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/Serverless.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ declare namespace Serverless {
3737
}
3838

3939
interface Function {
40-
handler: string
40+
handler?: string
4141
package: Serverless.Package
4242
runtime?: string
43+
image?: Serverless.Image
4344
}
4445

46+
interface Image {
47+
name: string
48+
}
4549
interface Layer {
4650
handler: string
4751
package: Serverless.Package

src/typescript.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function extractFileNames(cwd: string, provider: string, functions?: { [k
4848

4949
return _.values(functions)
5050
.map(fn => fn.handler)
51+
.filter(Boolean)
5152
.map(h => {
5253
const fnName = _.last(h.split('.'))
5354
const fnNameLastAppearanceIndex = h.lastIndexOf(fnName)
@@ -169,4 +170,4 @@ export function getTypescriptCompileFiles(
169170
return configParseResult.fileNames.map(f => f.replace(cwd + '/', ''))
170171
}
171172
return []
172-
}
173+
}

tests/typescript.extractFileName.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ const functions: { [key: string]: Serverless.Function } = {
2929
patterns: []
3030
}
3131
},
32+
dockerBasedFunction: {
33+
image: {
34+
name: 'path/to/lambda/image'
35+
},
36+
package: {
37+
include: [],
38+
exclude: [],
39+
patterns: []
40+
}
41+
}
3242
}
3343

3444
describe('extractFileName', () => {

0 commit comments

Comments
 (0)