current position:Home>How to upload applet code through node? Just take a look

How to upload applet code through node? Just take a look

2022-04-29 16:33:04Crmeb technical team

Get the secret key and set the whitelist server in the applet background IP( WeChat public platform - Development - Development and setup )

Wechat public platform address :mp.weixin.qq.com

1、 Get the secret key

2、 Set the whitelist , Fill in the whitelist of your own servers ip Address , for example :192.168.1.1

install miniprogram-ci

npm install miniprogram-ci --save
 Copy code 

Create preview file

//  Introduce installed miniprogram-ci package 

const ci = require('miniprogram-ci');

//  establish project object 

const project = new ci.Project({

    appid: ' Applet appid',

    projectPath: ' Applet code folder (project.config.json Folder in which )',

    privateKeyPath: ' The address of the secret key file obtained by the applet background ',

})



const previewResult = ci.preview({

project,

    desc: 'miniprogram-ci preview ', //  Applet description 

    setting: {

        es6: true, //  Turn on es5 turn es6

}, 

    qrcodeFormat: 'image', //  Return to preview the format of QR code file 

    qrcodeOutputDest: ' QR code file saving path ',

    onProgressUpdate: console.log, //  Progress update listening function 

})

console.log(previewResult)
 Copy code 

Execute preview applet file

// preview.js Is the address of the uploaded file 

node preview.js 
 Copy code 

Create upload file

//  Introduce installed miniprogram-ci package 

const ci = require('miniprogram-ci');

//  establish project object 

const project = new ci.Project({

    appid: ' Applet appid',

    projectPath: ' Applet code folder (project.config.json Folder in which )',

    privateKeyPath: ' The address of the secret key file obtained by the applet background ',

})

const uploadResult = ci.upload({

project,

    robot: 8, // ci Robot number 1-30 Inside 

    version: '1.1.1', //  Applet version 

    desc: 'miniprogram-ci Upload ', //  Applet description 

    setting: {

        es6: true, //  Turn on es5 turn es6

},

    onProgressUpdate: console.log, //  Progress update listening function 

})

console.log(uploadResult)
 Copy code 

Execute the upload applet file

// upload.js Is the address of the uploaded file 

node upload.js 
 Copy code 

Be careful :node Version needs to be 12 above , So far, the course has been explained , You can leave a message below if you don't understand

Last

If you think this article is useful to you , Please give our open source project a little bit star:github.crmeb.net/u/defu Thank you for  !

Get the source code address for free :www.crmeb.com

PHP Learning manual :doc.crmeb.com

Technical exchange forum :q.crmeb.com

copyright notice
author[Crmeb technical team],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/04/202204291633024279.html

Random recommended