mirror of
https://github.com/langgenius/dify.git
synced 2026-05-20 16:57:01 +08:00
- Replace Makefile with package.json scripts (ci, clean, docker:build-dev, sync-models, version:info); update cli-tests.yml to use pnpm ci - Add cli/Dockerfile.dev: multi-stage local build from monorepo source, proper cache layer order, non-root user, corepack-driven pnpm version - Add .dockerignore at repo root to exclude node_modules/dist/.git from build context - Add cli-docker-build.yml: PR + merge_group validation of Dockerfile.dev, amd64+arm64 via Depot for org; amd64-only for forks - cli-release.yml: pin action SHAs, depot-ubuntu-24.04 runner, move verify-release step before build for fast-fail - main-ci.yml: add packages/tsconfig/** and cli-docker-build.yml to cli path filter - Drop cli/docs/specs/** and cli/docs/*.md (superseded)
31 lines
1.0 KiB
Bash
Executable File
31 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Regenerate TypeScript types from the API swagger spec.
|
|
# Run from the cli/ directory.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
CLI_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
API_DIR="$(cd "$CLI_DIR/../api" && pwd)"
|
|
|
|
echo "→ Generating openapi swagger spec…"
|
|
(cd "$API_DIR" && uv run --project . dev/generate_swagger_specs.py)
|
|
|
|
echo "→ Generating TypeScript types…"
|
|
npx swagger-typescript-api generate \
|
|
--path "$API_DIR/openapi/openapi-swagger.json" \
|
|
--output "$CLI_DIR/src/types" \
|
|
--modular \
|
|
--no-client
|
|
|
|
echo "→ Fixing generated style…"
|
|
sed -i.bak '/\/\/ @ts-nocheck/d' "$CLI_DIR/src/types/data-contracts.ts"
|
|
sed -i.bak '1s|^/\* eslint-disable \*/|/* eslint-disable erasable-syntax-only/enums, ts\/no-explicit-any */|' "$CLI_DIR/src/types/data-contracts.ts"
|
|
rm -f "$CLI_DIR/src/types/data-contracts.ts.bak"
|
|
|
|
pnpm --filter @langgenius/difyctl lint:fix src/types/data-contracts.ts
|
|
|
|
rm -f "$API_DIR/openapi/"*-swagger.json
|
|
|
|
echo "✓ src/types/ updated"
|