-
-
Notifications
You must be signed in to change notification settings - Fork 39
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 parseOpts() option #135
Support parseOpts() option #135
Conversation
`standard-engine` has all the information it needs to resolve these options. `deglob` shouldn't have to repeat the work of finding the `package.json`. This will make it easier to control the `ignore` globs in a custom options parser, for which see <standard#135>. Requires standard/deglob#6 to be released and the minimum version to be bumped.
This doesn't seem very useful to me. What's the use case? |
if (self.customParseOpts) { | ||
var filepath = pkgConf.filepath(packageOpts) | ||
var rootDir = filepath ? path.dirname(filepath) : opts.cwd | ||
opts = self.customParseOpts(opts, packageOpts, rootDir) || opts |
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.
This is too magical, let's just require them to return opts
.
You only need one (direct) dependency to get the location of the |
@novemberborn Sounds good. Can you fix up the other inline feedback and I'll merge. |
@feross yup, it's on my to do list. |
@novemberborn Any chance you can finish up this PR? 🙏 |
@feross it's pretty high on my OSS to-do list, though I'm traveling at the moment and there's plenty non-computer distractions 😄 |
pkg-conf can find config without throwing exceptions. It returns an empty object by default, simplifying logic. And, usefully, it lets you determine the path of the loaded `package.json` file. pkg-config caches the JSON, though not the file resolution. I doubt the caching has any measurable impact when it comes to `standard-engine` and its use. Caching could be implemented on top of pkg-conf if necessary though.
a6bcbe1
to
145e5ce
Compare
Fixed merge conflict and addressed feedback. |
Nice, looks good to me now! |
This replaces find-root and pkg-config by pkg-conf.
pkg-conf can find config without throwing exceptions. It returns an
empty object by default, simplifying logic. And, usefully, it lets you
determine the path of the loaded
package.json
file.pkg-config caches the JSON, though not the file resolution. I doubt the
caching has any measurable impact when it comes to
standard-engine
andits use. Caching could be implemented on top of pkg-conf if necessary
though.
Adds support for a
parseOpts()
option inoptions.js
. Fixes #132.