1.0.0 • Published 10 months ago

@answermomo/mini-ci v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

@answer/mini-ci

介绍

对微信小程序的代码编译模块库miniprogram-ci进行了封装。方便项目的实际使用情况。

功能特性

  • 无需扫码登录
  • 自动读取appid、privateKeyPath、setting
  • 自动更新package.json的version

安装

npm install @answer/mini-ci --D
// 或
yarn add @answer/mini-ci --D

注意事项

  • 需要在脚本执行的当前目录新建pk目录,并放入微信小程序上传密钥文件,源码:{privateKeyPath:path.join('./pk', `private.${this.projectConfig.appid}.key`)}
  • 微信管理后台未配置IP白名单的,将无法使用 @answer/mini-ci 进行预览和上传

使用

参数定义
// Ci类参数
interface Options {
  workspace: string; // 小程序源码所在路径,默认 "./"
  version: string; // 小程序版本号,为空时,读取package.json的version自增
  desc: string; // 小程序描述,默认:“”
  type: MiniProgramCI.ProjectType; // 构建类型,默认:“miniProgram”
  robot: robot; // 机器人编号,默认:“1”
}
// 实例方法preview 参数
interface PreviewOptions {
  qr: QrType; // 二维码文件格式,'base64' | 'image' | 'terminal';
  qrDest: string; // 预览二维码图片存放路径
  pagePath?: string; // 预览页面路径
  searchQuery?: string; // 预览页面路径启动参数,这里的&字符在命令行中应写成转义字符\&
}
Demo
const Ci = require('@answer/mini-ci');
const project = new Ci(options);
if (env === 'dev') {
    //预览
    project.preview(previewOptions);
} else {
    //上传
    await project.upload();
}
1.0.0

10 months ago