Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line option to skip existing files #599

Open
splatteredbits opened this issue Aug 20, 2018 · 2 comments
Open

Add command line option to skip existing files #599

splatteredbits opened this issue Aug 20, 2018 · 2 comments

Comments

@splatteredbits
Copy link

We use Yo to generate content for new Git repositories. We have several in-house templates. Jobs to generate are run non-interactively through Jenkins. We'd like to be able to re-run our Yeoman templates on existing repositories without clearing their contents. In other words, if we have an updated template that adds a file, we'd like to add that file to our template and let our users re-run the Jenkins job and have that file added to the repository without overwriting any existing files.

Today, Yo prompts what you want to do when it finds a conflict. This doesn't work when running non-interactively. Yo has the --force switch, but that overwrites everything. This is not what we want. Users could easily have strayed from the defaults since the initially created their repository.

Because of this, we now have to write extra automation to add new files to repositories and we can't add them to the template. (Well, I guess we could, but then we'd have that file in two different places.)

Please add a --skip-existing or a --on-conflict <skip|overwrite|abort> switch to Yo so I can control what to do when handling conflicts.

@splatteredbits
Copy link
Author

I wouldn't mind putting together a pull request for this feature. I just need help navigating to the right spot in the code. I looked in the yo module but couldn't find where the --force switch gets used.

@SBoudrias
Copy link
Member

SBoudrias commented Aug 21, 2018

The options are all handled inside yeoman-generator. More specifically, conflicts resolution is handled over here: https://github.com/yeoman/generator/blob/master/lib/util/conflicter.js

I don't think adding this feature would cause issue - I think it might be quite handy for some use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants