<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Developer; use ModStart\Core\Util\PlatformUtil; use ModStart\Core\Util\ReUtil; include_once __DIR__ . '/../Shell/include.php'; class UniappUtil { public static function runOrFail($KAM2b) { goto u5opy; JbzVo: if ($Nb0n6 !== 0) { shell_echo_error('运行命令 ' . $KAM2b . ' 失败'); die(1); } goto Teaxl; u5opy: shell_echo_info("开始运行 {$KAM2b}"); goto ml7je; ml7je: passthru($KAM2b, $Nb0n6); goto JbzVo; Teaxl: } public static function build($h7bpP) { goto ct_pA; OHkT3: shell_echo_block('更新模块静态资源'); goto tgrt8; PppF1: $HrZl0 = str_replace(array_keys($cuhSn), array_values($cuhSn), $Attjt); goto CyHzY; IYqor: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $MPmfx, $Uy2Nw); goto zQbgh; jWCeg: $cuhSn = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $lMMoV . '/'); goto PppF1; QINSM: shell_file_write($aD2mX, $amfst); goto U_2Ei; wzric: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto t0tww; tlqi3: shell_file_write($K0xOi, $HrZl0); goto QINSM; fv4qf: $GntWd = glob('dist/build/h5/static/js/*.js'); goto xOsgH; lYZm2: shell_echo_block('开始编译'); goto jPmbw; J5h0v: shell_echo_block('检查环境'); goto HQpGt; F66Ju: shell_echo_info('处理Body : ' . strlen($k05vF) . ' -> ' . strlen($amfst)); goto SJMfH; U_2Ei: shell_echo_block('处理静态文件'); goto Wz4q8; nOhwd: shell_echo_info('清空目录'); goto EoH_T; Ir49i: shell_echo_info('处理Head : ' . strlen($Attjt) . ' -> ' . strlen($HrZl0)); goto F66Ju; AoXSN: passthru('cp -av dist/build/h5/static ' . shell_module_path($lMMoV, 'Asset/static/')); goto i8kbK; ct_pA: $lMMoV = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $h7bpP); goto J5h0v; z0_wV: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto kK8OS; xOsgH: foreach ($GntWd as $Jm77a) { goto ImjUs; ImjUs: shell_echo_info($Jm77a); goto UtQru; UtQru: $MPmfx = file_get_contents($Jm77a); goto Eg0kH; Eg0kH: $MPmfx = str_replace(array_keys($cuhSn), array_values($cuhSn), $MPmfx); goto r_Jq3; r_Jq3: file_put_contents($Jm77a, $MPmfx); goto aXD1j; aXD1j: } goto OHkT3; SJMfH: $K0xOi = shell_module_path($lMMoV, 'View/m/' . lcfirst($lMMoV) . '/head.blade.php'); goto mDr4n; qm8dJ: shell_echo_info('更新文件'); goto AoXSN; zQbgh: $Attjt = $Uy2Nw[1]; goto B_zFv; nQNAR: shell_echo_block('处理HTML文件'); goto QQVIw; jPmbw: self::runOrFail('npm install'); goto D2eK_; Wz4q8: $cuhSn = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $lMMoV . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $lMMoV . '/static/'); goto fv4qf; kvU_3: shell_echo_success('环境正常'); goto lYZm2; D2eK_: self::runOrFail('npm run build:h5'); goto nQNAR; t0tww: shell_throws_if('解析模块名称失败', empty($lMMoV)); goto kvU_3; iYY_X: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto wzric; HQpGt: shell_throws_if('请进入 ' . $h7bpP . '目录再运行该脚本', getcwd() !== $h7bpP); goto iYY_X; CyHzY: $amfst = str_replace(array_keys($cuhSn), array_values($cuhSn), $k05vF); goto Ir49i; EoH_T: passthru('rm -rfv ' . shell_module_path($lMMoV, 'Asset/static/')); goto qm8dJ; tgrt8: shell_ensure_dir(shell_module_path($lMMoV, 'Asset')); goto nOhwd; i8kbK: shell_echo_success('打包完成'); goto m23J_; B_zFv: $k05vF = $Uy2Nw[2]; goto jWCeg; QQVIw: $MPmfx = file_get_contents('dist/build/h5/index.html'); goto IYqor; kK8OS: shell_echo_info("php artisan modstart:module-install {$lMMoV} --force"); goto jWbst; m23J_: shell_echo_block('温馨提示'); goto z0_wV; mDr4n: $aD2mX = shell_module_path($lMMoV, 'View/m/' . lcfirst($lMMoV) . '/body.blade.php'); goto tlqi3; jWbst: } }