zhengyiming
2025-02-13 591a3742e98ad926c88059b8fe8eabd3a8630c25
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.wx88251c84f5cd886b.key`,
      robot: robot,
      setting: {
        minify: true,
      },
    },
    version,
    desc: desc,
  };
};
 
module.exports = { CIPluginFn };