mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-10 06:47:53 +03:00
feat(tcp server): set up script
This commit is contained in:
parent
48688dc6e6
commit
b96070085b
@ -35,6 +35,7 @@
|
||||
"setup:offline-tts": "ts-node scripts/setup-offline/run-setup-tts.js",
|
||||
"setup:offline-hotword": "ts-node scripts/setup-offline/run-setup-hotword.js",
|
||||
"setup:python-bridge": "ts-node scripts/python-bridge/setup-python-bridge.js",
|
||||
"setup:tcp-server": "ts-node scripts/tcp-server/setup-tcp-server.js",
|
||||
"preinstall": "node scripts/setup/preinstall.js",
|
||||
"postinstall": "ts-node scripts/setup/setup.js",
|
||||
"dev:app": "vite --config app/vite.config.js",
|
||||
|
@ -34,6 +34,9 @@ const ARCHIVE_PATH = path.join(DIST_PATH, ARCHIVE_NAME)
|
||||
|
||||
const { type } = OSHelper.getInformation()
|
||||
|
||||
/**
|
||||
* Install requirements
|
||||
*/
|
||||
try {
|
||||
if (type === OSTypes.Linux) {
|
||||
LogHelper.info('Checking whether the "patchelf" utility can be found...')
|
||||
@ -51,6 +54,9 @@ const ARCHIVE_PATH = path.join(DIST_PATH, ARCHIVE_NAME)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Python bridge
|
||||
*/
|
||||
try {
|
||||
LogHelper.info('Building the Python bridge...')
|
||||
|
||||
@ -66,6 +72,9 @@ const ARCHIVE_PATH = path.join(DIST_PATH, ARCHIVE_NAME)
|
||||
LogHelper.error(`Failed to build the Python bridge: ${e}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack distribution entities into a ZIP archive
|
||||
*/
|
||||
LogHelper.info(`Packing to ${ARCHIVE_PATH}...`)
|
||||
|
||||
const output = fs.createWriteStream(ARCHIVE_PATH)
|
||||
|
@ -28,7 +28,9 @@ const PIPFILE_PATH = 'bridges/python/src/Pipfile'
|
||||
LogHelper.success('Python packages installed')
|
||||
LogHelper.success('Python bridge development environment ready')
|
||||
} catch (e) {
|
||||
LogHelper.error(`Failed to set up the Python bridge: ${e}`)
|
||||
LogHelper.error(
|
||||
`Failed to set up the Python bridge development environment: ${e}`
|
||||
)
|
||||
} finally {
|
||||
LoaderHelper.stop()
|
||||
}
|
||||
|
35
scripts/tcp-server/setup-tcp-server.js
Normal file
35
scripts/tcp-server/setup-tcp-server.js
Normal file
@ -0,0 +1,35 @@
|
||||
import { command } from 'execa'
|
||||
|
||||
import { LogHelper } from '@/helpers/log-helper'
|
||||
import { LoaderHelper } from '@/helpers/loader-helper'
|
||||
|
||||
/**
|
||||
* Set up TCP server development environment
|
||||
* 1. Install Python packages from the Pipfile
|
||||
*/
|
||||
|
||||
const PIPFILE_PATH = 'tcp_server/src/Pipfile'
|
||||
|
||||
;(async () => {
|
||||
LoaderHelper.start()
|
||||
LogHelper.info('Setting up TCP server development environment...')
|
||||
LogHelper.info(`Installing Python packages from ${PIPFILE_PATH}.lock...`)
|
||||
|
||||
try {
|
||||
process.env.PIPENV_PIPFILE = PIPFILE_PATH
|
||||
process.env.PIPENV_VENV_IN_PROJECT = true
|
||||
|
||||
await command(`pipenv install --site-packages`, {
|
||||
shell: true
|
||||
})
|
||||
|
||||
LogHelper.success('Python packages installed')
|
||||
LogHelper.success('TCP server development environment ready')
|
||||
} catch (e) {
|
||||
LogHelper.error(
|
||||
`Failed to set up the TCP server development environment: ${e}`
|
||||
)
|
||||
} finally {
|
||||
LoaderHelper.stop()
|
||||
}
|
||||
})()
|
Loading…
Reference in New Issue
Block a user