summaryrefslogtreecommitdiff
path: root/server/publish.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-13 12:39:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-13 12:39:41 +0800
commit8d8dc6d9e032141ee0aa51c16539cc08518167f6 (patch)
tree636ad93135a86db7e87c747004907ce4a901c8c2 /server/publish.lua
parent19e4bb38b32cadab634e4afac05b2a2cc89bc4a2 (diff)
downloadlua-language-server-8d8dc6d9e032141ee0aa51c16539cc08518167f6.zip
在发布目录更新node_modules
Diffstat (limited to 'server/publish.lua')
-rw-r--r--server/publish.lua22
1 files changed, 13 insertions, 9 deletions
diff --git a/server/publish.lua b/server/publish.lua
index 643faf03..27546eb2 100644
--- a/server/publish.lua
+++ b/server/publish.lua
@@ -15,9 +15,9 @@ local function loadPackage()
return package.version, package.scripts.postinstall
end
-local function updateNodeModules(postinstall)
+local function updateNodeModules(out, postinstall)
local current = fs.current_path()
- fs.current_path(EXTENSION)
+ fs.current_path(out)
local cmd = io.popen(postinstall)
for line in cmd:lines 'l' do
print(line)
@@ -31,11 +31,11 @@ local function createDirectory(version)
return out
end
-local function copyFiles(out)
+local function copyFiles(root, out)
return function (dirs)
local count = 0
local function copy(relative, mode)
- local source = EXTENSION / relative
+ local source = root / relative
local target = out / relative
if not fs.exists(source) then
error('文件不存在: ' .. tostring(source))
@@ -115,16 +115,12 @@ print('版本号为:' .. version)
local out = createDirectory(version)
-print('更新NodeModules...')
-updateNodeModules(postinstall)
-
print('清理目录...')
removeFiles(out)(true)
print('开始复制文件...')
-local count = copyFiles(out) {
+local count = copyFiles(EXTENSION , out) {
['client'] = {
- ['node_modules'] = true,
['out'] = true,
['package-lock.json'] = true,
['package.json'] = true,
@@ -145,6 +141,10 @@ local count = copyFiles(out) {
}
print(('复制了[%d]个文件'):format(count))
+
+print('更新NodeModules...')
+updateNodeModules(out, postinstall)
+
print('开始测试...')
runTest(out / 'server')
@@ -159,4 +159,8 @@ removeFiles(out) {
},
}
+print('复制到发布目录...')
+local count = copyFiles(out, EXTENSION / 'publish' / 'lua-language-server')(true)
+print(('复制了[%d]个文件'):format(count))
+
print('完成')