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: expanded missing command error, including 'did you mean' #6496
Conversation
💖 Thanks for opening this pull request! 💖 |
Create a changeset |
925cd1b
to
78d14ac
Compare
78d14ac
to
1dccd9c
Compare
Looks like it doesn't work on Windows. |
5dd1dd8
to
a242ea1
Compare
This is the error message on Windows:
it doesn't have the original message. So, I am not sure how we can know the reason it failed. I guess we could use |
|
Co-authored-by: Zoltan Kochan <z@kochan.io>
@@ -208,6 +210,9 @@ export async function handler ( | |||
result[prefix].status = 'passed' | |||
result[prefix].duration = getExecutionDuration(startTime) | |||
} catch (err: any) { // eslint-disable-line | |||
if (await isErrorCommandNotFound(params[0], err)) { | |||
err.hint = buildCommandNotFoundHint(params[0], (await readProjectManifestOnly(opts.dir)).scripts) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 if I add an else
after this locally, then the command properly throws err
after setting err.hint
. But without the else
, we only get the exitCode = err.exitCode
. Is there a reason to run the if (!opts.recursive ...
check if we know the failure is from the command not being found?
The tests fail now because of |
This reverts commit 204d354.
Congrats on merging your first pull request! 🎉🎉🎉 |
close #6492 Co-authored-by: Zoltan Kochan <z@kochan.io>
Fixes #6492
For both the
exec
andrun
commands, adds ahint
property based on a newbuildCommandNotFoundHint
utility.Reuses the
didyoumean2
package already used elsewhere in pnpm (and, fun fact, npm & yarn!).Co-authored-by: Zoltan Kochan z@kochan.io