-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Throw if cwd
option isn't a string
#8
Conversation
ping @sindresorhus |
I think this should be fixed in |
|
IMHO, it's up to the caller to pass in the correct arguments. |
at least we should alert user |
Agreed |
you'll fix this in |
I've created PR to globby sindresorhus/globby#99 |
See also: :) |
c0f44cb
to
ad86c69
Compare
@@ -24,9 +24,11 @@ const getGlob = (dir, opts) => { | |||
|
|||
if (opts.files && opts.extensions) { | |||
return opts.files.map(x => path.join(dir, addExtensions(x, opts.extensions))); | |||
} else if (opts.files) { | |||
} | |||
if (opts.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.
These changes are unrelated.
package.json
Outdated
@@ -29,10 +29,10 @@ | |||
"path-type": "^3.0.0" | |||
}, | |||
"devDependencies": { | |||
"ava": "*", | |||
"ava": "~0.25.0", |
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.
Also unrelated.
index.js
Outdated
@@ -43,6 +48,9 @@ module.exports = (input, opts) => { | |||
|
|||
module.exports.sync = (input, opts) => { | |||
opts = Object.assign({cwd: process.cwd()}, opts); | |||
if (typeof opts.cwd !== 'string') { | |||
throw new TypeError('opts.cwd must be a string'); |
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.
new TypeError(`Expected `cwd` to be of type \`string\` but received type \`${typeof opts.cwd}\``);
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.
error message updated, all the other changes made the project pass the lint by xo, pin ava
and xo
to ensure it work in node v4.
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 make these changes into two commit if you want to separate them.
cwd
option isn't a string
ad86c69
to
6500604
Compare
6500604
to
8ea2392
Compare
Thanks @dead-horse! |
The CLI build process is currently broken due to an interaction between pkg's "globby" dependency and "dir-glob". See more at vercel/pkg#603 and kevva/dir-glob#8
globby will pass
opts.cwd = undefined
to dir-glob, which leads to TypeError.