Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak check-icons.js #1660

Merged
merged 4 commits into from
Mar 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions build/check-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,37 @@ const jsonIconList = Object.keys(fontJson)
console.time(timeLabel)

const files = await fs.readdir(iconsDir)
const svgIconList = files.map(file => file.slice(0, -4))
const svgIconList = files.map(file => path.basename(file, path.extname(file)))

const onlyInJson = jsonIconList.filter(icon => !svgIconList.includes(icon))
const onlyInSvg = svgIconList.filter(icon => !jsonIconList.includes(icon))

if (onlyInJson.length !== 0 || onlyInSvg !== 0) {
if (onlyInJson.length > 0) {
console.error(picocolors.red('Found additional icons in JSON:'))
if (onlyInJson.length === 0 || onlyInSvg === 0) {
console.log(picocolors.green('Success, found no differences!'))
console.timeEnd(timeLabel)

for (const icon of onlyInJson) {
console.log(` - ${picocolors.red(icon)}`)
}
return
}

if (onlyInJson.length > 0) {
console.error(picocolors.red('Found additional icons in JSON:'))

process.exit(1)
for (const icon of onlyInJson) {
console.log(` - ${picocolors.red(icon)}`)
}

if (onlyInSvg.length > 0) {
console.error(picocolors.red('Found additional icons in SVG files:'))
process.exit(1)
}

for (const icon of onlyInSvg) {
console.log(` - ${picocolors.red(icon)}`)
}
if (onlyInSvg.length > 0) {
console.error(picocolors.red('Found additional icons in SVG files:'))

process.exit(1)
for (const icon of onlyInSvg) {
console.log(` - ${picocolors.red(icon)}`)
}
}

console.log(picocolors.green('Success, found no differences!'))
console.timeEnd(timeLabel)
process.exit(1)
}
} catch (error) {
console.error(error)
process.exit(1)
Expand Down