Yeoman (YN) Practice Test

Session length

1 / 20

What pattern should you follow to guard against overwriting existing files during conflict resolution in Yeoman?

Use a generic overwrite policy for all files

Use the conflicts phase and Yeoman's built-in conflict handling to prompt for overwrites instead of blindly overwriting

Safely handling existing files in Yeoman relies on using the conflicts phase and Yeoman’s built-in conflict handling. When a file already exists at the destination, Yeoman detects it and, if the content would be changed, prompts the user to decide what to do—overwrite, skip, or review the change. This pattern puts the user in control and prevents accidental data loss, which is exactly what you want during conflict resolution. It also keeps the generator’s workflow clean and predictable, aligning with Yeoman’s design.

Blanket overwriting would risk destroying user files, and disabling file generation or writing everything to a temporary directory undermines the generator’s purpose and complicates the final project structure. Using Yeoman’s conflicts mechanism provides a safe, user-driven way to resolve differences as you assemble the project.

Disable file generation to avoid overwrites

Always write files to a temporary directory and then move them

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy