name: customer_im_client
publish_to: none

environment:
  sdk: ^3.11.0

workspace:
  - apps/im_app
  - packages/cipher_guard_sdk
  - packages/l10n_sdk
  - packages/media_sdk
  - packages/networks_sdk
  - packages/notification_sdk
  - packages/protocol_sdk
  - packages/rtc_sdk
  - packages/storage_sdk
  - packages/im_log_sdk

dev_dependencies:
  melos: ^7.0.0

melos:
  name: customer_im_client
  packages:
    - apps/*
    - packages/*
  scripts:
    analyze:
      description: "Run flutter analyze in all packages"
      run: melos exec -- flutter analyze .

    test:
      description: "Run flutter test in all packages"
      run: melos exec -- flutter test

    build:
      description: "Run flutter pub get in all packages"
      run: melos exec -- flutter pub get

    clean:
      description: "Run flutter clean in all packages"
      run: melos exec -- flutter clean

    clean:deep:
      description: "Full clean: flutter clean + remove generated files + Android Gradle + pub get"
      run: bash scripts/clean.sh

    gen:
      description: "Run build_runner build in all packages that use it"
      run: bash scripts/table_gen.sh && melos exec --depends-on="build_runner" -- dart run build_runner build --delete-conflicting-outputs

    gen:watch:
      description: "Watch mode code generation in all packages that use build_runner"
      run: melos exec --depends-on="build_runner" -- dart run build_runner watch --delete-conflicting-outputs

    build:android:apk:
      description: "Build Android release APK (本地测试 / 内部分发)"
      run: bash scripts/build_android.sh apk

    build:android:aab:
      description: "Build Android release AAB (Google Play 上架)"
      run: bash scripts/build_android.sh aab

    build:ios:
      description: "Build iOS release IPA (macOS only)"
      run: bash scripts/build_ios.sh

    build:macos:
      description: "Build macOS release app"
      run: bash scripts/build_macos.sh

    build:windows:
      description: "Build Windows release EXE (Windows only)"
      run: bash scripts/build_windows.sh

    sdk:bump:
      description: "Bump SDK constraints to latest stable (from flutter.dev). Pin manually: melos run sdk:bump -- --dart 3.12.0 --flutter 3.40.0"
      run: bash scripts/bump_sdk.sh

    new:sdk:
      description: "Scaffold a new SDK package. Usage: melos run new:sdk -- <name>"
      run: bash scripts/new_sdk.sh

    remove:sdk:
      description: "Remove an SDK package and clean up all references. Usage: melos run remove:sdk -- <name>"
      run: bash scripts/remove_sdk.sh
