Skip to content

Commit

Permalink
feat: 优化mp-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
novlan1 committed Oct 18, 2022
1 parent fc25590 commit 5db9c1c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export * from './git';
export * from './jsdoc';
export * from './loader';
export * from './morse-pwd';
export * from './mp-cli';
export * from './mp-ci';
export * from './node-img';
export * from './open-source-report';
export * from './pipeline';
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/mp-ci/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MpCI } from './mp-ci';
24 changes: 17 additions & 7 deletions src/mp-cli/mp-cli.ts → src/mp-ci/mp-ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { saveBase64ImgToFile } from '../node-img/img';
import { OptionsType } from './type';
import { DEFAULT_BUILD_SETTING } from './config';

export class MpCLI {
export class MpCI {
ciLib: any;
options: OptionsType;

Expand All @@ -36,7 +36,10 @@ export class MpCLI {
buildTime: string;
version: string;


/**
* 小程序自动化构建工具
* @param {object} options 选项
*/
constructor(options: OptionsType) {
const path = require('path');
const fs = require('fs');
Expand Down Expand Up @@ -137,6 +140,9 @@ export class MpCLI {
return buildDesc;
}

/**
* 上传
*/
async upload() {
const { robotNumber, version, buildDesc } = this;

Expand All @@ -150,6 +156,9 @@ export class MpCLI {
console.log('UploadResult:\n', uploadResult);
}

/**
* 预览
*/
async preview() {
const previewResult = await this.ciLib.preview({
project: this.projectCI,
Expand All @@ -165,6 +174,9 @@ export class MpCLI {
await this.uploadPreviewImg();
}

/**
* 上传预览图片到COS
*/
async uploadPreviewImg() {
const { appName, robotNumber, env, buildTime, commitInfo, version } = this;

Expand Down Expand Up @@ -198,11 +210,9 @@ export class MpCLI {
]);
}

async uploadAndPreview() {
await this.upload();
await this.preview();
}

/**
* 发送机器人消息
*/
async sendRobotMsg() {
const { robotNumber, webhookUrl, version, buildDesc, buildTime } = this;
let { chatId } = this;
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/mp-cli/index.ts

This file was deleted.

0 comments on commit 5db9c1c

Please sign in to comment.