3
0
Fork 0
forked from mirrors/nixpkgs

vimPlugins.markdown-preview-nvim: fix node dependencies

This commit is contained in:
oxalica 2021-09-29 09:40:30 +08:00
parent 60dcbe9837
commit 2d1cfc5882
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
5 changed files with 1699 additions and 1544 deletions

View file

@ -174,6 +174,7 @@
, "madoko"
, "markdownlint-cli"
, "markdown-link-check"
, {"markdown-preview-nvim": "../../misc/vim-plugins/markdown-preview-nvim"}
, "mastodon-bot"
, "mathjax"
, "meat"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
diff --git a/autoload/health/mkdp.vim b/autoload/health/mkdp.vim
index 9eebb56..0700333 100644
--- a/autoload/health/mkdp.vim
+++ b/autoload/health/mkdp.vim
@@ -9,8 +9,8 @@ function! health#mkdp#check() abort
call health#report_info('Pre build: ' . l:mkdp_server_script)
call health#report_info('Pre build version: ' . mkdp#util#pre_build_version())
call health#report_ok('Using pre build')
- elseif executable('node')
- call health#report_info('Node version: ' . system('node --version'))
+ elseif executable('@node@')
+ call health#report_info('Node version: ' . system('@node@ --version'))
let l:mkdp_server_script = s:mkdp_root_dir . '/app/server.js'
call health#report_info('Script: ' . l:mkdp_server_script)
call health#report_info('Script exists: ' . filereadable(l:mkdp_server_script))
diff --git a/autoload/mkdp/nvim/rpc.vim b/autoload/mkdp/nvim/rpc.vim
index 5abd807..db1067b 100644
--- a/autoload/mkdp/nvim/rpc.vim
+++ b/autoload/mkdp/nvim/rpc.vim
@@ -53,8 +53,8 @@ function! mkdp#nvim#rpc#get_command() abort
let l:pre_build = s:root_dir . '/app/bin/markdown-preview-' . mkdp#util#get_platform()
if executable(l:pre_build)
let l:cmd = [l:pre_build, '--path', s:script]
- elseif executable('node')
- let l:cmd = ['node', s:root_dir . '/app/index.js', '--path', s:script]
+ elseif executable('@node@')
+ let l:cmd = ['@node@', s:root_dir . '/app/index.js', '--path', s:script]
endif
if !exists('l:cmd')
echohl Error | echon '[vim-node-rpc] pre build and node not found!' | echohl None
diff --git a/autoload/mkdp/rpc.vim b/autoload/mkdp/rpc.vim
index a3361ec..d42f7a6 100644
--- a/autoload/mkdp/rpc.vim
+++ b/autoload/mkdp/rpc.vim
@@ -59,9 +59,9 @@ function! mkdp#rpc#start_server() abort
let l:mkdp_server_script = s:mkdp_root_dir . '/app/bin/markdown-preview-' . mkdp#util#get_platform()
if executable(l:mkdp_server_script)
let l:cmd = [l:mkdp_server_script, '--path', s:mkdp_root_dir . '/app/server.js']
- elseif executable('node')
+ elseif executable('@node@')
let l:mkdp_server_script = s:mkdp_root_dir . '/app/index.js'
- let l:cmd = ['node', l:mkdp_server_script, '--path', s:mkdp_root_dir . '/app/server.js']
+ let l:cmd = ['@node@', l:mkdp_server_script, '--path', s:mkdp_root_dir . '/app/server.js']
endif
if exists('l:cmd')
if s:is_vim

View file

@ -0,0 +1,17 @@
{
"name": "markdown-preview-vim",
"version": "0.0.1",
"description": "markdown preview plugin for (neo)vim",
"bin": "./index.js",
"repository": "https://github.com/iamcco/markdown-preview.vim.git",
"author": "年糕小豆汤 <ooiss@qq.com>",
"license": "MIT",
"private": true,
"dependencies": {
"log4js": "3.0.6",
"neovim": "4.2.1",
"socket.io": "2.1.1",
"tslib": "1.9.3",
"vim-node-rpc": "0.1.24"
}
}

View file

@ -36,6 +36,7 @@
, which
, xkb-switch
, ycmd
, nodejs
# test dependencies
, neovim-unwrapped
@ -382,6 +383,30 @@ self: super: {
dependencies = with self; [ plenary-nvim ];
});
markdown-preview-nvim = super.markdown-preview-nvim.overrideAttrs (old: let
# We only need its dependencies `node-modules`.
nodeDep = nodePackages."markdown-preview-nvim-../../misc/vim-plugins/markdown-preview-nvim".overrideAttrs (old: {
dontNpmInstall = true;
});
in {
patches = [
(substituteAll {
src = ./markdown-preview-nvim/fix-node-paths.patch;
node = "${nodejs}/bin/node";
})
];
postInstall = ''
# The node package name is `*-vim` not `*-nvim`.
ln -s ${nodeDep}/lib/node_modules/markdown-preview-vim/node_modules $out/app
'';
nativeBuildInputs = [ nodejs ];
doInstallCheck = true;
installCheckPhase = ''
node $out/app/index.js --version
'';
});
meson = buildVimPluginFrom2Nix {
inherit (meson) pname version src;
preInstall = "cd data/syntax-highlighting/vim";