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

allow cdk init in non-empty directory #1758

Closed
Vandivier opened this issue Feb 13, 2019 · 1 comment · Fixed by #1766
Closed

allow cdk init in non-empty directory #1758

Vandivier opened this issue Feb 13, 2019 · 1 comment · Fixed by #1766
Labels
bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI

Comments

@Vandivier
Copy link

step 1 - create empty repo
step 2 - cd in and cdk init app --langugage=...

receive cdk init cannot be run in a non-empty directory!

This is probably because of the hidden .git folder no? Why should that be problematic for the cdk? I think we should allow this. It can be worked around by making an arbitrary dir, but why should we do that? On second thought, I think we should allow cdk init if no conflicting folders/files exist. On third thought, we might just notify the user and allow them to y/n eg "You ran cdk init but README.md already exists which conflicts with aws-cdk. If you proceed the prior file will be overwritten."

Thoughts?

@sam-goodwin sam-goodwin added bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI labels Feb 14, 2019
@rix0rrr rix0rrr added bug This issue is a bug. and removed bug This issue is a bug. labels Feb 14, 2019
rix0rrr pushed a commit that referenced this issue Feb 14, 2019
Don't block 'cdk init' on the presence of files start with '.'.

In particular, don't care about the presence of a '.git' directory.

Fixes #1758.
rix0rrr added a commit that referenced this issue Feb 14, 2019
Don't block 'cdk init' on the presence of files start with '.'.

In particular, don't care about the presence of a '.git' directory.

Fixes #1758.
@Lilja
Copy link
Contributor

Lilja commented Sep 15, 2021

It would be amazing if this also could be supported for when you create an subdirectory in your app like this:

$ mkdir infra && cd infra
$ yarn add -D aws-cdk
$ yarn cdk init --language=python
error: cannot be run in a non-empty directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants