Open kachkaev opened 2 years ago
Would love to see this too!
Note that in yarn >2.4.3
(also tested in 3.6.0
and 4.0.0-rc.46
) yarn workspace client run
returns the following which could be used to inform the completions.
> yarn workspace client run
➤ YN0000: clean 'rm -rf node_modules'
➤ YN0000: lint 'tsc --noEmit && eslint "src/**/*.ts*"'
➤ YN0000: start 'node index.js'
➤ YN0000: Done in 0s 2ms
Unfortunately the --json
argument doesn't seem to work yet.
👋 folks! I’ve been a heavy user of yarn workspaces for some time and would like to suggest an improvement to autocompletions. It might be quite a difficult one to implement, but is at least worth tracking.
Let’s take this repo as an example: https://github.com/ferreiro/example-monorepo
We have two folders:
packages/client
andpackages/server
. They correspond to workspaces namedclient
andserver
, respectively (the names are located inpackage.json
files).In a broader case, any folder can be a workspace and the name of the package can be anything, e.g. a folder named
/apps/docs
may map to a workspace named@mycorp/my-docs-app
.This repo’s yarn completion works well up to this point:
That's useful, especially if a workspace starts with
@
and is therefore lengthy. If we press tab after the workspace name, we will always see:That‘s cool, but the list is not as complete as for the root workspace. What would be really cool is to also get autocompletion for scripts, binaries and local file names within a workspace:
The are two main challenges:
yarn workspaces info
in Yarn 1yarn workspaces list --json
in Yarn 2+I’d be keep to help if this plugin was written in JavaScript, but my knowledge of shell is way too limited to grab this improvement task. 😅 Happy to take part in testing if needed! 🙌