1
1
mirror of https://github.com/leon-ai/leon.git synced 2024-12-25 09:44:22 +03:00

refactor: TypeScript entry point

This commit is contained in:
louistiti 2022-08-28 14:12:59 +08:00
parent 3498293098
commit 781e072b23
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6
5 changed files with 860 additions and 85 deletions

916
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
"preinstall": "node scripts/setup/preinstall.js",
"postinstall": "ts-node scripts/setup/setup.js",
"dev:app": "vite --config app/vite.config.js",
"dev:server": "npm run train && npm run generate:skills-endpoints && cross-env LEON_NODE_ENV=development nodemon --watch server ./server/src/index.js --ignore server/src/tmp/ --exec ts-node",
"dev:server": "npm run train && npm run generate:skills-endpoints && cross-env LEON_NODE_ENV=development nodemon --watch server server/src/index.ts --ignore server/src/tmp/ --exec ts-node",
"wake": "cross-env LEON_HOST=http://localhost LEON_PORT=1337 node hotword/index.js",
"delete-dist:server": "shx rm -rf ./server/dist",
"prepare": "husky install",

10
server/src/global.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import { ChildProcessWithoutNullStreams } from 'child_process'
import TcpClient from '@/core/tcp-client'
declare global {
var tcpServerProcess: ChildProcessWithoutNullStreams
var tcpClient: TcpClient
}
export { }

View File

@ -9,7 +9,7 @@ import server from '@/core/http-server/server'
dotenv.config()
process.title = 'leon'
global.tcpServerProcess = spawn(`pipenv run python bridges/python/tcp_server/main.py ${lang.getShortCode(process.env.LEON_LANG)}`, { shell: true })
global.tcpClient = new TcpClient(

View File

@ -1,8 +1,5 @@
{
"exclude": ["node_modules", "server/dist"],
"compilerOptions": {
"strict": true,
"allowJs": true,
"target": "esnext",
"module": "commonjs",
"rootDir": ".",
@ -11,11 +8,17 @@
"@@/*": ["./*"],
"@/*": ["./server/src/*"]
},
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"resolveJsonModule": true
},
"ts-node": {
"transpileOnly": true,
"require": ["tsconfig-paths/register"]
}
"require": ["tsconfig-paths/register"],
"files": true
},
"files": ["server/src/global.d.ts"],
"include": ["**/*.ts"],
"exclude": ["node_modules", "server/dist"]
}