commit 31b9d6a1f50773e9698bfcf9981fee40e99e8bb1
parent 4bf2ba6709d131e60522660e023dcccdc5ea2fcf
Author: Tomas Nemec <owl@gtms.dev>
Date: Wed, 21 May 2025 11:09:01 +0200
update: vscode build with docker
Diffstat:
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -89,7 +89,36 @@ return require('paq') {
{
'microsoft/vscode-js-debug',
opt = true,
- build = 'npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out',
+ build = function()
+ local dockerfile = vim.fn.tmpname()
+ vim.fn.writefile({
+ 'FROM node AS build',
+ 'WORKDIR /src',
+ 'COPY . .',
+ 'RUN npm install --legacy-peer-deps && npx gulp vsDebugServerBundle',
+ 'FROM scratch',
+ 'COPY --from=build /src/dist /',
+ }, dockerfile, "a")
+
+ local err = {};
+ local result = vim.system(
+ { 'docker', 'buildx', 'build', '--progress', 'plain', '--output', './out', '-f', dockerfile, '.' },
+ {
+ cwd = vim.fn.stdpath('data') .. '/site/pack/paqs/opt/vscode-js-debug',
+ stderr = function(_, data)
+ for line in data:gmatch '[^\n]+' do
+ table.insert(err, line)
+ end
+ end
+ }
+ ):wait()
+
+ os.remove(dockerfile)
+ if result.code ~= 0 then
+ vim.fn.writefile(err, vim.fn.stdpath('state') .. '/paq.log', "a")
+ vim.cmd.throw()
+ end
+ end,
},
-- treesitter