-
Notifications
You must be signed in to change notification settings - Fork 230
Add in package/includes to final build product. #11
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
Add in package/includes to final build product. #11
Conversation
I also locked in fs-p to 2.0.0 because I was getting build errors. |
src/index.ts
Outdated
@@ -53,6 +55,21 @@ class ServerlessPlugin { | |||
|
|||
// include node_modules into build | |||
fs.symlinkSync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules'))) | |||
// include any "extras" from the "include" section | |||
if(this.serverless.service.package.include && this.serverless.service.package.include.length > 0){ | |||
globby(this.serverless.service.package.include).then((files) => { |
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.
Please use async
& await
here.
src/index.ts
Outdated
if(this.serverless.service.package.include && this.serverless.service.package.include.length > 0){ | ||
globby(this.serverless.service.package.include).then((files) => { | ||
_.forEach(files, (filename) => { | ||
let destFileName = path.resolve(path.join(buildFolder, filename)); |
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.
Any reason not to use const
instead of let
?
src/index.ts
Outdated
_.forEach(files, (filename) => { | ||
let destFileName = path.resolve(path.join(buildFolder, filename)); | ||
let dirname = path.dirname(destFileName); | ||
if(!fs.existsSync(dirname)){ |
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.
Please use spaces like so: if (!fs.existsSync(dirname)) {
(Also applies to other places)
I've added a few comments. Would be great if you could adust it :) |
Other minor style updates suggested by @schickling
No problem, sorry I haven't been writing in TypeScript that long and I only recently learned of Async/Await. Does this look better? |
Looks great now! |
Resolves #9