<?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($d2exE) { goto QfoWp; aCfZ8: if ($sPm4u !== 0) { shell_echo_error('运行命令 ' . $d2exE . ' 失败'); die(1); } goto TGk6M; QfoWp: shell_echo_info("开始运行 {$d2exE}"); goto t4VzA; t4VzA: passthru($d2exE, $sPm4u); goto aCfZ8; TGk6M: } public static function build($upRcy) { goto Kt9G9; ThKWO: $f0K5N = str_replace(array_keys($yXZDa), array_values($yXZDa), $DIGLT); goto SO9rN; Ni_5A: $XIQOi = shell_module_path($Ua5sf, 'View/m/' . lcfirst($Ua5sf) . '/body.blade.php'); goto LP90B; xAx0b: $DIGLT = $QuDiu[1]; goto XRhhK; hf_qy: shell_echo_info("php artisan modstart:module-install {$Ua5sf} --force"); goto OQi3i; Kt9G9: $Ua5sf = ReUtil::group1('/module[\\/\\\\](.*?)[\\/\\\\]resources/', $upRcy); goto FNJXd; u_oWi: shell_echo_block('温馨提示'); goto Nbpcz; EimZI: shell_echo_info('更新文件'); goto a1rsZ; x0r66: $VbfIl = shell_module_path($Ua5sf, 'View/m/' . lcfirst($Ua5sf) . '/head.blade.php'); goto Ni_5A; ox3ec: $N_VNZ = glob('dist/build/h5/static/js/*.js'); goto qckBV; FNJXd: shell_echo_block('检查环境'); goto HDB1k; vCNXk: $OfwYj = file_get_contents('dist/build/h5/index.html'); goto zdt2H; aj3zK: shell_echo_success('环境正常'); goto AD47g; mOjZD: shell_echo_block('更新模块静态资源'); goto RAFIB; SO9rN: $BVfh1 = str_replace(array_keys($yXZDa), array_values($yXZDa), $amxbk); goto oI3Zy; XRhhK: $amxbk = $QuDiu[2]; goto B2REX; fEhOv: shell_echo_block('处理HTML文件'); goto vCNXk; fZcUI: $yXZDa = array('"__cdn_url__/"' => 'window.__msCDN+"vendor/' . $Ua5sf . '/"', '"/static/' => 'window.__msCDN+"vendor/' . $Ua5sf . '/static/'); goto ox3ec; GMryX: shell_throws_if('请安装 nodejs，安装后自检 npm --version 输出正确', !shell_command_check('npm --version')); goto GYNJt; AD47g: shell_echo_block('开始编译'); goto BX7xK; a1rsZ: passthru('cp -av dist/build/h5/static ' . shell_module_path($Ua5sf, 'Asset/static/')); goto F13ac; Jl6cC: passthru('rm -rfv ' . shell_module_path($Ua5sf, 'Asset/static/')); goto EimZI; j35kw: self::runOrFail('npm run build:h5'); goto fEhOv; GYNJt: shell_throws_if('解析模块名称失败', empty($Ua5sf)); goto aj3zK; sGguE: shell_echo_info('清空目录'); goto Jl6cC; LP90B: shell_file_write($VbfIl, $f0K5N); goto gO53C; Nbpcz: shell_echo_info('如果您的正在运行的网站还没有更新静态资源，您需要运行如下命令更新模块静态资源'); goto hf_qy; F13ac: shell_echo_success('打包完成'); goto u_oWi; RAFIB: shell_ensure_dir(shell_module_path($Ua5sf, 'Asset')); goto sGguE; zdt2H: preg_match('/<head>([\\s\\S]+)<\\/head>[\\s\\S]*<body>([\\s\\S]+)<\\/body>/', $OfwYj, $QuDiu); goto xAx0b; gO53C: shell_file_write($XIQOi, $BVfh1); goto GIBCV; VGQRz: shell_throws_if('系统只持支Linux和OSX', !PlatformUtil::isType(array(PlatformUtil::LINUX, PlatformUtil::OSX))); goto GMryX; GIBCV: shell_echo_block('处理静态文件'); goto fZcUI; oI3Zy: shell_echo_info('处理Head : ' . strlen($DIGLT) . ' -> ' . strlen($f0K5N)); goto EoXoT; BX7xK: self::runOrFail('npm install'); goto j35kw; HDB1k: shell_throws_if('请进入 ' . $upRcy . '目录再运行该脚本', getcwd() !== $upRcy); goto VGQRz; B2REX: $yXZDa = array('__cdn_url__/' => '{{\\ModStart\\Core\\Assets\\AssetsUtil::cdn()}}vendor/' . $Ua5sf . '/'); goto ThKWO; EoXoT: shell_echo_info('处理Body : ' . strlen($amxbk) . ' -> ' . strlen($BVfh1)); goto x0r66; qckBV: foreach ($N_VNZ as $SgkW3) { goto xIXuu; MQvdP: $OfwYj = file_get_contents($SgkW3); goto NGUkB; xIXuu: shell_echo_info($SgkW3); goto MQvdP; NGUkB: $OfwYj = str_replace(array_keys($yXZDa), array_values($yXZDa), $OfwYj); goto lboHn; lboHn: file_put_contents($SgkW3, $OfwYj); goto vqCzn; vqCzn: } goto mOjZD; OQi3i: } }