Skip to content

Commit d88f68e

Browse files
committed
Improve validation error messages
1 parent ca7ecc1 commit d88f68e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/commands/publish.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ export const publish = async (argv: string[]) => {
5252
return acc;
5353
}, [] as { name: string; errors: string[] }[]);
5454
if (invalidItemMessages.length > 0) {
55-
console.error("Validation error:");
55+
const chalk = (await import("chalk")).default;
5656
invalidItemMessages.forEach((msg) => {
57-
console.error(msg.name, msg.errors);
57+
msg.errors.forEach((err) => {
58+
let text = chalk.red.bold(`${msg.name}: `);
59+
text += chalk.red(err);
60+
console.error(text);
61+
});
5862
});
63+
5964
process.exit(1);
6065
}
6166

src/lib/check-frontmatter-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const checkOrganizationUrlName: CheckType = {
6565

6666
const checkSlide: CheckType = {
6767
getMessage: () =>
68-
"slideの設定はtrue/falseで入力してください\n\n【破壊的な変更がありました】\n詳しくは以下のリリースをご確認ください\nhttps://github.com/increments/qiita-cli/releases/tag/v0.5.0",
68+
"slideの設定はtrue/falseで入力してください破壊的な変更がありました。詳しくはリリースをご確認ください https://github.com/increments/qiita-cli/releases/tag/v0.5.0",
6969
isValid: ({ slide }) => {
7070
return typeof slide === "boolean";
7171
},

0 commit comments

Comments
 (0)