Skip to main content

ShopShip Staff

info

Project local: shopship_app_staff

Gitlab: https://gitlab.winds.vn/shopship/shopship_app_staff

Requirements

Trước khi chạy project, cần cài đặt các công cụ sau:

Node.js

Project yêu cầu:

"engines": {
"node": ">=16"
}

Khuyến nghị dùng Node.js 18 hoặc 20 (LTS).

Kiểm tra version:

node -v

Yarn (Classic)

Project dùng Yarn 1.x.

Kiểm tra version:

yarn -v

iOS (macOS)

  • Xcode
  • CocoaPods (theo Gemfile: cocoapods ~> 1.12)
  • iOS deployment target: 13.4 (theo ios/Podfile)

Android

  • Android Studio + Android SDK
  • Theo cấu hình project:
    • minSdkVersion = 21
    • compileSdkVersion = 33
    • targetSdkVersion = 35

Running the development server

1. Cấu hình môi trường API

Project này không dùng .env cho runtime API như mini-app Zalo.
Domain API được khai báo trực tiếp trong code:

  • app/constants/ApiService.js
  • app/constants/ApiServiceUpload.js

Giá trị hiện tại:

export const BASE_URL_DEV = "https://dev.admin.shopship.winds.vn/";
export const BASE_URL_PRO = "https://admin.shopship.winds.vn/";
export const BASE_URL_STAGING = "https://staging.admin.shopship.winds.vn/";
export const BASE_URL_STAGING2 = "https://staging2.admin.shopship.winds.vn/";
export const BASE_URL_LOCAL = "https://local.apishopship.winds.vn/";

Môi trường mặc định trong code:

// app/constants/Constants.js
ENVIROMENT: "pro";

Ngoài ra, khi mở app có thể đổi domain tại màn login (Modal Switch Domain), app sẽ lưu vào AsyncStorage key enviroment.

2. Cài dependencies

Trong thư mục chứa package.json:

yarn install

Nếu chạy iOS:

yarn pod

3. Chạy app local

Cách thông dụng

yarn start
yarn android
# hoặc
yarn ios

Dùng script có sẵn để reverse cổng ADB + start Metro

yarn 8081
# hoặc
yarn 8082

Build/Release (CodePush)

1. Đăng nhập các CLI cần thiết

appcenter login
sentry-cli login

Nếu dùng internal tool:

# đảm bảo đã cài và đăng nhập code-push-ws

2. Release CodePush

Production

yarn cpa   # Android
yarn cpi # iOS
yarn cp # iOS + Android

Staging + source map Sentry

yarn cpa-sentry
yarn sentry-push-android

yarn cpi-sentry
yarn sentry-push-ios

Clear deployment staging

yarn cpa-clear
yarn cpi-clear

Lưu ý

  • Sau khi thêm ảnh hoặc text resources, chạy lại:
    yarn li
  • Không dùng R.string.user, dùng R.strings().user.
  • Nếu iOS build lỗi pod, chạy lại:
    yarn pod
  • Project hỗ trợ đổi nhanh môi trường API ngay trên màn hình login để test DEV/STAGING/PROD/LOCAL.