-
Notifications
You must be signed in to change notification settings - Fork 412
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
Support package.include and package.exclude #327
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
const BbPromise = require('bluebird'); | ||
const path = require('path'); | ||
const fse = require('fs-extra'); | ||
const glob = require('glob'); | ||
const globby = require('globby'); | ||
const lib = require('./index'); | ||
const _ = require('lodash'); | ||
const Configuration = require('./Configuration'); | ||
|
@@ -31,8 +31,8 @@ module.exports = { | |
}; | ||
|
||
const getEntryExtension = fileName => { | ||
const files = glob.sync(`${fileName}.*`, { | ||
cwd: this.serverless.config.servicePath, | ||
const files = globby.sync(`${fileName}.*`, { | ||
cwd: this.serverless.config.servicePath || process.cwd(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if defaulting to CWD is right here. It will miss the handlers in case CWD !== servicePath and render the webpack configuration invalid. In general, serverless-webpack depends on servicePath everywhere and uses it to create it's outputs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that can be the tests. Not all of them intialize a full config object for testing. So this should be ok 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW: I just remember another open PR, that stabilizes the directories and uses webpackconfig.context to keep the webpack root directory. So this line would be void if the two PRs are merged together. |
||
nodir: true | ||
}); | ||
|
||
|
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.
The configuration is now separated into the
Configuration
object. You should add a getter forpackage
and set viable defaults (empty arrays) there and add some unit tests. Then just useconst { exclude, include } = this.configuration.package
here instead of bypassing the integrity of the class.