fix(ts-interface-generator): pass process.argv to yargs so CLI flags work#573
Merged
Conversation
…work The yargs v18 migration (bf53c43) rewrote the CLI from the singleton pattern (yargs.option({...}).argv) to the factory pattern (yargs().option({...}).argv). The factory creates a detached instance that never reads process.argv, so --jsdoc, --watch, --config, and --loglevel were all silently ignored — every run used defaults. Fix: pass hideBin(process.argv) explicitly per the yargs v18 API. Closes #542
There was a problem hiding this comment.
Pull request overview
This PR addresses @ui5/ts-interface-generator CLI flag parsing so --jsdoc minimal/none is correctly applied when invoked from the command line (root cause of issue #542), and adds regression tests around JSDoc preference behaviors.
Changes:
- Pass
hideBin(process.argv)intoyargs(...)so CLI flags are actually parsed. - Add Jest tests validating JSDoc output differences for
verbose,minimal, andnonemodes. - Add tests demonstrating the yargs factory behavior that led to the regression.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/ts-interface-generator/src/generateTSInterfaces.ts | Fix CLI arg parsing by wiring process.argv into yargs via hideBin. |
| packages/ts-interface-generator/src/test/jsdocPreference.test.ts | Add tests for JSDoc preference modes and yargs argv parsing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The yargs v18 migration (bf53c43) rewrote the CLI from the singleton
pattern (yargs.option({...}).argv) to the factory pattern
(yargs().option({...}).argv). The factory creates a detached instance
that never reads process.argv, so --jsdoc, --watch, --config, and
--loglevel were all silently ignored — every run used defaults.
Fix: pass hideBin(process.argv) explicitly per the yargs v18 API.
Closes #542