mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-24 17:23:23 +03:00
build(bridge/nodejs): usage of ncc
This commit is contained in:
parent
de08807f1a
commit
07e253f663
@ -2,6 +2,7 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/bin",
|
||||
"rootDir": "../../",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@@/*": ["../../*"],
|
||||
|
@ -117,6 +117,7 @@
|
||||
"@types/node-wav": "0.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.55.0",
|
||||
"@typescript-eslint/parser": "5.55.0",
|
||||
"@vercel/ncc": "0.36.1",
|
||||
"cli-spinner": "0.2.10",
|
||||
"eslint": "8.22.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
|
@ -137,24 +137,33 @@ BUILD_TARGETS.set('tcp-server', {
|
||||
* Build for binaries not requiring a Python environment
|
||||
*/
|
||||
try {
|
||||
const tsconfigPath = path.join(NODEJS_BRIDGE_ROOT_PATH, 'tsconfig.json')
|
||||
const currentWorkingDirectory = process.cwd()
|
||||
process.chdir(NODEJS_BRIDGE_ROOT_PATH)
|
||||
await command('npm install', {
|
||||
shell: true,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
|
||||
process.chdir(currentWorkingDirectory)
|
||||
const distBinPath = path.join(NODEJS_BRIDGE_DIST_PATH, 'bin')
|
||||
const distMainFilePath = path.join(
|
||||
NODEJS_BRIDGE_DIST_PATH,
|
||||
'bin',
|
||||
'bridges',
|
||||
'nodejs',
|
||||
'src',
|
||||
'main.js'
|
||||
distBinPath,
|
||||
'index.js'
|
||||
)
|
||||
const distRenamedMainFilePath = path.join(
|
||||
NODEJS_BRIDGE_DIST_PATH,
|
||||
'bin',
|
||||
distBinPath,
|
||||
NODEJS_BRIDGE_BIN_NAME
|
||||
)
|
||||
|
||||
await fs.promises.rm(buildPath, { recursive: true, force: true })
|
||||
|
||||
await command(`tsc --project ${tsconfigPath}`, {
|
||||
const inputMainFilePath = path.join(
|
||||
NODEJS_BRIDGE_ROOT_PATH,
|
||||
'src',
|
||||
'main.ts'
|
||||
)
|
||||
|
||||
await command(`ncc build ${inputMainFilePath} --out ${distBinPath}`, {
|
||||
shell: true,
|
||||
stdio: 'inherit'
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user