Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(remix): replace yargs with native util.parseArgs#19532
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,68 +1,74 @@ | ||||||||||||||||||
| #!/usr/bin/env node | ||||||||||||||||||
| const yargs = require('yargs'); | ||||||||||||||||||
| const { parseArgs } = require('node:util'); | ||||||||||||||||||
| ||||||||||||||||||
| const{ parseArgs }=require('node:util'); | |
| // TODO: remove when node v18 support drops | |
| letparseArgs; | |
| try{ | |
| parseArgs=require('node:util').parseArgs; | |
| }catch{ | |
| parseArgs=require('@pkgjs/parseargs').parseArgs; | |
| } |
Uh oh!
There was an error while loading. Please reload this page.
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.
Bug: The script uses
util.parseArgs, which will crash on Node.js versions 18.0.0-18.2.x, despite thepackage.jsonallowing these versions.Severity: MEDIUM
Suggested Fix
Update the
package.jsonenginesfield to require"node": ">=18.3.0". Alternatively, add a runtime check forutil.parseArgsand provide a helpful error message or a fallback implementation for older Node.js versions.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Since our minimum is 18.0 we need to have a fallback for utils.parseArgs
Uh oh!
There was an error while loading. Please reload this page.
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.
We could add
@pkgjs/parseargsas a dependency instead of yargs, and keep that around until we drop v18 support. It's at least less of a cost than yargs, because it's much smaller.