1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  | const config = require('../project.config.json'); 
 |  const pkg = require('../package.json'); 
 |  const path = require('path'); 
 |  const semver = require('semver'); 
 |    
 |  let projectPath = path.resolve(__dirname, '..'); 
 |    
 |  const CIPluginFn = async () => { 
 |    let version; 
 |    let robot = 30; 
 |    let desc = ''; 
 |    if (process.env.NODE_ENV === 'production') { 
 |      version = pkg.version; 
 |      robot = 1; 
 |      desc = '正式环境小程序'; 
 |      if (process.env.APP_ENV === 'staging') { 
 |        version = semver.inc(version, 'patch'); 
 |        robot = 2; 
 |        desc = '测试环境小程序'; 
 |      } 
 |    } 
 |    
 |    /** 
 |     * @typedef { import("@tarojs/plugin-mini-ci").CIOptions } CIOptions 
 |     * @type {CIOptions} 
 |     */ 
 |    return { 
 |      weapp: { 
 |        appid: config.appid, 
 |        privateKeyPath: `${projectPath}/ci/private.wxb9e0baf4f87aa0de.key`, 
 |        robot: robot, 
 |        setting: { 
 |          minify: false, 
 |        }, 
 |      }, 
 |      version, 
 |      desc: desc, 
 |    }; 
 |  }; 
 |    
 |  module.exports = { CIPluginFn }; 
 |  
  |