Files
2026-11-05 22:23:55 +07:00

64 lines
2.2 KiB
Markdown
Raw Permalink 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.
# jha-1048-hddj-web
黄果短剧 H5 / Web(Next.js 16 · React 19 · pnpm)。工程骨架对齐 jha-1046,当前只有空首页。
## 环境要求
- Node.js `>= 20.9`(打包 Linux sharp 推荐 **22**,npm `>= 10.9.2`)
- pnpm `10+`
## 本地开发
```bash
pnpm install
pnpm dev # development.env
pnpm dev:test # test.env
```
浏览器打开 [http://localhost:26124](http://localhost:26124)。
常用命令:
| 命令 | 说明 |
|------|------|
| `pnpm lint` | ESLint |
| `pnpm build` | 正式环境构建 |
| `pnpm build:test` | 测试环境构建 |
## 环境配置
配置文件在 `config/`(可另加 `*.local.env`,勿提交密钥):
| 文件 | 用途 |
|------|------|
| `config/development.env` | 本地开发 |
| `config/test.env` | 测试构建 / 测试服 |
| `config/production.env` | 正式构建 / 正式服 |
测试服默认 `root@172.104.181.99:22889`,目录 `/server/web_91dj/h5`,包名 `web_91dj_h5.tar.gz`,监听端口 `21021`。正式服推送前设置 `DEPLOY_JUMP_HOST`。
## 打包与部署
测试部署直接使用 `jha-1047-91dj-web` 的脚本:`deploy_test.sh` 构建后打 **`web_91dj_h5.tar.gz`** 和 **`web_91dj_h5.tar.gz.sha256`**(另写 **`web_91dj_h5.md5`**)。包内保留 `.next-test`,并带 `package-lock.json`、`scripts/next-env.mjs`、`scripts/check-health.mjs`,不含本机 `node_modules`。上传后在服务器执行 `run.sh`,由它 `npm ci --omit=dev` 再用 pm2 启动 `node start.mjs`。
正式包仍是带 Linux 依赖的 **`web_91dj_h5.tar.gz`** 和 **`web_91dj_h5.md5`**。测试包和正式包共用这个文件名,根目录里留下的是最后一次的产物。
```bash
pnpm pack:gz:test:only # 测试包,不上传
pnpm pack:gz:only # 正式包,不上传
```
测试服直接上传:
```bash
pnpm pack:gz:test
```
默认目标是 `root@172.104.181.99:22889` 的 `/server/web_91dj/h5`,上传后执行服务器上现有的 `bash run.sh`,覆盖 91 短剧测试服务。换机器时设置 `DEPLOY_HOST`、`DEPLOY_DIR`。正式服仍需指定主机:
```bash
DEPLOY_JUMP_HOST=user@host DEPLOY_JUMP_DIR=/home/server/web_91dj/h5 pnpm pack:gz
```
Standalone 用包内入口启动:`node start.mjs`。