@itcase/config 1.7.29 → 1.7.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # Прод на эмуляторе. Системный раздел должен быть записываемым,
4
- # иначе имена из URL_VAR не попадут в hosts.
4
+ # иначе имена из URL_VAR не попадут в hosts и CA не встанет в системное хранилище.
5
5
  #
6
- # Usage: android-apk-emulator-prod.sh -PENV=PROD [-AVD=name] URL_VAR...
6
+ # Usage: android-apk-emulator-prod.sh -PENV=PROD [-AVD=name] [-CA=alias] URL_VAR...
7
7
  # -PENV уходит в Gradle. У PROD в имени APK нет «PROD».
8
8
  # -AVD имя эмулятора. Без флага — первый AVD.
9
+ # -CA имя корневого сертификата в связке ключей macOS.
9
10
  # URL_VAR имена переменных из .env.defaults, по одному на комплекс
10
11
 
11
12
  set -euo pipefail
@@ -17,17 +18,19 @@ cd "$root"
17
18
 
18
19
  env_flag=
19
20
  avd_name=
21
+ ca_alias=
20
22
  url_keys=()
21
23
  for arg in "$@"; do
22
24
  case "$arg" in
23
25
  -PENV=*) env_flag=$arg ;;
24
26
  -AVD=*) avd_name=${arg#-AVD=} ;;
27
+ -CA=*) ca_alias=${arg#-CA=} ;;
25
28
  *) url_keys+=("$arg") ;;
26
29
  esac
27
30
  done
28
31
 
29
32
  if [ -z "$env_flag" ] || [ ${#url_keys[@]} -eq 0 ]; then
30
- echo "Usage: android-apk-emulator-prod.sh -PENV=PROD [-AVD=name] URL_VAR..."
33
+ echo "Usage: android-apk-emulator-prod.sh -PENV=PROD [-AVD=name] [-CA=alias] URL_VAR..."
31
34
  exit 1
32
35
  fi
33
36
 
@@ -139,5 +142,53 @@ current_hosts=$(adb -s "$serial" shell cat /system/etc/hosts | tr -d '\r')
139
142
  printf '%s\n' "${host_lines[@]}"
140
143
  } | adb -s "$serial" shell "cat > /data/local/tmp/hosts && cp /data/local/tmp/hosts /system/etc/hosts"
141
144
 
145
+ install_ca() {
146
+ local alias="$1"
147
+ local pem tmp hash fp n dest remote_fp
148
+
149
+ pem=$(mktemp)
150
+ tmp=$(mktemp)
151
+ security find-certificate -c "$alias" -p >"$pem"
152
+ if ! openssl x509 -in "$pem" -noout >/dev/null 2>&1; then
153
+ echo "Нет сертификата $alias в связке ключей"
154
+ exit 1
155
+ fi
156
+
157
+ hash=$(openssl x509 -in "$pem" -noout -subject_hash_old)
158
+ openssl x509 -in "$pem" -out "$tmp"
159
+ fp=$(openssl x509 -in "$tmp" -noout -fingerprint -sha1)
160
+
161
+ n=0
162
+ while [ "$n" -lt 10 ]; do
163
+ dest="/system/etc/security/cacerts/${hash}.$n"
164
+ remote_fp=$(
165
+ adb -s "$serial" shell "cat $dest" 2>/dev/null |
166
+ openssl x509 -noout -fingerprint -sha1 2>/dev/null || true
167
+ )
168
+ if [ "$remote_fp" = "$fp" ]; then
169
+ echo "→ CA $alias уже есть"
170
+ rm -f "$pem" "$tmp"
171
+ return
172
+ fi
173
+ if [ -z "$remote_fp" ]; then
174
+ break
175
+ fi
176
+ n=$((n + 1))
177
+ done
178
+
179
+ adb -s "$serial" push "$tmp" /data/local/tmp/ca.pem >/dev/null
180
+ adb -s "$serial" shell "cp /data/local/tmp/ca.pem $dest && chmod 644 $dest"
181
+ echo "→ CA $alias → $dest"
182
+ rm -f "$pem" "$tmp"
183
+ echo "→ перезапуск: системные CA читаются при загрузке"
184
+ adb -s "$serial" reboot
185
+ wait_boot "$serial"
186
+ adb -s "$serial" root
187
+ }
188
+
189
+ if [ -n "$ca_alias" ]; then
190
+ install_ca "$ca_alias"
191
+ fi
192
+
142
193
  echo "→ $serial (ENV=$env_name, $app_id, hosts)"
143
194
  install_debug_apk "$env_name" "$app_id" "$serial" "$root"
@@ -84,6 +84,9 @@ install_debug_apk() {
84
84
  local apk_dir="$root/android/app/build/outputs/apk/debug"
85
85
  local apk
86
86
 
87
+ # Чужой http_proxy рвёт загрузку Metro с 10.0.2.2:8081.
88
+ adb -s "$serial" shell settings put global http_proxy :0
89
+
87
90
  (cd "$root/android" && ./gradlew assembleDebug -x lint -PENV="$env_name")
88
91
 
89
92
  if ls "$apk_dir"/*"$env_name"*.apk >/dev/null 2>&1; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/config",
3
- "version": "1.7.29",
3
+ "version": "1.7.31",
4
4
  "author": "ITCase",
5
5
  "description": "ITCase Config",
6
6
  "engines": {
@@ -40,9 +40,9 @@
40
40
  "registry": "https://registry.npmjs.org/"
41
41
  },
42
42
  "dependencies": {
43
- "@commitlint/cli": "^21.2.3",
44
- "@commitlint/config-conventional": "^21.2.3",
45
- "@commitlint/cz-commitlint": "^21.2.3",
43
+ "@commitlint/cli": "^21.2.4",
44
+ "@commitlint/config-conventional": "^21.2.4",
45
+ "@commitlint/cz-commitlint": "^21.2.4",
46
46
  "@lehoczky/postcss-fluid": "^1.0.3",
47
47
  "@lerna-lite/cli": "^5.6.3",
48
48
  "@lerna-lite/exec": "^5.6.3",
@@ -73,7 +73,7 @@
73
73
  "cssnano-preset-default": "^9.8.0",
74
74
  "inquirer": "^14.2.3",
75
75
  "log-update": "^8.0.0",
76
- "postcss": "^8.5.30",
76
+ "postcss": "^8.5.31",
77
77
  "postcss-aspect-ratio-polyfill": "^2.0.0",
78
78
  "postcss-clamp": "^4.1.0",
79
79
  "postcss-cli": "^12.0.0",