Update validate.js

This commit is contained in:
Aleksandr Statciuk 2022-02-21 14:07:37 +03:00
parent 9341dc78b7
commit 282cb42185

View file

@ -34,20 +34,24 @@ async function main() {
process.exit(1) process.exit(1)
} }
const data = await csv.fromString(csvString).catch(err => {
logger.error(chalk.red(`\n${err.message} (${filepath})`))
process.exit(1)
})
const filename = file.getFilename(filepath) const filename = file.getFilename(filepath)
if (!schemes[filename]) { if (!schemes[filename]) {
logger.error(chalk.red(`\nError: "${filename}" scheme is missing`)) logger.error(chalk.red(`\nError: "${filename}" scheme is missing`))
process.exit(1) process.exit(1)
} }
const data = await csv.fromString(csvString).catch(err => {
logger.error(chalk.red(`\n${err.message} (${filepath})`))
process.exit(1)
})
let fileErrors = [] let fileErrors = []
if (filename === 'channels') { if (filename === 'channels') {
if (/\"/.test(csvString)) {
logger.error(chalk.red(`\nError: \" character is not allowed (${filepath})`))
process.exit(1)
}
fileErrors = fileErrors.concat(findDuplicatesById(data)) fileErrors = fileErrors.concat(findDuplicatesById(data))
} }