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