checkhealth: try yarn if npm is missing #10490

fixes #10489
This commit is contained in:
ObserverOfTime 2019-07-14 21:48:53 +03:00 committed by Justin M. Keyes
parent 452112ae38
commit c38862acea

View File

@ -564,7 +564,10 @@ function! s:check_node() abort
endif
call health#report_info('Neovim node.js host: '. host)
let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
let manager = executable('npm') ? 'npm' : 'yarn'
let latest_npm_cmd = has('win32') ?
\ 'cmd /c '. manager .' info neovim --json' :
\ manager .' info neovim --json'
let latest_npm = s:system(split(latest_npm_cmd))
if s:shell_error || empty(latest_npm)
call health#report_error('Failed to run: '. latest_npm_cmd,
@ -593,7 +596,8 @@ function! s:check_node() abort
call health#report_warn(
\ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s',
\ current_npm, latest_npm),
\ ['Run in shell: npm install -g neovim'])
\ ['Run in shell: npm install -g neovim',
\ 'Run in shell (if you use yarn): yarn global add neovim'])
else
call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm)
endif