blitz
blitz copied to clipboard
If a recipe specifies a file that does not exist in a addTransformFilesStep, blitz crashes oddly
What do you want and why?
I typo'ed a file path in a recipe, like
singleFileSearch: 'mailers/forgotPasswordMailer' // missing the .ts
This produces this error:
➜ test-post git:(main) ✗ blitz install ~/p/blitz-postmark-recipe
(node:47036) UnhandledPromiseRejectionWarning: Error: At least one choice must be selectable
at AutoComplete.reset (/Users/tmcw/p/blitz-postmark-recipe/node_modules/enquirer/lib/types/array.js:38:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at AutoComplete.initialize (/Users/tmcw/p/blitz-postmark-recipe/node_modules/enquirer/lib/types/array.js:25:5)
at /Users/tmcw/p/blitz-postmark-recipe/node_modules/enquirer/lib/prompt.js:236:7
(node:47036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:47036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✅ Installed 3 dependencies
This is because if the singleFileSearch fails, then blitz assumes that you want to do a multi-select, but then choices is null, hence the crash.
Possible implementation(s)
I think the gist is: if choices is null here
https://github.com/blitz-js/blitz/blob/63af540c879fe71dfad561d814b4da57dcafe576/packages/installer/src/executors/file-prompt.ts#L33
Then throw an informative error.
Thank you for reporting this!
I want to work on this issue
Go ahead @arvinf07 🚀