Skip to content

Commit

Permalink
fix(scripts): windows: js engine build and run (#313)
Browse files Browse the repository at this point in the history
This is a workaround for a bug/weird behaviour in neovim:
neovim/neovim#31107

Once this has been merged:
neovim/neovim#31109

We can revert this workaround.

Fixes #304
  • Loading branch information
gorillamoe authored Nov 7, 2024
1 parent 3fc84b7 commit 383defc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/kulala/globals/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local M = {}

local plugin_tmp_dir = FS.get_plugin_tmp_dir()

M.VERSION = "4.4.0"
M.VERSION = "4.4.1"
M.UI_ID = "kulala://ui"
M.SCRATCHPAD_ID = "kulala://scratchpad"
M.HEADERS_FILE = plugin_tmp_dir .. "/headers.txt"
Expand Down
8 changes: 5 additions & 3 deletions lua/kulala/parser/scripts/engines/javascript/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ local M = {}

local NPM_EXISTS = vim.fn.executable("npm") == 1
local NODE_EXISTS = vim.fn.executable("node") == 1
local NPM_BIN = vim.fn.exepath("npm")
local NODE_BIN = vim.fn.exepath("node")
local SCRIPTS_DIR = FS.get_scripts_dir()
local REQUEST_SCRIPTS_DIR = FS.get_request_scripts_dir()
local SCRIPTS_BUILD_DIR = FS.get_tmp_scripts_build_dir()
Expand All @@ -23,12 +25,12 @@ local FILE_MAPPING = {

M.install = function()
FS.copy_dir(BASE_DIR, SCRIPTS_BUILD_DIR)
local res_install = vim.system({ "npm", "install", "--prefix", SCRIPTS_BUILD_DIR }):wait()
local res_install = vim.system({ NPM_BIN, "install", "--prefix", SCRIPTS_BUILD_DIR }):wait()
if res_install.code ~= 0 then
Logger.error("npm install fail with code " .. res_install.code)
return
end
local res_build = vim.system({ "npm", "run", "build", "--prefix", SCRIPTS_BUILD_DIR }):wait()
local res_build = vim.system({ NPM_BIN, "run", "build", "--prefix", SCRIPTS_BUILD_DIR }):wait()
if res_build.code ~= 0 then
Logger.error("npm run build fail with code " .. res_build.code)
return
Expand Down Expand Up @@ -135,7 +137,7 @@ M.run = function(type, data)
for _, script in ipairs(scripts) do
local output = vim
.system({
"node",
NODE_BIN,
script.path,
}, {
cwd = script.cwd,
Expand Down

0 comments on commit 383defc

Please sign in to comment.