feat(config): implement schema validation when loading configuration#96
Merged
feat(config): implement schema validation when loading configuration#96
Conversation
Contributor
Coverage Report for ./packages/devkit
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Description
This PR implements schema validation for CLI configuration files (
.devkitrc.jsonand local variants) to ensure data integrity, prevent runtime errors from malformed settings, and provide clear feedback to the user when a configuration is invalid.This change also refactors the template and settings display utilities to support multiple output modes (
treeandtable), and fixes a critical bug where templates sharing the same name but belonging to different languages would overwrite each other during processing.🚀 Key Changes
1. Configuration Validation and Error Handling
defaultPackageManager), the CLI will:dk configordk info).dk infoValidation Test: Added an integration test to specifically confirm thatdk infocorrectly reports an error when it encounters a malformed local configuration file.2. Enhanced Output Display (Tree/Table Modes)
printSettingsandprintTemplatesutilities are updated to accept amodeparameter (treeortable).printSettings: Settings can now be displayed in a clean key-value list (tree, default) or a formal table structure (table).3. Critical Template Processing Fix
printTemplateswhere the intermediate map key was based solely ontemplate._name. This caused templates with identical names across different languages (e.g.,javascript:basicandtypescript:basic) to overwrite each other.${template._language}:${template._name}), ensuring all templates are correctly loaded and available for filtering and display.✅ Testing
dk configto include new validation failure cases.dk infoto check validation failure reporting.printerutility to cover the newtreeandtabledisplay modes for both templates and settings.Fixes # (issue)
Type of change
Checklist: