quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.97k stars 3.53k forks source link

npm init quasar really deletes everything #15489

Open ViToni opened 1 year ago

ViToni commented 1 year ago

What happened?

When trying to get started with a project (again), I executed npm init quasar for the current directory. While I expected the installation to eventually delete / overwrite the existing README.md, I was more than surprised that it also removed the unrelated .git directory.

node:fs:1213
  return handleErrorFromBinding(ctx);
         ^

Error: ENOTEMPTY: directory not empty, rmdir '/Users/vtoni/git/my-project/.git'
    at Object.rmdirSync (node:fs:1213:10)
    at _rmdirSync (node:internal/fs/rimraf:260:21)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at Object.rmSync (node:fs:1262:10)
    at Object.removeSync (/Users/vtoni/.npm/_npx/ab81a6c56658d74b/node_modules/fs-extra/lib/remove/index.js:15:28)
    at /Users/vtoni/.npm/_npx/ab81a6c56658d74b/node_modules/fs-extra/lib/empty/index.js:30:12
    at Array.forEach (<anonymous>)
    at emptyDirSync (/Users/vtoni/.npm/_npx/ab81a6c56658d74b/node_modules/fs-extra/lib/empty/index.js:28:9)
    at module.exports.createTargetDir (/Users/vtoni/.npm/_npx/ab81a6c56658d74b/node_modules/create-quasar/utils/index.js:36:3)
    at module.exports (/Users/vtoni/.npm/_npx/ab81a6c56658d74b/node_modules/create-quasar/templates/app/quasar-v2/js-vite/index.js:52:9) {
  errno: -66,
  syscall: 'rmdir',
  code: 'ENOTEMPTY',
  path: '/Users/vtoni/git/my-project/.git'
}

Node.js v19.6.1
npm ERR! code 1
npm ERR! path /Users/vtoni/git/my-project
npm ERR! command failed
npm ERR! command sh -c create-quasar

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vtoni/.npm/_logs/2023-02-24T18_44_43_996Z-debug-0.log

I strongly belive that's not an ideal solution.

What did you expect to happen?

Ignore existing .git directry.

Reproduction URL

How to reproduce?

  1. mkdir my-project
  2. cd my-project
  3. touch README.md
  4. git add README.md
  5. git commit -m "Initial commit"
  6. npm quasar init
  7. ... Project folder: … .
  8. ... Current directory is not empty. Remove existing files and continue? … yes

I know it says Remove existing files and continue? but having to reinititate git or to move the result to a directory already having a git history seems not that helpful.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Platforms/Browsers

Other

Quasar info output

No response

Relevant log output

No response

Additional context

No response

github-actions[bot] commented 1 year ago

Hi @ViToni! 👋

It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏