chore(scripts): add cli dispatcher helper #4312
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
n/a
Description
This adds an optional CLI helper.
I have spent a fair amount of time in CLI navigating across folders in clients, packages, etc and running commands like
yarn build
oryarn test
.This CLI helper assists in the dispatch of commands to package contexts.
Syntax:
Command bin/exe
Usage examples
yarn build in clients/client-s3
yarn build:docs in clients/client-marketplace-entitlement-service
yarn test in packages/middleware-signing
How does it work?
The package name query is used to find the package within clients, lib, or packages, and the npm script query is used to
find a command to execute.
In both queries, you can use space-separated substrings. They must occur in the matching package or command in linear order. Priority is given to whole-word matches, initial word matches, and shorter strings. If your instructions are ambiguous the first priority match will be executed. Use the dry-run or confirm options to check your command before execution.
Additional options:
--dry (dry run), --c (confirm before execution), --help
Testing
Manual testing