- 
                Notifications
    You must be signed in to change notification settings 
- Fork 230
          Add prompt for existing directory in init flow
          #1750
        
          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 prompt for existing directory in init flow
  
  #1750
              Conversation
| 🦋 Changeset detectedLatest commit: e79d45c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
 Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR | 
| 
 Fixed in #4eaf6a2 thanks. Also fixed when using  | 
| @0237h I think we should delete all files from the directory. Othewise we could be mixing different projects and/or committing a bunch of unrelated files into subgraph repository, which is not great. Unless you can think of a scenario where we would want to keep any old files in the directory we are overwriting. | 
| I would argue that it could be more dangerous deleting files. Right now, if you're not careful with the prompt, you'll end up overwriting/adding new files which isn't big deal. If we add deletion, one mistake and you could get files removed (any files). Also there might be some use cases where you have ABIs in a subfolder that you might want to keep ? | 
| Yes, I agree about deleting being dangerous. Although I'm still having hard time picturing when it would be useful to keep existing files in your repo. The ideal flow would probably be checking if directory exists right after the prompt and requiring to enter the different directory name. We can still keep "overwrite yes/no" prompt when generating the project. Can be a separate issue if that's too much work. | 

If the user is choosing an existing directory for creating a new subgraph, ask for confirmation.
If the answer is negative, abort the process.
Closes #1370