wujingjing
2024-10-31 b5b548b5fc015bdd727159b8f3d1916172c92d91
scripts/helper.js
@@ -18,8 +18,8 @@
const commonDir = path.join(customerListDir, 'common');
 const item = customerList[0];
const customerSplit = item.split(':');
const deployEnv = customerSplit[1];
const customerSplit = item?.split(':');
const deployEnv = customerSplit?.[1];
// 是否为生产环境
const isPro = deployEnv==='pro';
// const deployEnv = process.argv[3];
@@ -338,6 +338,21 @@
   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,
@@ -369,4 +384,6 @@
   updateImportGlob,
   restoreImportGlob,
   deployEnv,
   changeBranch
};