微信小程序自动化发布

参考: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);
  })()
}
相关推荐
WangHappy1 天前
不写 Canvas 也能搞定!小程序图片导出的 WebView 通信方案
前端·微信小程序
小时前端1 天前
微信小程序选不了本地文件?用 web-view + H5 一招搞定
前端·微信小程序·uni-app
icebreaker2 天前
Weapp-vite:原生模式之外,多一种 Vue SFC 选择
前端·vue.js·微信小程序
icebreaker2 天前
重走 Vue 长征路 Weapp-vite:编译链路与 Wevu 运行时原理拆解
前端·vue.js·微信小程序
大米饭消灭者5 天前
Taro是怎么实现一码多端的【底层原理】
微信小程序·taro
FliPPeDround6 天前
Vitest Environment UniApp:让 uni-app E2E 测试变得前所未有的简单
微信小程序·e2e·前端工程化
FliPPeDround6 天前
微信小程序自动化的 AI 新时代:wechat-devtools-mcp 智能方案
微信小程序·ai编程·mcp
金智维科技官方6 天前
智能体,重构企业自动化未来
人工智能·自动化·agent·智能体·数字员工
吴声子夜歌6 天前
小程序——布局示例
小程序
码云数智-大飞6 天前
如何创建自己的小程序,码云数智与有赞平台对比
微信小程序