Skip to content

Commit 6d0f84b

Browse files
committed
Reduce redundant code by calling cleanup after the "after" function.
1 parent b6db865 commit 6d0f84b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ class ServerlessPlugin {
104104
}
105105

106106
async afterCreateDeploymentArtifacts(): Promise<void> {
107-
// Restore service path
108-
this.serverless.config.servicePath = this.originalServicePath
109-
110107
// Copy .build to .serverless
111108
await fs.copy(
112109
path.join(this.originalServicePath, buildFolder, serverlessFolder),
@@ -115,8 +112,8 @@ class ServerlessPlugin {
115112

116113
this.serverless.service.package.artifact = path.join(this.originalServicePath, serverlessFolder, path.basename(this.serverless.service.package.artifact))
117114

118-
// Remove temp build folder
119-
fs.removeSync(path.join(this.originalServicePath, buildFolder))
115+
// Cleanup after everything is copied
116+
await this.cleanup();
120117
}
121118

122119
async cleanup(): Promise<void> {

0 commit comments

Comments
 (0)