微信小程序自动化发布

参考:https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html

参考:https://www.npmjs.com/package/miniprogram-ci

javascript 复制代码
npm install  miniprogram-ci  -S


上传文件

xx.js

javascript 复制代码
const isNodeJs = typeof process !== 'undefined' && process.release != null && process.release.name === 'node';
let env = "";
if (isNodeJs) {
  //文件处理
  const fs = require("fs")
  env = process && process.argv.slice(2)[0].split("=")[1];
  fs.writeFileSync('./utils/env.js', "export let env='" + env + "'");
  let version = '1.3.6';
  const ci = require('miniprogram-ci');
  (async () => {
    const project = new ci.Project({
      appid: 'wxdb4f1710594a061a',
      type: 'miniProgram',
      projectPath: './',
      privateKeyPath: './private.wxdb4f1710594a061a.key',
      ignores: ['node_modules/**/*', 'build/*', 'package.json', 'package-lock.json', 'gulpfile.js', '*.key'],
    })
    const uploadResult = await ci.upload({
      project,
      version,
      desc: '小程序测试',
      setting: {
        minify: true,
        es6: true,
        es7: true,
        minifyJS: true,
        minifyWXML: true,
        minifyWXSS: true,
        autoPrefixWXSS: true
      },
      onProgressUpdate: console.log,
    })
    console.log(uploadResult, '===>')


    // const previewResult = await ci.preview({
    //   project,
    //   desc: '1.1.4',
    //   setting:{
    //         es6: true,
    //       },
    //   robot:2,
    //   qrcodeFormat: 'image',
    //   qrcodeOutputDest: './test.jpg',
    //   onProgressUpdate: console.log,
    // });
    // console.log(previewResult);
  })()
}
相关推荐
daguanren1 小时前
await nextTick() 之后,页面为什么还没变?读 weapp-vite / Wevu 的三段更新链路
微信小程序·vite
xy34531 小时前
dsh_builtin_browser 插件实现自动化登录测试
自动化·dsh
Kainy3 小时前
93条CVE怎么核对?用Syft生成SBOM加Grype匹配,把服务器漏洞排查从体力活变成三步自动化
运维·服务器·自动化
FX1317887KP_18 小时前
KET/PET/FCE 口语答案说多长才合适?长度参考与展开方法
小程序·ket口语·pet口语·fce备考·剑桥英语
律宏阔1 天前
微信小程序 + Taro + TanStack Query 缓存与页面返回刷新踩坑实录
前端·微信小程序·taro
千寻技术帮1 天前
微信小程序+Spring Boot 烘焙商城系统(附完整源码+数据库+部署文档)50053
数据库·spring boot·微信小程序·烘焙商城
码云之上2 天前
微信小程序设备指纹实践,删了重装还能认出这台手机吗?
前端·安全·微信小程序
源码手记2 天前
基于微信小程序的相亲交友智能匹配系统-附源码
微信小程序·小程序·交友
源码手记2 天前
基于微信小程序的图书馆座位预约系统(程序+文档)
微信小程序·小程序
承渊政道2 天前
【Python编程快速上手—让繁琐工作自动化】(字典和结构化数据:用键值对搭出棋盘和游戏背包)
python·游戏·pycharm·自动化·字典和结构化数据