-
Notifications
You must be signed in to change notification settings - Fork 135
CLI #400
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
base: main
Are you sure you want to change the base?
CLI #400
Conversation
cli/src/args.rs
Outdated
/// Generates only a single index.ts file in your --output-directory that | ||
/// contains all exported types | ||
#[arg(long = "merge")] | ||
pub merge_files: bool, |
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.
The implementation of the CLI is a breaking change for anyone who uses |
Hey @NyxCode, I merged #334 into the CLI and added a command to generate a default config file. I also removed the What do you think of the current state of the CLI? Are there other features you want to include? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cli/src/config.rs
Outdated
no_warnings: self.no_warnings || other.no_warnings, | ||
esm_imports: self.esm_imports || other.esm_imports, | ||
format: self.format || other.format, | ||
generate_index_ts: self.generate_index_ts || other.generate_index_ts, | ||
no_capture: self.no_capture || other.no_capture, |
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.
I'm thinking this isn't proper behavior for merging booleans when it comes to CLI vs Config file. I think the CLI should override the config file, but if the config file has no_warnings=true
and the CLI has --no-warnings=false
the config file would win due to the OR operator. Maybe the flags should be Option<bool>
so the merging would look like self.no_warnings.or(other.no_warnings)
, then, instead of if args.no_warnings { /*...*/ }
, we'd have if args.no_warnings == Some(true) { /*...*/ }
(or is_some_and(|x| x)
or unwrap_or(false)
, etc)
Is there some work that I could contribute to this to help this PR get merged? I'm needing a way to generate barrel files (those index.ts files that reexport everything). PS: NyxCode. Nice name. :3 |
Hello @CriusNyx , I'm not quite sure if/when this might be merged, as there are a few possible concerns about it:
All that being said, you can install it with the following command: |
I'm copying the original
cli
PR into a new one for a couple of reasons:Closes #133
Closes #54
Closes #408
Todo
ts-rs
tests through this CLIexport
tots-rs
that re-enables test generation.index.ts
file to reexport all the generated typesgenerate-metadata
config
flag to pass the path to the file?init
subcommand to help create the config filecargo binstall
Feature wishlist
number
vsbigint
) (@NyxCode) (being worked on in proof-of-concept of type overrides using the CLI #334)#[ts(export_to = "...")]
to the same file #316)index.ts
file, re-exporting types (@NyxCode) (See explanation above)Checklist