Skip to content

chore(refactor): clean up lifecycle-cmds#2753

Closed
wraithgar wants to merge 2 commits intolatestfrom
gar/lifecycle-cmd-refactor
Closed

chore(refactor): clean up lifecycle-cmds#2753
wraithgar wants to merge 2 commits intolatestfrom
gar/lifecycle-cmd-refactor

Conversation

@wraithgar
Copy link
Member

This is a small incremental step in removing some of the complexity
surrounding the npm object in our code.

It moves that object one level up the chain of code, with the end goal
being that we will only require it once in the codebase, ultimately allowing
us to improve our tests.

I also changed the command that it calls to run-script because that is the
base command. run was an alias, and that is one more layer of hoops a
developer would have to jump through to find what file in ./lib is even
being referenced here.

@wraithgar wraithgar requested a review from a team as a code owner February 22, 2021 17:27
@wraithgar wraithgar marked this pull request as draft February 22, 2021 18:28
@darcyclarke darcyclarke added the Release 7.x work is associated with a specific npm 7 release label Feb 22, 2021
@wraithgar wraithgar marked this pull request as ready for review February 22, 2021 19:50
Copy link
Contributor

@isaacs isaacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

isaacs and others added 2 commits February 22, 2021 12:30
There are a few commands (exec, run-script, and the run-script proxies)
where essentially npm is acting like a very fancy shell.  It is peculiar
and noisy for npm to print a verbose error banner at the end of these
commands, since presumably the command itself already did whatever it
had to do to report the error appropriately.

For example, `npm test` runs a test script, usually outputting test
results.  Having npm then tell me that my tests failed with exit status
1 and print a debug log, is unnecessary and unwanted.

When the error encountered for these commands does not have a non-zero
numeric 'code', then we still print the standard npm error reporting
messages, because presumably something went wrong OTHER than a process
exiting with a non-zero status code.

PR-URL: #2742
Credit: @isaacs
Close: #2742
Reviewed-by: @nlf
This is a small incremental step in removing some of the complexity
surrounding the `npm` object in our code.

It moves that object one level up the chain of code, with the end goal
being that we will only require it once in the codebase, ultimately allowing
us to improve our tests.

I also changed the command that it calls to `run-script` because that is the
base command. `run` was an alias, and that is one more layer of hoops a
developer would have to jump through to find what file in `./lib` is even
being referenced here.

PR-URL: #2753
Credit: @wraithgar
Close: #2753
Reviewed-by: @isaacs
@isaacs isaacs force-pushed the gar/lifecycle-cmd-refactor branch from 481fbae to 773ae3e Compare February 22, 2021 20:30
@isaacs isaacs closed this Feb 22, 2021
@wraithgar wraithgar deleted the gar/lifecycle-cmd-refactor branch November 2, 2021 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release 7.x work is associated with a specific npm 7 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants