add lua diagnostics to pipeline

This commit is contained in:
Juraj Vajda 2022-11-03 13:48:19 -04:00
parent e051aac82b
commit 4a611a62ea

View File

@ -14,13 +14,17 @@ const from = path.join(cwd, 'bin/lua-language-server-3.5.6-linux-x64.tar.gz');
const to = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64'); const to = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64');
const extract = jaguar.extract(from, to) const extract = jaguar.extract(from, to)
extract.on('file', (name) => { // extract.on('file', (name) => {
console.log(name) // console.log(name)
// })
extract.on('start', () => {
console.log('Extracting...')
}) })
extract.on('progress', (percent) => { // extract.on('progress', (percent) => {
console.log(percent + '%') // console.log(percent + '%')
}) // })
extract.on('error', (error) => { extract.on('error', (error) => {
console.error(error) console.error(error)
@ -28,7 +32,7 @@ extract.on('error', (error) => {
}) })
extract.on('end', () => { extract.on('end', () => {
console.log('done') console.log('Extracting: Done')
// Delete directory recursively // Delete directory recursively
try { try {
@ -48,15 +52,15 @@ extract.on('end', () => {
exec(`${command} --logpath "${logPath}" --check "${cwd}"`, (error, stdout, stderr) => { exec(`${command} --logpath "${logPath}" --check "${cwd}"`, (error, stdout, stderr) => {
if (error) { if (error) {
console.log(`error: ${error.message}`) console.log(`error: ${error.message}`)
return process.exit(1)
} }
if (stderr) { if (stderr) {
console.log(`stderr: ${stderr}`) console.log(`stderr: ${stderr}`)
return process.exit(1)
} }
console.log(`stdout: ${stdout}`) console.log(`\n${stdout}`)
if (fs.existsSync('./logs/check.json')) { if (fs.existsSync('./logs/check.json')) {
const rawdata = fs.readFileSync('./logs/check.json') const rawdata = fs.readFileSync('./logs/check.json')
@ -76,6 +80,7 @@ extract.on('end', () => {
// Delete directory recursively // Delete directory recursively
const llsFolder = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64') const llsFolder = path.join(cwd, 'bin', 'lua-language-server-3.5.6-linux-x64')
try { try {
fs.rmSync(llsFolder, { recursive: true, force: true }) fs.rmSync(llsFolder, { recursive: true, force: true })
console.log(`Removed folder: ${llsFolder}`) console.log(`Removed folder: ${llsFolder}`)