init
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
project_dir=$(cd "$(dirname "$0")/.." && pwd)
|
||||
cd "$project_dir"
|
||||
|
||||
if ! command -v node >/dev/null 2>&1; then
|
||||
echo "需要 Node.js 22 或更高版本。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
node_major=$(node -p 'Number(process.versions.node.split(".")[0])')
|
||||
if [ "$node_major" -lt 22 ]; then
|
||||
echo "当前 Node.js 版本过低:$(node --version),需要 22 或更高版本。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v command-code >/dev/null 2>&1; then
|
||||
npm install --global command-code@latest
|
||||
fi
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
echo "安装完成。"
|
||||
echo "如未登录,请运行:command-code login"
|
||||
echo "登录状态:command-code status --json"
|
||||
Reference in New Issue
Block a user