dsifford / yarn-completion

Bash completion for Yarn
MIT License
277 stars 25 forks source link

Scripts completion does not work from a subdirectory #16

Closed kachkaev closed 6 years ago

kachkaev commented 6 years ago

I noticed that moving to a sub-directory breaks project-specific autocompletion such as for scripts.

project/package.json

{
  "scripts": {
    "do-something": "echo 'hello'"
  }
}
cd project
yarn do-s # tab 🎉 
yarn do-something
cd project/docs
yarn do-s # tab ❌

It'd be great if yarn-completion searched for the nearest parent package.json if it is not found in cwd.

dsifford commented 6 years ago

This seems reasonable. I'll look into it when I get time.

PRs also accepted.