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 support for running create-astro in cloned empty git repository #4805

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

HiDeoo
Copy link
Member

@HiDeoo HiDeoo commented Sep 19, 2022

Changes

When initializing a new Astro project, I realized that it is not currently possible to run create-astro in a cloned empty git repository. The current behavior is to check for truly empty directories. This could also be an issue for macOS users trying create a new Astro project in an existing directory containing a .DS_Store file.

I researched how other CLI tools handle this situation and found various solutions:

This pull request adds support for this feature by using the same approach as Create React App & Create Next App and adding a list of file / directory names (or patterns) that can be safely ignored when checking for a valid project directory.

Testing

I added a test to check if create-astro is proceeding in a non-empty safe directory using a new nonempty-safe-dir fixture that contains an empty .gitignore file and module.iml file (both should be ignored respectively by an exact name match and a pattern match).

Docs

I couldn't find any mention of this specific behavior in the documentation so I'm not sure if any changes are needed.

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2022

🦋 Changeset detected

Latest commit: 1c65c13

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-astro Patch

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

@github-actions github-actions bot added the pkg: create-astro Related to the `create-astro` package (scope) label Sep 19, 2022
@matthewp
Copy link
Contributor

This looks great, thanks!

@matthewp matthewp merged commit c84d85b into withastro:main Sep 20, 2022
@astrobot-houston astrobot-houston mentioned this pull request Sep 20, 2022
@HiDeoo HiDeoo deleted the hd-create-astro-nonempty-safe branch September 20, 2022 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: create-astro Related to the `create-astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants