Conversation
Contributor
Coverage Report for ./packages/devkit
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
b5904c7 to
d0adef5
Compare
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 addresses a critical issue where a failed
dk newcommand would leave a partially created project directory behind, cluttering the user's workspace with corrupted files.The fix introduces robust cleanup logic to ensure the project directory is removed if any step in the scaffolding process fails after the directory has been created.
🛠️ Changes Implemented
try...catchblock inscaffoldProjectnow checks theprojectDirCreatedflag. If a failure occurs and the directory was internally created (i.e., not by an external CLI likenpm create-...), the entire directory is removed usingfs.remove().javascript.tsto a new helper function,scaffold-template.ts. This improves modularity and clarifies which parts of the process are responsible for directory creation.javascript.test.tsthat reliably mocks a dependency installation failure and asserts that the cleanup function (mockFsRemove) is called, proving the safety net works.🎯 Key Benefit
Users will no longer have to manually clean up directories after a failed attempt to create a project due to network issues, dependency conflicts, or template errors. The CLI now ensures a clean slate on failure.
Fixes # (issue)
Type of change
Checklist: