This commit is contained in:
52
run.zsh
Executable file
52
run.zsh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# Simple build script for ai.log
|
||||
# Usage: ./run.zsh [serve|build|oauth|clean|tunnel|all]
|
||||
|
||||
function _env() {
|
||||
d=${0:a:h}
|
||||
ailog=$d/target/release/ailog
|
||||
}
|
||||
|
||||
function _server() {
|
||||
_env
|
||||
lsof -ti:8080 | xargs kill -9 2>/dev/null || true
|
||||
cd $d/my-blog
|
||||
$ailog build --release
|
||||
$ailog serve --port 8080
|
||||
}
|
||||
|
||||
function _server_public() {
|
||||
_env
|
||||
cloudflared tunnel --config $d/aicard-web-oauth/cloudflared-config.yml run
|
||||
}
|
||||
|
||||
function _oauth_build() {
|
||||
_env
|
||||
cd $d/aicard-web-oauth
|
||||
nvm use 21
|
||||
npm i
|
||||
npm run build
|
||||
npm run preview
|
||||
}
|
||||
|
||||
function _comment_server() {
|
||||
_env
|
||||
cargo build --release
|
||||
AILOG_DEBUG_ALL=1 $ailog stream start
|
||||
}
|
||||
|
||||
case "${1:-serve}" in
|
||||
tunnel|c)
|
||||
_server_public
|
||||
;;
|
||||
oauth|o)
|
||||
_oauth_build
|
||||
;;
|
||||
comment|co)
|
||||
_server_comment
|
||||
;;
|
||||
serve|s|*)
|
||||
_server
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user