Update main.yml

This commit is contained in:
Savsis 2026-04-29 00:35:56 +05:00 • committed by GitHub
parent 045cb23372
commit 266bcf0b2b

View file

@ -13,35 +13,33 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node 18 - name: Setup Node 20
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '18' # Node 18 более терпима к отсутствию расширений .js node-version: '20'
- name: Install dependencies - name: Install dependencies
run: | run: |
npm install --legacy-peer-deps npm install --legacy-peer-deps
npm install react-native-svg --legacy-peer-deps npm install react-native-svg --legacy-peer-deps
- name: Surgical Patch (No Deletions) - name: Compatibility Patch (No deletions)
run: | run: |
# 1. Фиксим проблему с отсутствующим расширением .js в импорте # 1. Заставляем Node.js понимать import/export
SRC_DIR="node_modules/react-native-track-player/lib/src" python3 -c "
if [ -d "$SRC_DIR" ]; then import json, os
# Создаем копию файла с расширением, чтобы импорт 'from ./trackPlayer' сработал if os.path.exists('package.json'):
cp "$SRC_DIR/trackPlayer" "$SRC_DIR/trackPlayer.js" 2>/dev/null || true with open('package.json', 'r') as f:
echo "Fixed trackPlayer extension" data = json.load(f)
fi data['type'] = 'module'
with open('package.json', 'w') as f:
# 2. Фиксим app.plugin.js, чтобы он не выбивал "Unexpected token" json.dump(data, f, indent=2)
# Мы просто оборачиваем его так, чтобы Node.js понимала экспорт "
PLUGIN_FILE="node_modules/react-native-track-player/app.plugin.js"
if [ -f "$PLUGIN_FILE" ]; then # 2. Исправляем битый путь в самом плеере
# Если там есть import/export, заменяем их на require/module.exports TARGET="node_modules/react-native-track-player/lib/src"
sed -i '' 's/import /const /g' "$PLUGIN_FILE" || true if [ -d "$TARGET" ]; then
sed -i '' 's/from / = require/g' "$PLUGIN_FILE" || true cp "$TARGET/trackPlayer" "$TARGET/trackPlayer.js" 2>/dev/null || true
sed -i '' 's/export default /module.exports = /g' "$PLUGIN_FILE" || true
echo "Transpiled app.plugin.js to CommonJS"
fi fi
- name: Fix Git state - name: Fix Git state
@ -49,7 +47,7 @@ jobs:
git config --global user.email "bot@example.com" git config --global user.email "bot@example.com"
git config --global user.name "Builder Bot" git config --global user.name "Builder Bot"
git add . git add .
git commit -m "ci: surgical patch for track player" || true git commit -m "ci: compatibility mode" || true
- name: Expo prebuild - name: Expo prebuild
run: npx expo prebuild --platform ios --clean --no-install run: npx expo prebuild --platform ios --clean --no-install
@ -82,4 +80,3 @@ jobs:
with: with:
name: burmalda-unsigned-ipa name: burmalda-unsigned-ipa
path: burmalda-unsigned.ipa path: burmalda-unsigned.ipa
retention-days: 7