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.
This PR proposes 2 changes:
Rationale
Shipping a static list of commands along with the CLI makes perfect sense. After all, the list of commands for each CLI release is fixed and it doesn't make sense for us to resolve it dynamically on each command execution. By using a static list, we can significantly decrease the time of listing all commands (-3.2s) and loading a command from args (-0.2s).
The list is built by calling the
build
npm script and included in the .tar.gz.Timings allow us to understand where the CLI is spending time on execution. If we notice that a particular command is slow, it'll help us understand whether it's caused by (temporary) slow API calls or the command's code that maybe inefficient. We'd collect timings on each execution (there's little overhead to it and allows us to simplify our code base) but only display them in debug mode.
@pnp/cli-for-microsoft-365-maintainers I'm looking forward to hearing what you think. If you're ok with the change, I'll finish the PR by taking care of tests and coverage.