Skip to content

Commit 517826b

Browse files
committed
fixup! Add frontmatter check to publish command
1 parent 24d5ac5 commit 517826b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/commands/publish.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ export const publish = async (argv: string[]) => {
4545

4646
// Validate
4747
const invalidItemMessages = targetItems.reduce((acc, item) => {
48-
const errors = validateItem(item);
4948
const frontmatterErrors = checkFrontmatterType(item);
50-
if (errors.length > 0 || frontmatterErrors.length > 0)
51-
return [
52-
...acc,
53-
{ name: item.name, errors: [...errors, ...frontmatterErrors] },
54-
];
55-
else return acc;
49+
if (frontmatterErrors.length > 0)
50+
return [...acc, { name: item.name, errors: frontmatterErrors }];
51+
52+
const validationErrors = validateItem(item);
53+
if (validationErrors.length > 0)
54+
return [...acc, { name: item.name, errors: validationErrors }];
55+
56+
return acc;
5657
}, [] as { name: string; errors: string[] }[]);
5758
if (invalidItemMessages.length > 0) {
5859
console.error("Validation error:");

0 commit comments

Comments
 (0)