wujingjing
2024-12-11 2144fb07b53812f565b2801f99e69cee9b28cab3
scripts/helper.js
@@ -17,11 +17,11 @@
/** 公共文件夹,所有客户文件夹共享文件 */
const commonDir = path.join(customerListDir, 'common');
 const item = customerList[0];
const customerSplit = item.split(':');
const deployEnv = customerSplit[1];
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) => {
@@ -195,11 +195,11 @@
const copyAmisEditor = () => {
   // 复制amis-editor 到 public文件夹中
   const amisEditorPath = path.join(rootDir, 'amis-editor');
   const amisEditorPath = path.join(rootDir, 'wi.amis', 'amis-editor');
   const targetPath = path.join(publicDir, 'amis-editor');
   const isExist = fs.pathExistsSync(amisEditorPath);
   if (!isExist) {
      logWarn('amis-editor 不存在!');
      logWarn(`amis-editor(路径:${amisEditorPath} 不存在!`);
   } else {
      const isExist = fs.pathExistsSync(targetPath);
      if (!isExist) {
@@ -341,7 +341,7 @@
/**
 * 切换分支
 */
const changeBranch = () =>{
const changeBranch = () => {
   if (isPro) {
      try {
         execSync('git checkout master', { stdio: 'inherit' });
@@ -351,7 +351,7 @@
         execSync('git checkout test', { stdio: 'inherit' });
      } catch (error) {}
   }
}
};
module.exports = {
   isPro,
@@ -385,5 +385,5 @@
   updateImportGlob,
   restoreImportGlob,
   deployEnv,
   changeBranch
   changeBranch,
};