mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
33 lines
794 B
JavaScript
33 lines
794 B
JavaScript
const octicons = require('octicons')
|
|
const fs = require('fs')
|
|
|
|
const pathToIconsFolder = `${__dirname}/src/assets/icons/octicons`
|
|
|
|
function generateIconSVGFiles() {
|
|
Object.values(octicons).forEach(icon => {
|
|
fs.writeFile(
|
|
`${pathToIconsFolder}/${icon.symbol}.svg`,
|
|
icon.toSVG({ xmlns: 'http://www.w3.org/2000/svg' }),
|
|
err => {
|
|
if (err) throw err
|
|
}
|
|
)
|
|
})
|
|
}
|
|
|
|
fs.exists(pathToIconsFolder, exists => {
|
|
if (exists) {
|
|
fs.lstat(pathToIconsFolder, (err, stats) => {
|
|
if (err) throw err
|
|
if (!stats.isDirectory()) {
|
|
throw new Error(`${pathToIconsFolder} is not a folder!`)
|
|
}
|
|
generateIconSVGFiles()
|
|
})
|
|
} else {
|
|
fs.mkdir(pathToIconsFolder, err => {
|
|
if (err) throw err
|
|
generateIconSVGFiles()
|
|
})
|
|
}
|
|
})
|