Skip to content

fix: remove unused npm.setCmd method#7415

Merged
lukekarrys merged 2 commits into
latestfrom
lk/set-npm-cmd
Apr 25, 2024
Merged

fix: remove unused npm.setCmd method#7415
lukekarrys merged 2 commits into
latestfrom
lk/set-npm-cmd

Conversation

@lukekarrys
Copy link
Copy Markdown
Contributor

No description provided.

@lukekarrys lukekarrys requested a review from a team as a code owner April 24, 2024 22:48
Comment thread lib/npm.js
const { exec = true } = await this.#load().then(r => r ?? {})
return {
exec,
command: this.argv.shift(),
Copy link
Copy Markdown
Contributor

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
@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.
boyLenGit pushed a commit to boyLenGit/media-manager that referenced this pull request May 25, 2026
npm 9/10 在 docker 内长期存在 'Exit handler never called' bug
(npm/cli#7415, #6995),即使 exit code 0 也会导致依赖装不全。

改用 pnpm 9 (corepack 启用):
- 内容寻址 + 全局 store,避免 hardlink 在 docker 沙盒里的 race
- 自动从 package-lock.json 导入依赖关系 (pnpm import)
- 在 GitHub Actions / GitLab CI 上稳定性远好于 npm
- 等待 npm 11+ 修复后可以再切回去
boyLenGit added a commit to boyLenGit/media-manager that referenced this pull request May 25, 2026
npm 9/10 在 docker 内长期存在 'Exit handler never called' bug
(npm/cli#7415, #6995),即使 exit code 0 也会导致依赖装不全。

改用 pnpm 9 (corepack 启用):
- 内容寻址 + 全局 store,避免 hardlink 在 docker 沙盒里的 race
- 自动从 package-lock.json 导入依赖关系 (pnpm import)
- 在 GitHub Actions / GitLab CI 上稳定性远好于 npm
- 等待 npm 11+ 修复后可以再切回去
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