<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\Util; use ModStart\Core\Util\PlatformUtil; use ModStart\Core\Util\ReUtil; include_once __DIR__ . '/../Shell/include.php'; class UniappUtil { public static function runOrFail($fWYdy) { goto Cemm3; SWHyr: if ($k3CUX !== 0) { shell_echo_error('运行命令 ' . $fWYdy . ' 失败'); die(1); } goto DtA6b; RkJti: passthru($fWYdy, $k3CUX); goto SWHyr; Cemm3: shell_echo_info("开始运行 {$fWYdy}"); goto RkJti; DtA6b: } public static function build($DlTOm) { goto YB8H2; VMfsp: shell_echo_info('清空目录'); goto Rygtw; SSDoc: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto PHjDN; FHjLH: shell_echo_block('处理HTML文件'); goto Kg5aX; RgGPt: shell_echo_block('检查环境'); goto TXeUH; FOt8z: $gJXLJ = str_replace(array_keys($Rt4t5), array_values($Rt4t5), $UReQO); goto aVlmT; aVlmT: $hP6r2 = str_replace(array_keys($Rt4t5), array_values($Rt4t5), $ZI5AS); goto ReYOs; LISGQ: shell_echo_success('环境正常'); goto kG56L; I8cuk: $Rt4t5 = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $WQ9HU . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $WQ9HU . '/static/'); goto QGVUm; Nl5mp: self::runOrFail('npm install'); goto Qxeq4; PHjDN: shell_echo_info("php artisan modstart:module-install {$WQ9HU} --force"); goto bONOd; mmg0n: shell_echo_info('更新文件'); goto Wn6Dp; LuGSI: shell_echo_block('温馨提示'); goto SSDoc; TXeUH: shell_throws_if('请进入 ' . $DlTOm . '目录再运行该脚本', getcwd() !== $DlTOm); goto pBHG9; kG56L: shell_echo_block('开始编译'); goto Nl5mp; Ah5mZ: $utcjB = shell_module_path($WQ9HU, 'View/m/' . lcfirst($WQ9HU) . '/body.blade.php'); goto xxKSK; GAw11: $Rt4t5 = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $WQ9HU . '/'); goto FOt8z; Wn6Dp: passthru('cp -av dist/build/h5/static ' . shell_module_path($WQ9HU, 'Asset/static/')); goto wltJa; KOIXP: foreach ($cKrwB as $x_XbT) { goto HIhyi; HIhyi: shell_echo_info($x_XbT); goto prKOs; HHIon: $eTwx_ = str_replace(array_keys($Rt4t5), array_values($Rt4t5), $eTwx_); goto SXhop; prKOs: $eTwx_ = file_get_contents($x_XbT); goto HHIon; SXhop: file_put_contents($x_XbT, $eTwx_); goto f4qI7; f4qI7: } goto q5jWu; wltJa: shell_echo_success('打包完成'); goto LuGSI; a29h9: $UReQO = $Qie0V[1]; goto Hj65F; q5jWu: shell_echo_block('更新模块静态资源'); goto GkXQ0; qThoY: $MS7w0 = shell_module_path($WQ9HU, 'View/m/' . lcfirst($WQ9HU) . '/head.blade.php'); goto Ah5mZ; VEkjS: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $eTwx_, $Qie0V); goto a29h9; Hj65F: $ZI5AS = $Qie0V[2]; goto GAw11; pBHG9: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto DMAxD; Kg5aX: $eTwx_ = file_get_contents('dist/build/h5/index.html'); goto VEkjS; j_rks: shell_echo_block('处理静态文件'); goto I8cuk; DMAxD: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto p8grm; YB8H2: $WQ9HU = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $DlTOm); goto RgGPt; usltU: shell_file_write($utcjB, $hP6r2); goto j_rks; QGVUm: $cKrwB = glob('dist/build/h5/static/js/*.js'); goto KOIXP; ReYOs: shell_echo_info('处理Head : ' . strlen($UReQO) . ' -> ' . strlen($gJXLJ)); goto YBPYL; Qxeq4: self::runOrFail('npm run build:h5'); goto FHjLH; p8grm: shell_throws_if('解析模块名称失败', empty($WQ9HU)); goto LISGQ; YBPYL: shell_echo_info('处理Body : ' . strlen($ZI5AS) . ' -> ' . strlen($hP6r2)); goto qThoY; Rygtw: passthru('rm -rfv ' . shell_module_path($WQ9HU, 'Asset/static/')); goto mmg0n; GkXQ0: shell_ensure_dir(shell_module_path($WQ9HU, 'Asset')); goto VMfsp; xxKSK: shell_file_write($MS7w0, $gJXLJ); goto usltU; bONOd: } }