hatchify icon indicating copy to clipboard operation
hatchify copied to clipboard

Handling edge case bugs of create app command

Open spenserhale opened this issue 10 months ago • 0 comments

Fixing three bugs:

  1. If your project name has spaces, the command will fail. Now, packageName is used as the folder name. In the future, the project name could be used, but this would require a larger rewrite to support.
  2. npm create vite@latest never ran on node version 20+. Now, it uses the exec command instead of spawn.sync(). Also, it now handles if the command fails and prints the error and exists.
  3. Reading the template package.json sometimes asks for the file before it is fully written to the OS (race condition). Now, it has a new function, readFileWithRetries, to wait for the file to be ready. It also handles if a file is not found by printing an error and exiting.

Other Changes: Updating CLI defaults to order match preferred, and making CLI version check a one-liner.

Tested on Node 20, 18.

spenserhale avatar Apr 15 '24 01:04 spenserhale