14 lines
2.6 KiB
Python
14 lines
2.6 KiB
Python
from pathlib import Path
|
|
import json,shutil,subprocess
|
|
out=Path(__file__).resolve().parent;root=out.parents[1];private=Path('C:/Users/macbook/.config/investmoz/parques-integral-QA-20261018');qa=private/'source';compat=private/'compatibility';assert not compat.exists()
|
|
restore=json.loads((out/'RESTORE-QA.json').read_text('utf-8'));assert restore['all_tables_equal'];shutil.copytree(qa,compat,ignore=shutil.ignore_patterns('vendor','node_modules','storage','.git','cache'))
|
|
for n in ['vendor','node_modules']:subprocess.run(['powershell','-NoProfile','-Command',"New-Item -ItemType Junction -Path '"+str(compat/n)+"' -Target '"+str(root/n)+"' | Out-Null"],check=True,capture_output=True)
|
|
for d in ['bootstrap/cache','storage/app/private','storage/framework/cache/data','storage/framework/views','storage/framework/sessions','storage/logs']:(compat/d).mkdir(parents=True,exist_ok=True)
|
|
shutil.copytree(qa/'storage/app/private',compat/'storage/app/private',dirs_exist_ok=True)
|
|
for n in ['resources/js/pages/investment/zone.tsx','resources/js/components/investment-zone-operational-details.tsx']:shutil.copy2(root/n,compat/n)
|
|
(compat/'.env').write_text((qa/'.env').read_text('utf-8').replace('parks_integral_20261018_test',restore['restored_database']).replace('18540','18541'),'utf-8')
|
|
boot=(out/'boot-QA.php').read_text('utf-8').replace(qa.as_posix(),compat.as_posix()).replace('parks_integral_20261018_test',restore['restored_database']);(out/'boot-compatibility-QA.php').write_text(boot,'utf-8');(out/'router-compatibility-QA.php').write_text((out/'router-QA.php').read_text('utf-8').replace("'/boot-QA.php'","'/boot-compatibility-QA.php'"),'utf-8')
|
|
node='C:/Users/macbook/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node.exe';p=subprocess.run([node,str(compat/'node_modules/vite/bin/vite.js'),'build'],cwd=compat,capture_output=True,timeout=180);(out/'BUILD-COMPATIBILITY.log').write_bytes(p.stdout+p.stderr);assert p.returncode==0
|
|
f=json.loads((private/'fixture-private.json').read_text('utf-8'));f.update(database=restore['restored_database'],url='http://127.0.0.1:18541');(private/'fixture-compatibility-private.json').write_text(json.dumps(f),'utf-8')
|
|
(out/'COMPATIBILITY-PREPARED.json').write_text(json.dumps({'source':str(compat),'database':restore['restored_database'],'retained_sources':['app/Services/InvestmentZoneIntegralDetails.php','app/Services/InvestmentZoneOperationalDetails.php'],'previous_zone_UI_from_current_active':True,'schema_and_history_retained':True,'build_passed':True,'active_changes':0},indent=2),'utf-8');print('Compatible rollback prepared with current active zone UI and retained data contract')
|