🏗 build(cli): extract args before running build cmd #196
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
CliValidator
class, enhancements to the build and delete commands, and the addition of thezod
library for schema validation. The most important changes are summarized below:CLI Refactoring:
CliValidator
class: Added a newCliValidator
class 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 newCliValidator
class and encapsulated CLI logic within aCompassCli
class for better modularity and maintainability. (packages/scripts/src/cli.ts
)Build and Delete Command Enhancements:
runBuild
function and related helper functions to use the new options structure and environment handling. (packages/scripts/src/commands/build.ts
) [1] [2] [3] [4]CliValidator
class. (packages/scripts/src/cli.ts
)Schema Validation:
zod
library: Introduced thezod
library for schema validation of CLI options, ensuring that the provided options adhere to the expected structure. (packages/backend/package.json
)zod
and 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