Skip to content

Commit de75d2f

Browse files
committed
Remove temp files between builds to avoid the chance of build pollution
1 parent 7ca65da commit de75d2f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/fastboot-api-lambda-deploy-plugin.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,26 @@ module.exports = DeployPlugin.extend({
4444
const tempPath = paths.tempPath;
4545

4646
return RSVP.resolve()
47-
.then(() => this.log(`1/5. Cloning skeleton FastBoot server`))
47+
.then(() => this.log(`1/6. Cleaning up any existing temp files`))
48+
.then(() => fs.remove(tempPath))
49+
.then(() => fs.remove(`${tempPath}.zip`))
50+
51+
.then(() => this.log(`2/6. Cloning skeleton FastBoot server`))
4852
.then(() => fs.copy(skeletonPath, tempPath))
4953

50-
.then(() => this.log(`2/5. Installing FastBoot server dependencies`))
54+
.then(() => this.log(`3/6. Installing FastBoot server dependencies`))
5155
.then(() => exec("npm install --production", { cwd: tempPath }))
5256

53-
.then(() => this.log(`3/5. Cloning config into FastBoot server directory`))
57+
.then(() => this.log(`4/6. Cloning config into FastBoot server directory`))
5458
.then(() => {
5559
const json = JSON.stringify(config);
5660
return fs.writeFile(`${tempPath}/config.json`, json, 'utf8');
5761
})
5862

59-
.then(() => this.log(`4/5. Cloning FastBoot build into FastBoot server directory`))
63+
.then(() => this.log(`5/6. Cloning FastBoot build into FastBoot server directory`))
6064
.then(() => fs.copy(context.distDir, `${tempPath}/dist`))
6165

62-
.then(() => this.log(`5/5. Installing dependencies of the FastBoot build`))
66+
.then(() => this.log(`6/6. Installing dependencies of the FastBoot build`))
6367
.then(() => exec('npm install --production', { cwd: `${tempPath}/dist` }))
6468

6569
.then(() => this.log(`API FastBoot lambda production bundle successfully built`));
@@ -91,6 +95,6 @@ module.exports = DeployPlugin.extend({
9195
});
9296
})
9397

94-
.then(() => this.log(`API FastBoot lambda production bundle successfully uploaded to "${lambdaFunction}" lambda function to region "${region}" 🚀`));
98+
.then(() => this.log(`API FastBoot lambda production bundle successfully uploaded to "${lambdaFunction}" lambda in region "${region}" 🚀`));
9599
}
96100
});

0 commit comments

Comments
 (0)