Skip to content

Commit

Permalink
chore: refine tman frontend build process
Browse files Browse the repository at this point in the history
  • Loading branch information
halajohn committed Dec 10, 2024
1 parent 19cbb19 commit e0fc71a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
24 changes: 24 additions & 0 deletions core/src/ten_manager/tools/build_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

SCRIPT_DIR=$(
cd "$(dirname "$0")" || exit
pwd
)

PROJECT_ROOT_DIR=$(
cd "$SCRIPT_DIR/.." || exit
pwd
)

# Change to `frontend` folder and build the frontend.
echo "Building frontend..."
cd "$PROJECT_ROOT_DIR/frontend" || exit 1
npm install || exit 1
npm run build || exit 1

# Change back to the project root folder.
cd "$PROJECT_ROOT_DIR" || exit 1

# Build tman rust project.
echo "Building ..."
cargo build --release || exit 1
33 changes: 33 additions & 0 deletions core/src/ten_manager/tools/build_all_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

SCRIPT_DIR=$(
cd "$(dirname "$0")" || exit
pwd
)

PROJECT_ROOT_DIR=$(
cd "$SCRIPT_DIR/.." || exit
pwd
)

# 檢查是否提供了參數
if [ -z "$1" ]; then
echo "Error: Missing base directory argument."
echo "Usage: $0 <base-dir>"
exit 1
fi

BASE_DIR=$1

# Change to `frontend` folder and build the frontend.
echo "Building frontend..."
cd "$PROJECT_ROOT_DIR/frontend" || exit 1
npm install || exit 1
npm run build || exit 1

# Change back to the project root folder.
cd "$PROJECT_ROOT_DIR" || exit 1

# Build tman rust project.
echo "Building and running tman dev-server ..."
cargo run dev-server --base-dir="$BASE_DIR"

0 comments on commit e0fc71a

Please sign in to comment.