🏗 build(cli): extract args before running build cmd#196
Merged
tyler-dane merged 10 commits intomainfrom Jan 7, 2025
Merged
Conversation
60c043b to
2bda7f0
Compare
1259eb7 to
7b18fe2
Compare
this improves readability, because the class has access to the 'options', which means we don't have to keep passing that arg to the util functions
7b18fe2 to
90d8729
Compare
this makes the division of responsibilities more clear: the Validator parses cli args and validates their inputs against our types. The CLI is then free to accept the parsed args and simply trigger the provided commands
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.
This pull request includes significant refactoring and improvements to the CLI tools, including the introduction of a new
CliValidatorclass, enhancements to the build and delete commands, and the addition of thezodlibrary for schema validation. The most important changes are summarized below:CLI Refactoring:
CliValidatorclass: Added a newCliValidatorclass to handle CLI option validation and error handling, replacing inline validation logic. (packages/scripts/src/cli.validator.ts)cli.ts: Refactored the CLI script to use the newCliValidatorclass and encapsulated CLI logic within aCompassCliclass for better modularity and maintainability. (packages/scripts/src/cli.ts)Build and Delete Command Enhancements:
runBuildfunction and related helper functions to use the new options structure and environment handling. (packages/scripts/src/commands/build.ts) [1] [2] [3] [4]CliValidatorclass. (packages/scripts/src/cli.ts)Schema Validation:
zodlibrary: Introduced thezodlibrary for schema validation of CLI options, ensuring that the provided options adhere to the expected structure. (packages/backend/package.json)zodand integrated them into the validation process. (packages/scripts/src/common/cli.types.ts)Utility Functions:
packages/scripts/src/common/cli.utils.ts) [1] [2]These changes collectively enhance the robustness, maintainability, and user experience of the CLI tools.
Closes #195