You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👋 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.
We have two folders: packages/client and packages/server. They correspond to workspaces named client and server, respectively (the names are located in package.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.
yarn workspace c →
yarn workspace client
yarn workspace s →
yarn workspace server
yarn workspace @m →
yarn workspace @mycorp/
yarn workspace @mycorp/m →
yarn workspace @mycorp/my-docs-app
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:
add -- Installs a package and any packages that it depends on
bin -- Displays the location of the yarn bin folder
list -- List installed packages
remove -- Remove installed package from dependencies updating package.json
upgrade -- Upgrades packages to their latest version based on the specified range
upgrade-interactive -- Interactively upgrade packages
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:
yarn workspace client st →
yarn workspace client start
## because we have packges/client/package.json → scripts → start
yarn workspace @mycorp/my-docs-app j →
yarn workspace @mycorp/my-docs-app jest
## because we have apps/docs/node_modules/.bin/jest
yarn workspace @mycorp/my-docs-app jest s→
yarn workspace @mycorp/my-docs-app jest src/
yarn workspace @mycorp/my-docs-app jest src/hello.te →
yarn workspace @mycorp/my-docs-app jest src/hello.test.js
## because we have apps/docs/src/hello.test.js
The are two main challenges:
resolve workspace location by name via
yarn workspaces info in Yarn 1
yarn workspaces list --json in Yarn 2+
get the list of scripts, binaries and files relative to a resolved workspace folder
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! 🙌
The text was updated successfully, but these errors were encountered:
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.
👋 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! 🙌
The text was updated successfully, but these errors were encountered: