dayuse-commands

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dayuse App Commands

Dayuse 应用命令

Overview

概述

All local development commands for the Dayuse.com project use Python Invoke (prefixed with
inv
) and must be run through pipenv from the current working directory.
所有Dayuse.com项目的本地开发命令都使用Python Invoke(前缀为
inv
),并且必须从当前工作目录通过pipenv运行

Prerequisites

前置条件

  • Docker Desktop running
  • pipenv installed (
    pip install pipenv
    )
  • Docker Desktop 处于运行状态
  • 已安装pipenv(
    pip install pipenv

Critical Rules

重要规则

  1. Always prefix commands with
    pipenv run
    to ensure the correct Python environment:
    bash
    pipenv run inv <command>
  2. Docker containers must be running for most commands. If unsure, run
    pipenv run inv up
    first.
  3. Never run
    inv
    directly
    without
    pipenv run
    — it may use the wrong Python/invoke version.

  1. 始终以
    pipenv run
    为命令前缀
    ,以确保使用正确的Python环境:
    bash
    pipenv run inv <command>
  2. 大多数命令需要Docker容器处于运行状态。如果不确定,请先运行
    pipenv run inv up
  3. **切勿直接运行
    inv
    **而不添加
    pipenv run
    ——这可能会使用错误的Python/invoke版本。

Quick Reference

快速参考

ActionCommand
Start everything
pipenv run inv start
Start containers only
pipenv run inv up
Stop containers
pipenv run inv stop
Run PHP tests
pipenv run inv phpunit
Run specific PHP test
pipenv run inv phpunit --filter-tests=MyTest
PHPStan analysis
pipenv run inv phpstan
Fix code style
pipenv run inv cs-fix
Frontend tests
pipenv run inv front-web-test
DB migration
pipenv run inv migrate

操作命令
启动所有服务
pipenv run inv start
仅启动容器
pipenv run inv up
停止容器
pipenv run inv stop
运行PHP测试
pipenv run inv phpunit
运行特定PHP测试
pipenv run inv phpunit --filter-tests=MyTest
PHPStan代码分析
pipenv run inv phpstan
修复代码风格
pipenv run inv cs-fix
前端测试
pipenv run inv front-web-test
数据库迁移
pipenv run inv migrate

Infrastructure

基础设施

Start & Stop

启动与停止

bash
undefined
bash
undefined

Full setup: build + start + install deps + migrate DB

完整设置:构建 + 启动 + 安装依赖 + 数据库迁移

pipenv run inv start
pipenv run inv start

Build Docker images + start containers (no install/migrate)

构建Docker镜像 + 启动容器(不执行安装/迁移)

pipenv run inv up
pipenv run inv up

Build Docker images only

仅构建Docker镜像

pipenv run inv build
pipenv run inv build

Stop all containers

停止所有容器

pipenv run inv stop
pipenv run inv stop

Destroy everything (containers, volumes, networks) — DESTRUCTIVE

销毁所有资源(容器、卷、网络)—— 此操作具有破坏性

pipenv run inv destroy
undefined
pipenv run inv destroy
undefined

Monitoring

监控

bash
undefined
bash
undefined

List container status

列出容器状态

pipenv run inv ps
pipenv run inv ps

Show container logs

查看容器日志

pipenv run inv logs
pipenv run inv logs

Open bash shell in builder container

在builder容器中打开bash shell

pipenv run inv builder
undefined
pipenv run inv builder
undefined

Workers (RabbitMQ consumers)

工作进程(RabbitMQ 消费者)

bash
undefined
bash
undefined

Start worker containers

启动工作进程容器

pipenv run inv start-workers
pipenv run inv start-workers

Stop worker containers

停止工作进程容器

pipenv run inv stop-workers

---
pipenv run inv stop-workers

---

PHP Backend Testing

PHP后端测试

bash
undefined
bash
undefined

Full test suite (creates test DB + fixtures + PHPUnit)

完整测试套件(创建测试数据库 + 测试数据 + 运行PHPUnit)

pipenv run inv tests
pipenv run inv tests

Run PHPUnit only (assumes test DB already exists)

仅运行PHPUnit(假设测试数据库已存在)

pipenv run inv phpunit
pipenv run inv phpunit

Run specific test(s) by filter

通过过滤器运行特定测试

pipenv run inv phpunit --filter-tests=MyTestClass pipenv run inv phpunit --filter-tests=testMethodName
pipenv run inv phpunit --filter-tests=MyTestClass pipenv run inv phpunit --filter-tests=testMethodName

Run with code coverage

带代码覆盖率的测试

pipenv run inv phpunit --coverage
pipenv run inv phpunit --coverage

Create/reset test database with fixtures

创建/重置带测试数据的测试数据库

pipenv run inv create-test-env
pipenv run inv create-test-env

Import specific fixtures

导入特定测试数据

pipenv run inv import-fixtures

---
pipenv run inv import-fixtures

---

PHP Code Quality

PHP代码质量

bash
undefined
bash
undefined

PHPStan static analysis (level 10)

PHPStan静态分析(级别10)

pipenv run inv phpstan
pipenv run inv phpstan

PHP-CS-Fixer — auto-fix code style

PHP-CS-Fixer — 自动修复代码风格

pipenv run inv cs-fix
pipenv run inv cs-fix

PHP-CS-Fixer — check only (dry-run, used in CI)

PHP-CS-Fixer — 仅检查(试运行,用于CI)

pipenv run inv cs-fix --dry-run
pipenv run inv cs-fix --dry-run

PHP syntax + YAML + Twig linting

PHP语法 + YAML + Twig代码检查

pipenv run inv lint
pipenv run inv lint

Validate Doctrine schema against entities

验证Doctrine映射与实体的一致性

pipenv run inv schema-validate

---
pipenv run inv schema-validate

---

Frontend (Next.js / React)

前端(Next.js / React)

Web

Web端

bash
undefined
bash
undefined

Jest tests

Jest测试

pipenv run inv front-web-test
pipenv run inv front-web-test

ESLint

ESLint代码检查

pipenv run inv front-web-lint
pipenv run inv front-web-lint

TypeScript type check

TypeScript类型检查

pipenv run inv front-web-type
pipenv run inv front-web-type

Prettier formatting check

Prettier格式检查

pipenv run inv front-web-prettier
pipenv run inv front-web-prettier

Unit tests (alternative)

单元测试(替代命令)

pipenv run inv tests-unit-front
pipenv run inv tests-unit-front

Reset frontend API cache

重置前端API缓存

pipenv run inv reset-frontend-api
undefined
pipenv run inv reset-frontend-api
undefined

Mobile App

移动端应用

bash
undefined
bash
undefined

Unit tests

单元测试

pipenv run inv test-app
pipenv run inv test-app

ESLint

ESLint代码检查

pipenv run inv lint-app
pipenv run inv lint-app

TypeScript compliance

TypeScript合规性检查

pipenv run inv typing-app
pipenv run inv typing-app

Format check

格式检查

pipenv run inv format-app
pipenv run inv format-app

Check XCode plist files

检查XCode plist文件

pipenv run inv check-plist

---
pipenv run inv check-plist

---

Database

数据库

bash
undefined
bash
undefined

Run pending migrations

运行待处理的迁移

pipenv run inv migrate
pipenv run inv migrate

Generate a new migration

生成新的迁移文件

pipenv run inv make-migration
pipenv run inv make-migration

Load a SQL dump into dayuse_dev

将SQL转储文件导入dayuse_dev数据库

pipenv run inv mysql-load-dump
pipenv run inv mysql-load-dump

Snapshot current MySQL volume (for fast restore later)

快照当前MySQL卷(用于后续快速恢复)

pipenv run inv volume-mysql-snapshot
pipenv run inv volume-mysql-snapshot

Restore MySQL volume from snapshot

从快照恢复MySQL卷

pipenv run inv volume-mysql-snapshot-restore

---
pipenv run inv volume-mysql-snapshot-restore

---

Elasticsearch

Elasticsearch

bash
undefined
bash
undefined

Rebuild hotel index (full)

重建酒店索引(全量)

pipenv run inv es-build-hotel
pipenv run inv es-build-hotel

Rebuild hotel index for specific country

重建特定国家的酒店索引

pipenv run inv es-build-hotel --country=FR
pipenv run inv es-build-hotel --country=FR

Rebuild POI index

重建POI索引

pipenv run inv es-build-poi
pipenv run inv es-build-poi

Rebuild billing index

重建账单索引

pipenv run inv es-build-billing
pipenv run inv es-build-billing

Rebuild order index

重建订单索引

pipenv run inv es-build-order
pipenv run inv es-build-order

Setup ES snapshot

设置ES快照

pipenv run inv es-setup-snapshot
pipenv run inv es-setup-snapshot

Reset ES snapshot

重置ES快照

pipenv run inv es-reset-snapshot
pipenv run inv es-reset-snapshot

Restore hotel index from snapshot

从快照恢复酒店索引

pipenv run inv es-restore-hotel-snapshot
pipenv run inv es-restore-hotel-snapshot

Restore POI index from snapshot

从快照恢复POI索引

pipenv run inv es-restore-poi-snapshot

---
pipenv run inv es-restore-poi-snapshot

---

Translations

翻译管理

bash
undefined
bash
undefined

Download translations from Loco (frontend + backend)

从Loco下载翻译(前端 + 后端)

pipenv run inv loco-download
pipenv run inv loco-download

Download translations, commit, and push (for releases)

下载翻译、提交并推送(用于发布)

pipenv run inv finalize-release

---
pipenv run inv finalize-release

---

Other Utilities

其他工具命令

bash
undefined
bash
undefined

Clear Symfony cache

清除Symfony缓存

pipenv run inv cache-clear
pipenv run inv cache-clear

Clear dev.log

清空dev.log日志

pipenv run inv log-clear
pipenv run inv log-clear

Install all dependencies (composer + yarn)

安装所有依赖(composer + yarn)

pipenv run inv install
pipenv run inv install

Install composer dependencies only

仅安装composer依赖

pipenv run inv composer-install
pipenv run inv composer-install

Generate SSL certificates

生成SSL证书

pipenv run inv generate-certificates
pipenv run inv generate-certificates

Display help with local URLs

显示包含本地URL的帮助信息

pipenv run inv help

---
pipenv run inv help

---

CI Pipeline Commands

CI流水线命令

When running in CI mode, first set the CI flag:
bash
pipenv run inv ci
CI runs these checks (all must pass):
  1. pipenv run inv phpunit
    — PHP unit tests
  2. pipenv run inv phpstan
    — Static analysis
  3. pipenv run inv cs-fix --dry-run
    — Code style check
  4. pipenv run inv lint
    — Syntax linting
  5. pipenv run inv schema-validate
    — Doctrine schema
  6. pipenv run inv front-web-lint
    — Frontend ESLint
  7. pipenv run inv front-web-type
    — Frontend TypeScript
  8. pipenv run inv front-web-prettier
    — Frontend formatting

在CI模式下运行时,首先设置CI标志:
bash
pipenv run inv ci
CI会运行以下检查(所有检查必须通过):
  1. pipenv run inv phpunit
    — PHP单元测试
  2. pipenv run inv phpstan
    — 静态代码分析
  3. pipenv run inv cs-fix --dry-run
    — 代码风格检查
  4. pipenv run inv lint
    — 语法检查
  5. pipenv run inv schema-validate
    — Doctrine映射验证
  6. pipenv run inv front-web-lint
    — 前端ESLint检查
  7. pipenv run inv front-web-type
    — 前端TypeScript检查
  8. pipenv run inv front-web-prettier
    — 前端格式检查

Local Development URLs

本地开发URL

Once containers are running (
pipenv run inv up
):

当容器启动后(
pipenv run inv up
):

Troubleshooting

故障排查

Containers not starting

容器无法启动

Symptoms:
inv up
fails or containers crash Solution:
bash
pipenv run inv destroy
pipenv run inv start
症状
inv up
失败或容器崩溃 解决方案
bash
pipenv run inv destroy
pipenv run inv start

Test DB out of date

测试数据库过期

Symptoms: PHPUnit fails with schema errors Solution:
bash
pipenv run inv create-test-env
pipenv run inv phpunit
症状:PHPUnit运行时出现映射错误 解决方案
bash
pipenv run inv create-test-env
pipenv run inv phpunit

pipenv not found or wrong Python

pipenv未找到或Python版本错误

Symptoms:
pipenv: command not found
or import errors Solution:
bash
pip install pipenv
pipenv install
症状
pipenv: command not found
或导入错误 解决方案
bash
pip install pipenv
pipenv install

Elasticsearch index empty or stale

Elasticsearch索引为空或过期

Symptoms: Search returns no results Solution:
bash
pipenv run inv es-build-hotel
pipenv run inv es-build-poi
症状:搜索无结果返回 解决方案
bash
pipenv run inv es-build-hotel
pipenv run inv es-build-poi