turborepo
a7516dca - refactor: compile args + config to opts (#9552)

Commit
1 year ago
refactor: compile args + config to opts (#9552) ### Description Refactors our config setup to explicitly transform the `Args` and `Config` to `Opts` in the `CommandBase` constructor. This accomplishes a few things: - Limits our usage of args beyond `cli`. Args are structured according to the CLI parsing logic, so there are multiple fields that do the same thing (args.command.run_args and args.run_args). By compiling down to `Opts`, we can use a more normalized structure. - Remove the requirement that we have a `Command::Run` to create a `Run` struct. This requires us to mock out a `Command::Run` in places like `query` or `ls`, which is unnecessary. - Fix a potential nasty bug where we change the `Args` struct via `CommandBase::args_mut` but that change is not propagated to the config because it's cached via a `OnceCell`. - Finally, and most importantly, allow us to construct a `Run` without `Args`. This is very important for `query`. However, this does create a change where `CommandBase::new` is now fallible. Overall this is fine, but it does mean that we sometimes error earlier than before. I couldn't figure out an alternative without making `Config` reactive on any `Args` change ### Testing Instructions <!-- Give a quick description of steps to test your changes. -->
Author
Parents
Loading