Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(refactor): use output buffer and error for more commands #7513

Merged
merged 5 commits into from
May 15, 2024

Conversation

lukekarrys
Copy link
Contributor

@lukekarrys lukekarrys commented May 12, 2024

This changes a bunch of commands to use the new output.buffer capabilities from proc-log as well as the outputError helper from utils/output-error.js.

This also adds a few comments about future display related breaking changes that npm should make.

There is some new behavior around run-script and how it outputs errors. It now displays the error for each workspace similar to how that error would get displayed when the process exits.

Here are some screenshots of the new run-script output to show with coloring. These are all represented in snapshots as well both those can be hard to decipher with ansi codes. The screenshots are run via set -x; npm $@; npmlocal $@ so the output preceded with + npm is just to show the command being run.

Running a non-existent command from multiple workspaces
Screenshot 2024-05-14 at 9 50 06 AM

Running a script that errors from multiple workspaces
Screenshot 2024-05-14 at 9 57 24 AM

Listing scripts

The only change here is I removed the newline between lifecycle scripts and run scripts. I find the indent shows the hierarchy of information and the extra newline made it difficult to quickly scan multiple workspaces which are also separated by newlines.

Screenshot 2024-05-14 at 10 14 13 AM

@npm-cli-bot
Copy link
Collaborator

npm-cli-bot commented May 12, 2024

no statistically significant performance changes detected

timing results
app-large clean lock-only cache-only modules-only no-lock no-cache no-modules no-clean show-version run-script cache-only
peer-deps
no-clean
audit
npm@latest 37.754 ±0.71 10.985 ±0.00 12.062 ±0.05 1.588 ±0.00 1.587 ±0.01 1.307 ±0.00 8.415 ±0.08 1.319 ±0.01 0.143 ±0.00 0.170 ±0.00 13.827 ±0.15 3.965 ±2.58
#7513 35.637 ±0.80 10.876 ±0.00 12.096 ±0.21 1.585 ±0.01 1.564 ±0.01 1.291 ±0.01 8.687 ±0.39 1.325 ±0.00 0.142 ±0.00 0.170 ±0.00 15.174 ±0.19 2.163 ±0.01
app-medium clean lock-only cache-only modules-only no-lock no-cache no-modules no-clean show-version run-script cache-only
peer-deps
no-clean
audit
npm@latest 28.833 ±0.18 8.128 ±0.08 9.090 ±0.00 1.554 ±0.01 1.530 ±0.00 1.454 ±0.00 5.951 ±0.03 1.358 ±0.02 0.143 ±0.00 0.170 ±0.00 9.642 ±0.02 3.307 ±1.87
#7513 27.231 ±3.68 8.240 ±0.04 9.029 ±0.02 1.534 ±0.01 1.540 ±0.03 1.518 ±0.02 5.882 ±0.01 1.335 ±0.01 0.142 ±0.00 0.170 ±0.00 9.944 ±0.12 2.049 ±0.09

@lukekarrys lukekarrys force-pushed the lk/publish-output-buffer branch 3 times, most recently from deb96a5 to 71d5e0a Compare May 13, 2024 02:59
@lukekarrys lukekarrys changed the base branch from latest to lk/errors-and-json May 13, 2024 03:00
@lukekarrys lukekarrys force-pushed the lk/publish-output-buffer branch 2 times, most recently from 872be60 to 2d0eb9d Compare May 13, 2024 06:31
@lukekarrys lukekarrys changed the title fix(refactor): use output.buffer for easier json output in publish fix(refactor): use output.buffer for json output May 13, 2024
Base automatically changed from lk/errors-and-json to latest May 13, 2024 17:24
@lukekarrys lukekarrys force-pushed the lk/publish-output-buffer branch 9 times, most recently from 75a3c10 to 3a62c37 Compare May 14, 2024 17:02
@lukekarrys lukekarrys changed the title fix(refactor): use output.buffer for json output fix(refactor): use output buffer and error for more commands May 14, 2024
This changes a bunch of commands to use the new `output.buffer` capabilities from `proc-log` as well as the `outputError` helper from `utils/output-error.js`.

There is some new behavior around `run-script` and how it outputs errors. It now displays the error for each workspace similar to how that error would get displayed when the process exits.
@lukekarrys lukekarrys marked this pull request as ready for review May 14, 2024 17:12
@lukekarrys lukekarrys requested a review from a team as a code owner May 14, 2024 17:12
lib/utils/display.js Outdated Show resolved Hide resolved
@lukekarrys lukekarrys merged commit d5c3289 into latest May 15, 2024
23 checks passed
@lukekarrys lukekarrys deleted the lk/publish-output-buffer branch May 15, 2024 19:44
@github-actions github-actions bot mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants