微信小程序自动化发布

参考: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);
  })()
}
相关推荐
流***陌2 小时前
宠物寄养美容小程序前端功能解析:贴心照料宠物的全流程支撑
小程序·宠物
小小王app小程序开发5 小时前
任务悬赏小程序深度细分分析:非技术视角下的运营逻辑拆解
大数据·小程序
科士威传动5 小时前
丝杆支撑座在印刷设备如何精准运行?
人工智能·科技·自动化·制造
2501_915918416 小时前
iOS 26 App 性能测试|性能评测|iOS 26 性能对比:实战策略
android·macos·ios·小程序·uni-app·cocoa·iphone
taxunjishu6 小时前
DeviceNet 转 Modbus TCP 协议转换在 S7-1200 PLC化工反应釜中的应用
运维·人工智能·物联网·自动化·区块链
萧鼎12 小时前
Python schedule 库全解析:从任务调度到自动化执行的完整指南
网络·python·自动化
腾马科技12 小时前
新版saas餐饮外卖小程序源码/微信/支付宝/抖音/扫码点餐/DIY装修/美团代付/全开源
微信小程序·小程序·点餐小程序
ManageEngineITSM15 小时前
IT 服务自动化的时代:让效率与体验共进
运维·数据库·人工智能·自动化·itsm·工单系统
郑叔敲代码17 小时前
帝国cms 微信小程序的登录逻辑
微信小程序·小程序·notepad++
棋子一名20 小时前
跑马灯组件 Vue2/Vue3/uni-app/微信小程序
微信小程序·小程序·uni-app·vue·js