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

fix(init): skip existing files instead of erroring #20434

Merged
merged 13 commits into from Sep 12, 2023

Conversation

leighmcculloch
Copy link
Contributor

What

Skip writing files from the template if the files already exist in the project directory.

Why

When I run deno init in a directory that already has a main.ts, or one of the other template files, I usually want to initialize a workspace around a file I've started working in. A hard error in this case seems counter productive. An informational message about what's being skipped seems sufficient.

Close #20433

@CLAassistant
Copy link

CLAassistant commented Sep 9, 2023

CLA assistant check
All committers have signed the CLA.

@leighmcculloch leighmcculloch marked this pull request as ready for review September 9, 2023 18:31
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for this change!

@dsherret dsherret enabled auto-merge (squash) September 9, 2023 19:22
@dsherret dsherret changed the title feat(init): skip existing files fix(init): skip existing files instead of erroring Sep 9, 2023
@dsherret dsherret enabled auto-merge (squash) September 9, 2023 19:30
auto-merge was automatically disabled September 9, 2023 19:32

Head branch was pushed to by a user without write access

@dsherret dsherret enabled auto-merge (squash) September 9, 2023 19:34
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, one nitpick from me (not a blocker to land)

cli/tools/init/mod.rs Outdated Show resolved Hide resolved
@bartlomieju
Copy link
Member

@leighmcculloch looks good! Can you please update the test assertion to make CI happy?

@leighmcculloch
Copy link
Contributor Author

@bartlomieju Fixed in 110ed03 and test passes locally. Could you approve CI to rerun?

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bartlomieju bartlomieju merged commit 4a8b873 into denoland:main Sep 12, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deno cli: init should not error if main.ts already exists
4 participants