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: remove unused npm.setCmd method #7415

Merged
merged 2 commits into from
Apr 25, 2024
Merged

fix: remove unused npm.setCmd method #7415

merged 2 commits into from
Apr 25, 2024

Conversation

lukekarrys
Copy link
Contributor

No description provided.

@lukekarrys lukekarrys requested a review from a team as a code owner April 24, 2024 22:48
@@ -102,6 +97,8 @@ class Npm {
const { exec = true } = await this.#load().then(r => r ?? {})
return {
exec,
command: this.argv.shift(),
Copy link
Member

Choose a reason for hiding this comment

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

Not to be solved here but this .shift() smells

@lukekarrys lukekarrys merged commit c060e60 into latest Apr 25, 2024
20 checks passed
@lukekarrys lukekarrys deleted the lk/set-npm-cmd branch April 25, 2024 00:33
@github-actions github-actions bot mentioned this pull request Apr 25, 2024
lukekarrys added a commit that referenced this pull request May 6, 2024
This PR refactors `exit-handler.js` to be a class so that it can more
easily track its internal state. It uses this state to now fully
distinguish between 3 states: npm never being set, npm not loaded, and
exit handler never called. There are some new error messages shown via
console.error if we know we are in an unexpected state.

This also continues the refactoring started in #7415 to separate
concerns between `npm` and `CLI`. Identifying the error message and
logging it have been move to `npm` but catching that error and setting
the `process.exitCode` are still handled in `exit-handler.js` and
`cli/entry.js`.

It also moves `command.cmdExec` to `npm` since it never called from
within any `command` instance. This lets `npm` only ever call
`command.exec` or `command.workspaceExec` now.
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.

2 participants