hatchify
hatchify copied to clipboard
Handling edge case bugs of create app command
Fixing three bugs:
- 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.
- 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.
- 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.