Closed jaumard closed 8 years ago
Can you elaborate on why you need this?
In our generator we can specify additional module to install, each module can have a folder like archetype/**/*
and each folder/file under this folder need to be copied under the current generated project. But some module can have same files under this folder so yeoman ask if the user want to overwrite it or not (witch is fine) but not enough in order to our user to understand why an overwrite is needed for a new project.
So to be more clean we want to say before asking to override seems like 'The module Toto need to overwrite this file because.... '
Sorry if I'm not clear :/
Yeoman rely on a memory file system, so file writes occurs only once after the generation process. As such, you won't have conflict messages on new files even if they're modified by multiples composed generators.
You might need to update your version of yeoman-generator.
If fact yes we can have conflict message (and we want them cause in some case user don't want to overwrite it's file) because under an existing project we have a command to add new module and again copy it archetype files and now files exists. Currently we use yeoman-generator:0.21.1
.
@jaumard can you describe exactly the commands you run in your command line to reproduce this issue?
Here is the generator's commands https://github.com/trailsjs/trails#trailblaze and the generator is https://github.com/trailsjs/generator-trails
Basically first you create a project, and then a model that already exist like this :
yo trails
yo trails:model User
Yeoman say there a conflict and ask if user want to overwrite the files or not.
Oh okay, this happens because we're effectively overwriting files that have already be commited to disk.
I think that's the correct behavior and what we want as we can assume your users will add a lot of models to their app as time goes by.
For the user, there's no guarantee the generator won't break/delete code they relied upon. As so, Yeoman takes care itself of the conflicts so we can ensure our users that we won't overwrite their files without them knowing.
I don't think we want to change anything around this.
Yes that's it :) I don't want to change the behavior because it's fine and work great. I wonder if it's possible to add a field description
that will be used when a conflict occur ? Or maybe an event conflict
?
@jaumard maybe that should go in your documentation instead?
I'm not convinced we want to change that behavior. I don't see much gain for the added complexity.
You're right. I think we will add this on the documentation. Thanks :)
When a file exist yeoman ask if we want to overwrite it. Is it possible to have a custom message instead of "Overwrite file ?" ? Or add a message before maybe ?
I didn't find this on the doc.