yangyin
2024-09-09 dd215a74b0e645c2980b2d023e4cabd7f1e44824
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,
   changeBranch
};