Files
Artveris/scripts/README.md
T
2026-07-03 02:13:28 +08:00

43 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# scripts · 一键脚本
所有环境配置集中在 [`config.yaml`](./config.yaml)(带注释)。脚本会据此自动生成根目录 `.env`,**无需手改 .env**。
脚本现在直接用本机 Python 运行。建议使用项目内虚拟环境,避免污染全局 Python。
首次运行前:
```bash
python -m venv .venv
.\.venv\Scripts\activate
python -m pip install -r scripts/requirements.txt
```
如果 PowerShell 阻止激活脚本,可在当前终端临时放行后再激活:
```bash
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\activate
```
之后每次运行脚本前,先激活虚拟环境:
```bash
.\.venv\Scripts\activate
```
| 脚本 | 作用 |
| --- | --- |
| `python scripts/dev.py` | 本地开发:生成 .env → 起 MySQL/Redis → 构建 shared → 迁移+种子 → 同时启动 api/admin/h5 |
| `python scripts/docker_build.py` | 构建:生成 .env → 构建前端静态 → 构建 API 镜像 |
| `python scripts/docker_dev.py` | Docker 运行全栈(`--down` 停止,`--logs` 看日志) |
常用参数:
```bash
python scripts/dev.py --install # 首次:先 pnpm install
python scripts/dev.py --no-seed # 跳过种子数据
python scripts/docker_dev.py --down # 停止全栈
```
修改 `config.yaml`(如平台名、端口、存储/区块链 driver、账号密码)后,重跑脚本即生效。