<?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($dTL23) { goto RrEtl; Xp72Z: if ($VJwEt !== 0) { shell_echo_error('运行命令 ' . $dTL23 . ' 失败'); die(1); } goto WKVs5; RrEtl: shell_echo_info("开始运行 {$dTL23}"); goto QBz8w; QBz8w: passthru($dTL23, $VJwEt); goto Xp72Z; WKVs5: } public static function build($x3y1z) { goto rBfqe; jayEZ: shell_echo_block('处理静态文件'); goto EZK0U; e1n5w: $KYwTv = $okKGo[2]; goto d1tdi; uMEx1: $ZA40Q = file_get_contents('dist/build/h5/index.html'); goto cUaX2; d0rN0: shell_echo_block('更新模块静态资源'); goto bPBBw; DtYQa: $UuDi8 = str_replace(array_keys($NSlQN), array_values($NSlQN), $sKReL); goto ovvhn; EeCEn: $ikIIS = glob('dist/build/h5/static/js/*.js'); goto YLc2S; sKjzC: shell_echo_success('打包完成'); goto llyxF; xrpzj: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto edmq0; s8kqG: $CkB4o = shell_module_path($LLvXr, 'View/m/' . lcfirst($LLvXr) . '/head.blade.php'); goto DxhPS; eKyfl: shell_echo_info('更新文件'); goto Yfh1l; bPBBw: shell_ensure_dir(shell_module_path($LLvXr, 'Asset')); goto TaI03; Y1pZv: shell_echo_info('处理Head : ' . strlen($sKReL) . ' -> ' . strlen($UuDi8)); goto YbjXm; kp3cw: shell_echo_block('处理HTML文件'); goto uMEx1; WvQnz: shell_echo_info("php artisan modstart:module-install {$LLvXr} --force"); goto GAXM5; pxky5: $sKReL = $okKGo[1]; goto e1n5w; llyxF: shell_echo_block('温馨提示'); goto ESBbt; mixd3: passthru('rm -rfv ' . shell_module_path($LLvXr, 'Asset/static/')); goto eKyfl; VdZw1: shell_throws_if('解析模块名称失败', empty($LLvXr)); goto AmWhD; AmWhD: shell_echo_success('环境正常'); goto E0Xfb; GL7TV: shell_file_write($TSkZ0, $dobfn); goto jayEZ; TaI03: shell_echo_info('清空目录'); goto mixd3; Yfh1l: passthru('cp -av dist/build/h5/static ' . shell_module_path($LLvXr, 'Asset/static/')); goto sKjzC; EZK0U: $NSlQN = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $LLvXr . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $LLvXr . '/static/'); goto EeCEn; d1tdi: $NSlQN = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $LLvXr . '/'); goto DtYQa; YLc2S: foreach ($ikIIS as $rZJie) { goto oNQhD; N4pgw: $ZA40Q = file_get_contents($rZJie); goto uEojW; oNQhD: shell_echo_info($rZJie); goto N4pgw; W6L0R: file_put_contents($rZJie, $ZA40Q); goto z39xc; uEojW: $ZA40Q = str_replace(array_keys($NSlQN), array_values($NSlQN), $ZA40Q); goto W6L0R; z39xc: } goto d0rN0; xjlQ3: shell_throws_if('请进入 ' . $x3y1z . '目录再运行该脚本', getcwd() !== $x3y1z); goto xrpzj; YbjXm: shell_echo_info('处理Body : ' . strlen($KYwTv) . ' -> ' . strlen($dobfn)); goto s8kqG; cUaX2: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $ZA40Q, $okKGo); goto pxky5; ovvhn: $dobfn = str_replace(array_keys($NSlQN), array_values($NSlQN), $KYwTv); goto Y1pZv; BbkWC: self::runOrFail('npm run build:h5'); goto kp3cw; nk5hN: self::runOrFail('npm install'); goto BbkWC; XNkpu: shell_file_write($CkB4o, $UuDi8); goto GL7TV; ESBbt: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto WvQnz; E0Xfb: shell_echo_block('开始编译'); goto nk5hN; DxhPS: $TSkZ0 = shell_module_path($LLvXr, 'View/m/' . lcfirst($LLvXr) . '/body.blade.php'); goto XNkpu; rBfqe: $LLvXr = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $x3y1z); goto ElXVF; edmq0: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto VdZw1; ElXVF: shell_echo_block('检查环境'); goto xjlQ3; GAXM5: } }