-
Notifications
You must be signed in to change notification settings - Fork 325
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
format
remains a string when set via ncurc.js
#1452
Comments
I think there's a couple options to fix this:
I'd be happy to submit a PR implementing any of them, if you've got a preference for which one. |
Hi, thanks for the thorough bug report. Interesting this slipped by for so long. Yes, the parse function should always be called on the user input. I think |
Sorry for the wait on the PR. It's been a busy week. I think I should have some time tomorrow, though. |
So... I just spent a while fixing the issue by updating how // insert config arguments into command line arguments so they can all be parsed by commander
const combinedArguments = [...process.argv.slice(0, 2), ...rcArgs, ...programArgs]
//...
program.parse(combinedArguments)
const combinedProgramOpts = program.opts() Which means that the output of Which is all to say that my original analysis was wrong. The bug isn't in the CLI, but in Edit: I understand what's going on now. Config gets parsed to args and also used by itself. That makes sense. I think I can make the necessary fixes. |
Steps to Reproduce
.ncurc.js:
Dependencies: Not relevant
Steps:
ncu
with the above config.Current Behavior
When the config is loaded,
format: 'group'
is loaded and kept as a string. Later, after selecting dependencies, ncu crashes with an error:TypeError: (r.format || []).filter is not a function
I did a little digging and determined that the error comes from runLocal.ts#L251. Since
'group'
is a string, it doesn't have a.format
method.This probably hasn't been noticed before because ncu works just fine with
format: 'group'
, so long asdeep: true
isn't also enabled. Other parts of the code -- such asoptions.format?.includes('group')
on runLocal.ts#L93 -- work largely as expected because strings also happen to have a mostly-compatible.includes
method.Specifying
format: ['group']
results in the correct behavior.Expected Behavior
I would expect one of two behaviors:
format
must be an array.I believe the latter option is the expected behavior, as the project's own
.ncurc.js
file usesformat: 'group'
.The text was updated successfully, but these errors were encountered: