1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-08-17 06:00:33 +03:00

refactor(scripts): explicit Node.js bridge npm packages install

This commit is contained in:
louistiti 2023-05-13 00:30:15 +08:00
parent d6933a9e35
commit 6d495cf43c
No known key found for this signature in database
GPG Key ID: 92CD6A2E497E1669
2 changed files with 19 additions and 1 deletions

View File

@ -70,7 +70,6 @@
"docker:check": "docker run --rm --interactive leon-ai/leon npm run check"
},
"dependencies": {
"leon-nodejs-bridge": "file:./bridges/nodejs",
"@aws-sdk/client-polly": "3.18.0",
"@fastify/static": "6.9.0",
"@ffmpeg-installer/ffmpeg": "1.1.0",

View File

@ -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 install Node.js bridge npm packages: ${e}`)
}
}
try {
LogHelper.info(`Downloading ${name}...`)