mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Throw when file count is off
This commit is contained in:
parent
d0f28ec2d9
commit
9b28ae14fb
1 changed files with 14 additions and 2 deletions
|
|
@ -241,7 +241,10 @@ class BuildLists {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
saveApiEndpoints = async function ( listOptions ) {
|
saveApiEndpoints = async ( listOptions ) => {
|
||||||
|
|
||||||
|
const apiDirectory = './static/api'
|
||||||
|
const apiListDirectory = `${ apiDirectory }/${ listOptions.endpointPrefix }`
|
||||||
|
|
||||||
const poolSize = 1000
|
const poolSize = 1000
|
||||||
|
|
||||||
|
|
@ -265,7 +268,7 @@ class BuildLists {
|
||||||
|
|
||||||
} = listEntry
|
} = listEntry
|
||||||
|
|
||||||
const endpointPath = `./static/api${endpoint}.json`
|
const endpointPath = `${ apiDirectory }${ endpoint }.json`
|
||||||
const endpointDirectory = dirname(endpointPath)
|
const endpointDirectory = dirname(endpointPath)
|
||||||
|
|
||||||
// Add related videos
|
// Add related videos
|
||||||
|
|
@ -297,6 +300,15 @@ class BuildLists {
|
||||||
throw new Error( errors )
|
throw new Error( errors )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Count saved files
|
||||||
|
const fileCount = fs.readdirSync( apiListDirectory ).length
|
||||||
|
|
||||||
|
console.log( fileCount, 'Files saved in', apiListDirectory )
|
||||||
|
console.log( this.lists[listOptions.name].size, 'Entries' )
|
||||||
|
|
||||||
|
if ( fileCount !== this.lists[listOptions.name].size ) {
|
||||||
|
throw new Error( `Files don\'t match list count in ${ apiListDirectory }` )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save app lists to JSON
|
// Save app lists to JSON
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue