From 6e3dff485788426e94b7fad0edb1717e3f0c9f40 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期四, 14 十一月 2024 11:24:06 +0800
Subject: [PATCH] selfAdapt

---
 scripts/helper.js |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/scripts/helper.js b/scripts/helper.js
index bb8a764..281ab87 100644
--- a/scripts/helper.js
+++ b/scripts/helper.js
@@ -17,7 +17,11 @@
 /** 鍏叡鏂囦欢澶癸紝鎵�鏈夊鎴锋枃浠跺す鍏变韩鏂囦欢 */
 const commonDir = path.join(customerListDir, 'common');
 
-const homeDir = os.homedir();
+ const item = customerList[0];
+const customerSplit = item?.split(':');
+const deployEnv = customerSplit?.[1];
+// 鏄惁涓虹敓浜х幆澧�
+const isPro = deployEnv==='pro';
 // const deployEnv = process.argv[3];
 
 const logColor = (text, color) => {
@@ -334,7 +338,23 @@
 	logSuccess(`${formatDate(new Date(), 'HH:MM:SS')} > 馃帀馃帀馃帀銆�${customerList.join(',')}銆戦」鐩凡鎴愬姛閮ㄧ讲锛侌煄夝煄夝煄塦);
 };
 
+/**
+ * 鍒囨崲鍒嗘敮
+ */
+const changeBranch = () =>{
+	if (isPro) {
+		try {
+			execSync('git checkout master', { stdio: 'inherit' });
+		} catch (error) {}
+	} else {
+		try {
+			execSync('git checkout test', { stdio: 'inherit' });
+		} catch (error) {}
+	}
+}
+
 module.exports = {
+	isPro,
 	firstCustomerName,
 	exit,
 	customerList,
@@ -364,4 +384,6 @@
 
 	updateImportGlob,
 	restoreImportGlob,
+	deployEnv,
+	changeBranch
 };

--
Gitblit v1.9.3