File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,15 @@ export const publish = async (argv: string[]) => {
45
45
46
46
// Validate
47
47
const invalidItemMessages = targetItems . reduce ( ( acc , item ) => {
48
- const errors = validateItem ( item ) ;
49
48
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 ;
56
57
} , [ ] as { name : string ; errors : string [ ] } [ ] ) ;
57
58
if ( invalidItemMessages . length > 0 ) {
58
59
console . error ( "Validation error:" ) ;
You can’t perform that action at this time.
0 commit comments