Skip to content

Commit

Permalink
chore: publish
Browse files Browse the repository at this point in the history
  • Loading branch information
1198994985 committed Aug 29, 2022
1 parent 2218a8b commit 20e3072
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 47 deletions.
1 change: 1 addition & 0 deletions packages/mona-service/src/commands/compress/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function compressDir(inputPath: string, ignoreList: string[] = [])
return outputPath;
}


export function compressDirToZip(inputPath: string, outputPath: string) {
return new Promise((resolve, reject) => {
const output = fs.createWriteStream(outputPath);
Expand Down
90 changes: 43 additions & 47 deletions packages/mona-service/src/commands/publish/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,36 @@ const publish: IPlugin = ctx => {

if (isLightApp) {
// ask desc
const answer = await inquirer.prompt(
[
{
type: 'input',
name: 'version',
message: '请输入版本号,例如1.0.0',
validate(input: string) {
if (!input) {
return '版本号不能为空';
} else if (!/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(input)) {
return '无效的版本号,请输入三位的版本号,如1.0.0';
} else {
return true;
}
},
const answer = await inquirer.prompt([
{
type: 'input',
name: 'version',
message: '请输入版本号,例如1.0.0',
validate(input: string) {
if (!input) {
return '版本号不能为空';
} else if (!/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(input)) {
return '无效的版本号,请输入三位的版本号,如1.0.0';
} else {
return true;
}
},
{
type: 'input',
name: 'desc',
message: '请输入版本描述',
validate(input: string) {
if (!input) {
return '版本描述不能为空';
} else if (input.length > 200) {
return '版本描述长度应小于200';
} else {
return true;
}
},
},
{
type: 'input',
name: 'desc',
message: '请输入版本描述',
validate(input: string) {
if (!input) {
return '版本描述不能为空';
} else if (input.length > 200) {
return '版本描述长度应小于200';
} else {
return true;
}
},
],
);
},
]);

// upload
const { fileId, fileName } = await upload(output, user.userId, args);
Expand All @@ -88,24 +86,22 @@ const publish: IPlugin = ctx => {
} else {
const shouldEdit = latestVersionStatus && [2, 3, 5, 7].indexOf(latestVersionStatus) !== -1;
// ask desc
const answer = await inquirer.prompt(
[
{
type: 'input',
name: 'desc',
message: '请输入版本描述',
validate(input: string) {
if (!input) {
return '版本描述不能为空';
} else if (input.length > 200) {
return '版本描述长度应小于200';
} else {
return true;
}
},
const answer = await inquirer.prompt([
{
type: 'input',
name: 'desc',
message: '请输入版本描述',
validate(input: string) {
if (!input) {
return '版本描述不能为空';
} else if (input.length > 200) {
return '版本描述长度应小于200';
} else {
return true;
}
},
],
);
},
]);

// upload
const { fileId, fileName } = await upload(output, user.userId, args);
Expand Down

0 comments on commit 20e3072

Please sign in to comment.