-
Notifications
You must be signed in to change notification settings - Fork 293
Add modern logs for Serverless Framework v3 #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0bc3ef9
to
6558824
Compare
ea17323
to
0149309
Compare
0149309
to
af50c33
Compare
lib/clean.js
Outdated
if (this.serverless) { | ||
this.serverless.cli.log(`Removing static caches at: ${cacheLocation}`); | ||
if (this.progress && this.log) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to check just for this.log
(also later, when we may want to unconditionally switch to modern logs, it'll make easier to pick all those conditionals by searching if (this.log
)
lib/clean.js
Outdated
@@ -50,10 +57,19 @@ function cleanupCache() { | |||
.forEach((file) => { | |||
promises.push(fse.removeAsync(file)); | |||
}); | |||
return BbPromise.all(promises); | |||
return BbPromise.all(promises) | |||
.then(() => cleanupProgress && cleanupProgress.remove()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use .finally
lib/inject.js
Outdated
if (this.serverless.service.package.individually) { | ||
return BbPromise.resolve(this.targetFuncs) | ||
returnPromise = BbPromise.resolve(this.targetFuncs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply convert it to async function, and use finally
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great suggestion
lib/layer.js
Outdated
return BbPromise.bind(this) | ||
.then(zipRequirements) | ||
.then(createLayers) | ||
.then(() => layerProgress && layerProgress.remove()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.finally
lib/zip.js
Outdated
).then((zip) => writeZip(zip, `${f.module}/.requirements.zip`)); | ||
return addTree(new JSZip(), `.serverless/${f.module}/requirements`) | ||
.then((zip) => writeZip(zip, `${f.module}/.requirements.zip`)) | ||
.then(() => packProgress && packProgress.remove()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.finally
/^python.*/ | ||
try { | ||
if (this.serverless.service.package.individually) { | ||
await BbPromise.resolve(this.targetFuncs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should return await
to work in same way (but not sure, maybe it won't make difference)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've skipped that return because the result is not actually used anywhere
); | ||
}); | ||
} else if (!this.options.zip) { | ||
await injectRequirements( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
lib/zip.js
Outdated
.then((zip) => | ||
writeZip(zip, path.join(this.servicePath, '.requirements.zip')) | ||
) | ||
.then(() => packProgress && packProgress.remove()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
9bda1d4
to
3279861
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👍
Configured in a way that would allow support both for v2 and v3 versions of the Framework