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

Switch or remove update-notifier #9

Open
northword opened this issue Apr 2, 2024 · 0 comments
Open

Switch or remove update-notifier #9

northword opened this issue Apr 2, 2024 · 0 comments

Comments

@northword
Copy link
Owner

当前用的 https://www.npmjs.com/package/update-notifier ,它在有更新内容时,加了一层判断如是否为 TTY 环境之类的,其中一个判断是 isNpmOrYarn,这个方法依赖 isNpm,尚不支持 pnpm。而且这个包有点大,虽然他算是下载量最高的

备选项:

其他信息:

判断包管理器:

// https://github.com/vuejs/vitepress/blob/25399258b81bc654c03e69c77c19ec72af99f8d9/src/node/init/init.ts#L31-L37

const getPackageManger = () => {
  const name = process.env?.npm_config_user_agent || 'npm'
  if (name === 'npm') {
    return 'npm'
  }
  return name.split('/')[0]
}

可以在提示里面根据包管理器给出更新命令

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

No branches or pull requests

1 participant