From 77b15609b62c9bcd80fcdfd65f134a06252920b9 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 14 四月 2025 17:11:21 +0800 Subject: [PATCH] 48px --- scripts/helper.js | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/helper.js b/scripts/helper.js index 31a0803..754e0ad 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -3,6 +3,7 @@ const os = require('os'); const path = require('path'); const chalk = require('chalk'); +require('dotenv').config({ path: '.env.local' }); // 鑾峰彇褰撳墠鑴氭湰鎵�鍦ㄧ殑鐩綍 const scriptDir = __dirname; @@ -10,18 +11,19 @@ const argv2 = process.argv[2]; const customerList = argv2?.split(' ') ?? ''; const publicDir = path.join(rootDir, 'public'); -const distDir = path.join(rootDir, 'dist'); + +const distDir = process.env.VITE_OUTPUT_DIR || path.join(rootDir, 'dist'); const customerListDir = path.join(rootDir, 'customer_list'); const customerProjectListDir = path.join(rootDir, 'src', 'views', 'project'); const firstCustomerName = customerList[0]?.split(':')[0]; /** 鍏叡鏂囦欢澶癸紝鎵�鏈夊鎴锋枃浠跺す鍏变韩鏂囦欢 */ const commonDir = path.join(customerListDir, 'common'); - const item = customerList[0]; +const item = customerList[0]; const customerSplit = item?.split(':'); const deployEnv = customerSplit?.[1]; // 鏄惁涓虹敓浜х幆澧� -const isPro = deployEnv==='pro'; +const isPro = deployEnv === 'pro'; // const deployEnv = process.argv[3]; const logColor = (text, color) => { @@ -72,7 +74,7 @@ */ const checkCustomer = (command, customer = firstCustomerName) => { if (!customer) { - console.error(chalk.red(`璇锋纭娇鐢ㄥ懡浠� 鈥�${command} [customer]鈥� `)); + console.error(chalk.red(`璇锋纭娇鐢ㄥ懡浠� "${command} [customer]"`)); exit(); // 閫�鍑鸿剼鏈� } @@ -238,7 +240,7 @@ checkFileExist(deployJSON, '閰嶇疆鏂囦欢'); // 璇诲彇 JSON 鏂囦欢 const config = await fs.readJson(deployJSON).catch((err) => { - console.error(`璇诲彇閰嶇疆鏂囦欢鈥�${deployJSON}鈥濆嚭閿�:`, err); + console.error(`璇诲彇閰嶇疆鏂囦欢"${deployJSON}"鍑洪敊:`, err); exit(); }); @@ -293,7 +295,7 @@ } } } catch (error) { - console.error(`璇诲彇鈥�${customerFolder}鈥濆け璐, error); + console.error(`璇诲彇"${customerFolder}"澶辫触`, error); } try { @@ -323,7 +325,7 @@ /** * 鍒囨崲鍒嗘敮 */ -const changeBranch = () =>{ +const changeBranch = () => { return; if (isPro) { try { @@ -334,7 +336,7 @@ execSync('git checkout test', { stdio: 'inherit' }); } catch (error) {} } -} +}; module.exports = { isPro, @@ -368,5 +370,5 @@ updateImportGlob, restoreImportGlob, deployEnv, - changeBranch + changeBranch, }; -- Gitblit v1.9.3