官方文档
ip查看地址
1、下载包:
npm install miniprogram-ci --save
2、小程序后台:
3、将生成的密钥放置到项目根目录
4、项目根目录创建autoUpload.js 编写自动上传代码:
const ci = require('miniprogram-ci')
const path = require('path');
(async () => {
const project = new ci.Project({
appid: 'wxb0d43b628663b9ef',//appid
type: 'miniProgram',
projectPath: path.resolve(__dirname, './dist/build/mp-weixin'), //项目路径
privateKeyPath: path.resolve(__dirname, './private.wxb0d43b628663b9ef.key'), //小程序后台的上传密匙
ignores: ['node_modules/**/*'],
})
const uploadResult = await ci.upload({
project,
version: '5.2.9',
desc: '',
setting: {
es6: true
},
onProgressUpdate: console.log,
})
console.log(uploadResult)
})()
5、package.json中修改打包命令
"build:upload": "npm run build:mp-weixin && node autoUpload.js"
6、打包运行,自动上传成功