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 initializing non-empty directory #12958

Closed
4 tasks done
Kinrany opened this issue Apr 23, 2023 · 6 comments · Fixed by #15272
Closed
4 tasks done

Allow initializing non-empty directory #12958

Kinrany opened this issue Apr 23, 2023 · 6 comments · Fixed by #15272
Labels

Comments

@Kinrany
Copy link

Kinrany commented Apr 23, 2023

Description

When Vite finds files in the current directory, it offers no option to ignore existing files even when they are completely irrelevant, like a shell.nix file used to install Node.

Suggested solution

There should be an extra option: to keep the files and continue anyway.

Alternative

No response

Additional context

No response

Validations

@fi3ework
Copy link
Member

fi3ework commented May 1, 2023

Isolated irrelevant will not be processed by Vite. Could you provide a repro to demonstrate your issue?

@github-actions
Copy link

github-actions bot commented May 1, 2023

Hello @Kinrany. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@Kinrany
Copy link
Author

Kinrany commented May 1, 2023

A repo with an empty file named shell.nix in the directory does this, doesn't it? I can make one, but there's not a lot to reproduce.

@fi3ework
Copy link
Member

fi3ework commented May 3, 2023

made a repro https://stackblitz.com/edit/vitejs-vite-x2aaj6?file=shell.nix&terminal=dev and didn't see anything wrong. Could you describe it in more detail?

@Kinrany
Copy link
Author

Kinrany commented May 3, 2023

Sorry, I did miss a part. Initialization is not done by Vite itself.

From Getting Started > Scaffolding Your First Vite Project:

With NPM:

npm create vite@latest

So here's what it looks like when the directory is completely empty (no package.json, nothing) save for a single shell.nix file:

❯ npm create vite@latest
success Install finished in 1.131s

✔ Project name: … .
✔ Current directory is not empty. Remove existing files and continue? … no
✖ Operation cancelled

We chose . as the project name, which makes it initialize a project in the current directory. It detects that the directory isn't empty and gives us a choice between deleting everything and aborting initialization.

The suggestion is to add "ignore existing files and continue" as the third option.

@fi3ework fi3ework added enhancement New feature or request and removed needs reproduction labels May 3, 2023
@ze
Copy link

ze commented Jun 12, 2023

+1 to this. I have a build system that wraps around NPM where I need to have a specified build file. From that build file, I have my npm config which allows me to run commands like tool create vite@latest. However, I can't do this because the directory is not empty due to that one build file.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants