Closed jmccance closed 6 months ago
Looks like #653 would also be a possible solution if re-ordering the fallbacks isn't desired.
If it re-ordering is acceptable, let me know and I can open a PR.
Thank you for creating an issue. I will release the fix this week
Excellent, thanks!
:wrench: Summary
When
npx
is available on the path, the hook scripts will never use the Swift runner.This can be a problem if a developer has an incorrectly configured Node environment and is trying to commit to a Swift project configured with the SPM plugin.
Lefthook version
1.6.4
Steps to reproduce
Package.swift
file and the Swift lefthook-plugin.lefthook
is not available through any of the fallbacks that come beforenpx
.npx
is available in your path. (For testing purposes, can doalias npx=false
.)Expected results
The commit should complete successfully using the Swift Lefthook plugin.
Actual results
npx
is used to try to run Lefthook.Possible Solution
Re-order the fallbacks so the Swift test comes before the check for the
npx
command.Logs / Screenshots
Not much to show here, since Lefthook never actually runs. What one of our engineers ran into, though, was that their broken Node environment resulted in this error when trying to commit to our Swift repo with Lefthook enabled.