mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Log error difference
This commit is contained in:
parent
7da61b11b5
commit
8643fd9e4c
1 changed files with 13 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { dirname } from 'path'
|
||||
import { dirname, basename } from 'path'
|
||||
|
||||
import fs from 'fs-extra'
|
||||
import dotenv from 'dotenv'
|
||||
|
|
@ -52,6 +52,12 @@ dotenv.config()
|
|||
let timeRunGetListArray = 0
|
||||
let timeRunGetListByCategories = 0
|
||||
|
||||
function getSymmetricDifference (a, b) {
|
||||
return [
|
||||
a.filter(x => !b.includes(x)),
|
||||
b.filter(x => !a.includes(x))
|
||||
]
|
||||
}
|
||||
|
||||
function normalizeVersion ( rawVersion ) {
|
||||
const containsNumbers = /\d+/.test( rawVersion )
|
||||
|
|
@ -508,6 +514,12 @@ class BuildLists {
|
|||
console.log( this.lists[listOptions.name].size, 'Entries' )
|
||||
|
||||
if ( fileCount !== this.lists[listOptions.name].size ) {
|
||||
const listSlugs = Array.from( this.lists[listOptions.name] ).map( listEntry => listEntry.slug )
|
||||
const fileNames = fs.readdirSync( apiListDirectory ).map( fileName => basename(fileName).split('.')[0] )
|
||||
const difference = getSymmetricDifference( listSlugs, fileNames )
|
||||
|
||||
console.log( 'List difference', difference )
|
||||
|
||||
throw new Error( `Files (${ fileCount }) don\'t match list count in ${ apiListDirectory }(${ this.lists[listOptions.name].size }).` )
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue