Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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