mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-01 03:15:58 +03:00
feat(scripts): install Node.js bridge npm packages on setup
This commit is contained in:
parent
ef223a2901
commit
127a10f8ed
@ -4,6 +4,7 @@ import stream from 'node:stream'
|
||||
import readline from 'node:readline'
|
||||
|
||||
import axios from 'axios'
|
||||
import { command } from 'execa'
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
import prettyMilliseconds from 'pretty-ms'
|
||||
import extractZip from 'extract-zip'
|
||||
@ -11,6 +12,7 @@ import extractZip from 'extract-zip'
|
||||
import {
|
||||
BINARIES_FOLDER_NAME,
|
||||
GITHUB_URL,
|
||||
NODEJS_BRIDGE_ROOT_PATH,
|
||||
NODEJS_BRIDGE_DIST_PATH,
|
||||
PYTHON_BRIDGE_DIST_PATH,
|
||||
TCP_SERVER_DIST_PATH,
|
||||
@ -96,6 +98,23 @@ const setupBinaries = async (key) => {
|
||||
fs.promises.rm(archivePath, { recursive: true, force: true })
|
||||
])
|
||||
|
||||
if (key === 'nodejs-bridge') {
|
||||
try {
|
||||
LogHelper.info('Installing Node.js bridge npm packages...')
|
||||
|
||||
await command(
|
||||
`npm install --package-lock=false --prefix ${NODEJS_BRIDGE_ROOT_PATH}`,
|
||||
{
|
||||
shell: true
|
||||
}
|
||||
)
|
||||
|
||||
LogHelper.success('Node.js bridge npm packages installed')
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to download Node.js bridge npm packages: ${e}`)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
LogHelper.info(`Downloading ${name}...`)
|
||||
|
||||
@ -142,8 +161,8 @@ const setupBinaries = async (key) => {
|
||||
|
||||
LogHelper.success(`${name} manifest file created`)
|
||||
LogHelper.success(`${name} ${version} ready`)
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to set up ${name}: ${error}`)
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to set up ${name}: ${e}`)
|
||||
}
|
||||
} else {
|
||||
LogHelper.success(`${name} is already at the latest version (${version})`)
|
||||
|
Loading…
Reference in New Issue
Block a user