Repository navigation
feat: respect required/optional option values - #1328
Conversation
| { | ||
| name: '--port [number]', | ||
| default: process.env.RCT_METRO_PORT || 8081, | ||
| parse: (val: number) => String(val), |
There was a problem hiding this comment.
This is incorrect. Values to be parsed are always string.
| name: '--all [boolean]', | ||
| name: '--all', | ||
| description: 'Link all native modules and assets', | ||
| parse: (val: string) => val.toLowerCase().split(','), |
There was a problem hiding this comment.
Not sure about this one, we don't support comma separated values, nor --all true, so just sticking to --all.
jamesgeorge007
left a comment
There was a problem hiding this comment.
CI is failing since you have removed assertRequiredOptions(); but not the reference to it.
Line 12 in ef98aee
|
Good catch! |
thymikee
left a comment
There was a problem hiding this comment.
Ok, let's do it. I added @jamesgeorge007 to the description so he gets some attribution.
|
#1324 (comment) Isn't this an issue? |
|
It will not. So here's what happened. I thought that So they must have fixed it in the meantime and we never refactored this code out. |
Summary:
Historically, we used to have
assertRequiredOptionsfunction present in the codebase as a workaround for a broken Commander feature.1/ It is now not needed to have it. While testing this PR, it turned out this function was necessary as Commander correctly throws on missing values. It was either a mistake while doing the original PR or the underlying issue got fixed.
2/ We don't need any additional logic to enforce values for options, e.g.
--path <value>. All we have to do is to use<>instead of[]. I have corrected the declaration when necessary to avoid issues.Originally started by @jamesgeorge007
Test Plan:
Run
react-native start --portand see it throw an error of a missingportvalue.