* chore(dev): add local setup state reset target - add a reset-setup make target to clear setup records, root users, and related options. - support both docker dev PostgreSQL and local SQLite development databases. - restart the docker dev backend so setup status is recalculated after reset. * fix(chat): prevent preset menu text overflow - add truncation layout for chat preset names to keep long labels inside the sidebar menu. - prevent loading and external-link icons from shrinking in constrained menu rows. * fix(i18n): translate dashboard granularity options - call t() for granularity option labels in dashboard system settings. - keep localized text consistent between the select trigger and dropdown items. * chore(dev): add backend dev service rebuild target - add a dev-api-rebuild make target to rebuild and start the docker backend service. - reuse DEV_COMPOSE_FILE and DEV_BACKEND_SERVICE variables to avoid repeated compose config literals. * fix(i18n): align interface language option labels - add shared interface language options to keep display names consistent. - reuse the shared options in the header switcher and profile preferences. - normalize language codes so zh-CN and zh_CN resolve to Simplified Chinese. * fix(i18n): add missing frontend translation keys - route channel key prompts, form validation messages, and channel fallback text through i18n. - add missing translations across six locales for channels, rankings, billing, and logs. - update i18n sync reports so literal t() keys are present in the base locale.
70 lines
2.9 KiB
Makefile
70 lines
2.9 KiB
Makefile
FRONTEND_DIR = ./web/default
|
|
FRONTEND_CLASSIC_DIR = ./web/classic
|
|
BACKEND_DIR = .
|
|
DEV_COMPOSE_FILE = docker-compose.dev.yml
|
|
DEV_POSTGRES_SERVICE = postgres
|
|
DEV_BACKEND_SERVICE = new-api
|
|
DEV_POSTGRES_DB = new-api
|
|
DEV_POSTGRES_USER = root
|
|
DEV_SQLITE_PATH ?= one-api.db
|
|
|
|
.PHONY: all build-frontend build-frontend-classic build-all-frontends start-backend dev dev-api dev-api-rebuild dev-web dev-web-classic reset-setup
|
|
|
|
all: build-all-frontends start-backend
|
|
|
|
build-frontend:
|
|
@echo "Building default frontend..."
|
|
@cd $(FRONTEND_DIR) && bun install && DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$(cat ../../VERSION) bun run build
|
|
|
|
build-frontend-classic:
|
|
@echo "Building classic frontend..."
|
|
@cd $(FRONTEND_CLASSIC_DIR) && bun install && VITE_REACT_APP_VERSION=$(cat ../../VERSION) bun run build
|
|
|
|
build-all-frontends: build-frontend build-frontend-classic
|
|
|
|
start-backend:
|
|
@echo "Starting backend dev server..."
|
|
@cd $(BACKEND_DIR) && go run main.go &
|
|
|
|
dev-api:
|
|
@echo "Starting backend services (docker)..."
|
|
@docker compose -f $(DEV_COMPOSE_FILE) up -d
|
|
|
|
dev-api-rebuild:
|
|
@echo "Rebuilding and starting backend service (docker)..."
|
|
@docker compose -f $(DEV_COMPOSE_FILE) up -d --build $(DEV_BACKEND_SERVICE)
|
|
|
|
dev-web:
|
|
@echo "Starting frontend dev server..."
|
|
@cd $(FRONTEND_DIR) && bun install && bun run dev
|
|
|
|
dev-web-classic:
|
|
@echo "Starting classic frontend dev server..."
|
|
@cd $(FRONTEND_CLASSIC_DIR) && bun install && bun run dev
|
|
|
|
dev: dev-api dev-web
|
|
|
|
reset-setup:
|
|
@echo "Resetting local setup wizard state..."
|
|
@if docker compose -f $(DEV_COMPOSE_FILE) ps --services --status running | grep -qx "$(DEV_POSTGRES_SERVICE)"; then \
|
|
echo "Detected running docker dev PostgreSQL. Removing setup record and root users..."; \
|
|
docker compose -f $(DEV_COMPOSE_FILE) exec -T $(DEV_POSTGRES_SERVICE) \
|
|
psql -U $(DEV_POSTGRES_USER) -d $(DEV_POSTGRES_DB) \
|
|
-c 'DELETE FROM setups;' \
|
|
-c 'DELETE FROM users WHERE role = 100;' \
|
|
-c "DELETE FROM options WHERE key IN ('SelfUseModeEnabled', 'DemoSiteEnabled');"; \
|
|
echo "Restarting docker dev backend so setup status is recalculated..."; \
|
|
docker compose -f $(DEV_COMPOSE_FILE) restart $(DEV_BACKEND_SERVICE); \
|
|
elif db_path="$${SQLITE_PATH:-$(DEV_SQLITE_PATH)}"; db_path="$${db_path%%\?*}"; [ -f "$$db_path" ]; then \
|
|
db_path="$${SQLITE_PATH:-$(DEV_SQLITE_PATH)}"; \
|
|
db_path="$${db_path%%\?*}"; \
|
|
echo "Detected local SQLite database: $$db_path"; \
|
|
sqlite3 "$$db_path" \
|
|
"DELETE FROM setups; DELETE FROM users WHERE role = 100; DELETE FROM options WHERE key IN ('SelfUseModeEnabled', 'DemoSiteEnabled');"; \
|
|
echo "SQLite setup state reset. Restart the local backend process before testing the setup wizard."; \
|
|
else \
|
|
echo "No running docker dev PostgreSQL or local SQLite database found."; \
|
|
echo "Start the dev stack with 'make dev-api', or set SQLITE_PATH/DEV_SQLITE_PATH to your local SQLite database."; \
|
|
exit 1; \
|
|
fi
|