Skip to content

Commit

Permalink
Revise output of workspaces:list-versions script
Browse files Browse the repository at this point in the history
`yarn workspaces:list-versions` can be run to quickly obtain the list of
packages in this monorepo and their current versions.

However, this output is a bit difficult to read, because the names of
each package are right-aligned. This commit left-aligns them and then
adds dots in between the package name and its version for readability.

For instance, here is the current output as of this commit:

```
@metamask/accounts-controller.....................20.0.1
@metamask/address-book-controller.................6.0.2
@metamask/announcement-controller.................7.0.2
@metamask/approval-controller.....................7.1.1
@metamask/assets-controllers......................45.1.1
@metamask/base-controller.........................7.0.2
@metamask/build-utils.............................3.0.2
@metamask/chain-controller........................0.2.1
@metamask/composable-controller...................9.0.1
@metamask/controller-utils........................11.4.4
@metamask/ens-controller..........................15.0.1
@metamask/eth-json-rpc-provider...................4.1.6
@metamask/gas-fee-controller......................22.0.2
@metamask/json-rpc-engine.........................10.0.1
@metamask/json-rpc-middleware-stream..............8.0.5
@metamask/keyring-controller......................19.0.1
@metamask/logging-controller......................6.0.3
@metamask/message-manager.........................11.0.2
@metamask/multichain..............................1.1.1
@metamask/name-controller.........................8.0.2
@metamask/network-controller......................22.1.0
@metamask/notification-services-controller........0.15.0
@metamask/permission-controller...................11.0.4
@metamask/permission-log-controller...............3.0.2
@metamask/phishing-controller.....................12.3.1
@metamask/polling-controller......................12.0.2
@metamask/preferences-controller..................15.0.1
@metamask/profile-sync-controller.................3.0.0
@metamask/queued-request-controller...............8.0.1
@metamask/rate-limit-controller...................6.0.2
@metamask/remote-feature-flag-controller..........1.1.0
@metamask/selected-network-controller.............20.0.1
@metamask/signature-controller....................23.0.1
@metamask/transaction-controller..................41.1.0
@metamask/user-operation-controller...............20.0.1
```
  • Loading branch information
mcmire committed Dec 3, 2024
1 parent a6937e3 commit 49b29ab
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions scripts/list-workspace-versions.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/usr/bin/env bash

if [[ "$1" == "--json" ]]; then
list-workspace-names-and-versions() {
yarn workspaces list --json --no-private | \
jq --raw-output '.location' | \
xargs -I{} cat '{}/package.json' | \
xargs -I{} cat '{}/package.json'
}

if [[ "$1" == "--json" ]]; then
list-workspace-names-and-versions | \
jq --slurp 'map({name, version})'
else
yarn workspaces list --json --no-private | \
jq --raw-output '.location' | \
xargs -I{} cat '{}/package.json' | \
list-workspace-names-and-versions | \
jq --raw-output '"\(.name) \(.version)"' | \
xargs printf '%40s %s\n'
xargs printf '%-50s%s\n' | \
tr ' ' '.'
fi

0 comments on commit 49b29ab

Please sign in to comment.