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

feat(create-vite): support create-electron-vite #12390

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

caoxiemeihao
Copy link
Contributor

Description

Additional context

fixes #12288


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Mar 13, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@bluwy
Copy link
Member

bluwy commented Mar 13, 2023

When running locally, it looks like Vite would create the new project folder, then call create-electron-vite, which errors because the new project folder was already created.

bjorn@Bjorns-MacBook-Pro create-vite % node index.js
✔ Project name: … vite-project
✔ Select a framework: › Others
✔ Select a variant: › create-electron-vite ↗
Need to install the following packages:
  create-electron-vite@0.2.0
Ok to proceed? (y) 
✔ Project template: › Vue
🚧 Directory 'vite-project' already exists.
npm ERR! code 1
npm ERR! path /Users/bjorn/Work/oss/vite/packages/create-vite
npm ERR! command failed
npm ERR! command sh -c -- create-electron-vite vite-project

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bjorn/.npm/_logs/2023-03-13T03_19_22_263Z-debug-0.log

I think create-electron-vite needs to be updated to handle creating in empty directories since Vite allows that by default even if the directory is created before calling the CLI. We also allow .git in the empty directories.

@bluwy bluwy added the p2-nice-to-have Not breaking anything but nice to have (priority) label Mar 13, 2023
@caoxiemeihao
Copy link
Contributor Author

caoxiemeihao commented Mar 13, 2023

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Awesome! Works great

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Linking to create-electron-vite opens the door to many other projects, and some of them have already asked for this and we have so far pushed to keep create-vite minimal and re-directed them to create-vite-extra. deno is a good example, and nx asked us a few weeks ago. I think we should also link to Astro, Solid Start, Qwik City, Marko Run, and Tauri among others.

I think we should merge this PR only if we are planning to merge create-vite-extra and create-vite into a single project, to give create-vite a more general status. I'm approving this PR assuming that is the case.

Interested to hear your current thoughts on this @bluwy

@bluwy
Copy link
Member

bluwy commented Mar 13, 2023

I think we should merge this PR only if we are planning to merge create-vite-extra and create-vite into a single project, to give create-vite a more general status. I'm approving this PR assuming that is the case.

I'm not sure if this PR gives the idea that we need to merge create-vite-extra and create-vite? create-vite-extra can still be extra stuff that we're not comfortable in adding to create-vite, but over time we can move those we're comfortable with into create-vite, so somewhat of a partial merge.

@patak-dev
Copy link
Member

That's fair. A merge isn't needed and it is true that keeping create-vite-extra could be a good playground not only for adding new projects but also for adding new features (like adding an optional testing setup for example?). And I realize I was probably thinking about create-vite-extra with a smaller scope than you all this time.

I still think this PR expands create-vite scope (that is good, I agree with the expansion), and that if we go here, we should then add links to nx, astro, tauri, etc. And we should also decide how a project is accepted. That I'm fine keeping the rule loose and use common sense and proximity between the project and Vite core.

@bluwy
Copy link
Member

bluwy commented Mar 14, 2023

Sounds good 👍 I think we can let the ecosystem add links to their CLI if they want though, but certainly nx, Astro, etc should be good to add too. Also make sense to keep the rule a bit loose for now.

@patak-dev patak-dev merged commit 708133e into vitejs:main Mar 16, 2023
@caoxiemeihao caoxiemeihao deleted the create-electron-vite branch March 16, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Electron Apps With Vite
3 participants