1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-19 14:52:21 +03:00
leon/scripts/setup/setup.js
2022-02-13 01:42:29 +08:00

42 lines
1020 B
JavaScript

import loader from '@/helpers/loader'
import log from '@/helpers/log'
import train from '../train'
import generateHttpApiKey from '../generate/generate-http-api-key'
import setupDotenv from './setup-dotenv'
import setupCore from './setup-core'
import setupPackagesConfig from './setup-packages-config'
import setupPythonPackages from './setup-python-packages'
// Do not load ".env" file because it is not created yet
/**
* Main entry to setup Leon
*/
(async () => {
try {
// Required env vars to setup
process.env.PIPENV_PIPFILE = 'bridges/python/Pipfile'
process.env.PIPENV_VENV_IN_PROJECT = 'true'
await setupDotenv()
loader.start()
await Promise.all([
setupCore(),
setupPackagesConfig()
])
await setupPythonPackages()
loader.stop()
await generateHttpApiKey()
loader.start()
await train()
log.default('')
log.success('Hooray! Leon is installed and ready to go!')
loader.stop()
} catch (e) {
log.error(e)
loader.stop()
}
})()