You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.4 KiB
45 lines
1.4 KiB
const ci = require('D:/2h/jenkins/home/workspace/miniprogram-ci/node_modules/miniprogram-ci'); //用固定路径的node modoules,如果没有,需要运行npm install miniprogram-ci --save
|
|
console.log(process.argv);
|
|
// 上传文件处理设置参数
|
|
const uploadParams = {
|
|
es6: true, // "es6 转 es5"
|
|
es7: true, // "增强编译"
|
|
minify: true, // "样式自动补全"
|
|
codeProtect: true, // "代码保护"
|
|
autoPrefixWXSS: true, // "样式自动补全"
|
|
};
|
|
const version = process.argv[4];
|
|
|
|
const robatId = process.argv[5];
|
|
(async () => {
|
|
const project = new ci.Project({
|
|
appid: 'wx20c79f85101be00a',
|
|
type: 'miniGame',
|
|
projectPath: process.argv[2], //参数
|
|
privateKeyPath: process.argv[3],
|
|
robot: robatId,
|
|
ignores: ['node_modules/**/*'],
|
|
})
|
|
const uploadResult = await ci.upload({
|
|
project,
|
|
version,
|
|
desc:"",
|
|
robot: robatId,
|
|
setting: uploadParams,
|
|
onProgressUpdate: console.log,
|
|
});
|
|
console.log(uploadResult);
|
|
const previewResult = await ci.preview({
|
|
project,
|
|
desc:"", // 此备注将显示在“小程序助手”开发版列表中
|
|
setting: {
|
|
es6: true,
|
|
},
|
|
robot: robatId,
|
|
qrcodeFormat: 'image',
|
|
qrcodeOutputDest: './' + version + '.destination.jpg',
|
|
onProgressUpdate: console.log,
|
|
})
|
|
console.log(previewResult)
|
|
process.exit(0);
|
|
})()
|