migrations fix
This commit is contained in:
46
bin/compile_ts_migrations.sh
Normal file
46
bin/compile_ts_migrations.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
# compile_ts_migrations.sh - Скрипт для компиляции TS миграций в JS
|
||||
|
||||
echo "🔄 Компиляция TypeScript миграций в JavaScript..."
|
||||
|
||||
# Проверка наличия TypeScript файлов
|
||||
if [ ! -f "migrations/*.ts" ] && [ ! -d "node_modules/typescript" ]; then
|
||||
echo "📦 Установка TypeScript..."
|
||||
npm install --no-save typescript
|
||||
fi
|
||||
|
||||
# Создание временного tsconfig для миграций
|
||||
echo "📝 Создание временного tsconfig.json для миграций..."
|
||||
cat > migrations/tsconfig.json << EOL
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "../temp_migrations"
|
||||
},
|
||||
"include": ["./*.ts"]
|
||||
}
|
||||
EOL
|
||||
|
||||
# Компиляция TS файлов
|
||||
echo "🔄 Компиляция TypeScript миграций..."
|
||||
npx tsc -p migrations/tsconfig.json
|
||||
|
||||
# Подтверждение
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Миграции успешно скомпилированы в директорию temp_migrations/"
|
||||
|
||||
# Проверка, были ли созданы файлы
|
||||
file_count=$(find temp_migrations -name "*.js" | wc -l)
|
||||
echo "📊 Скомпилировано файлов: $file_count"
|
||||
else
|
||||
echo "❌ Ошибка при компиляции миграций!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Очистка временных файлов
|
||||
rm migrations/tsconfig.json
|
||||
Reference in New Issue
Block a user