1
0
mirror of https://github.com/coreui/coreui-icons.git synced 2025-08-12 03:33:59 +02:00

refactor: add prefixes to svg filenames, change flag casing

This commit is contained in:
woothu
2019-11-15 09:34:37 +01:00
parent 7d8068c4ee
commit 9c925524fa
1529 changed files with 50 additions and 19 deletions

View File

@@ -40,24 +40,19 @@ dirnames.forEach(setName => {
contents[variableName] = iconData
// variableName = validate(variableName)
// jsFilename = validate(jsFilename)
importName = validate(variableName)
names.push({
jsFilename,
variableName,
importName
variableName
})
fs.writeFile(
`js/${setName}/${jsFilename}`,
`export const ${importName} = ` + JSON.stringify(iconData),
`export const ${variableName} = ` + JSON.stringify(iconData),
() => ''
)
fs.writeFile(
`js/${setName}/${tsFilename}`,
`export declare const ${importName}: string[];`,
`export declare const ${variableName}: string[];`,
() => ''
)
})
@@ -132,35 +127,35 @@ function toCamel (str) {
})
}
function validate(str) {
if (!isNaN(str.charAt(0))) {
return 'n' + str
} else {
return str
}
}
// function validate(str) {
// if (!isNaN(str.charAt(0))) {
// return 'n' + str
// } else {
// return str
// }
// }
function getImports(names, setName, deep = false) {
const folder = deep ? `/${setName}/` : '/'
const defaultImport = `import { ${setName}Set } from '.${folder}${setName}-set.js' \n`
const defaultExport = `export { ${setName}Set } \n\n`
const importString = names.map(name => {
return `import { ${name.importName} } from '.${folder}${name.jsFilename}'`
return `import { ${name.variableName} } from '.${folder}${name.jsFilename}'`
}).join('\n')
const exportString = names.map(name => {
return `export { ${name.importName} }`
return `export { ${name.variableName} }`
}).join('\n')
return defaultImport + defaultExport + importString + '\n' + exportString
}
function typings (names, setName, all = true) {
const icons = names.map(name => {
return ` "${name.importName}": string[];`
return ` "${name.variableName}": string[];`
}).join('\n')
const set = `export declare const ${setName}Set: {\n${icons}\n}`
const exportString = names.map(name => {
return `export declare const ${name.importName}: string[];`
return `export declare const ${name.variableName}: string[];`
}).join('\n')
return all ? set + '\n' + exportString : set

36
build/change-names.js Normal file
View File

@@ -0,0 +1,36 @@
const fs = require('fs')
const dirnames = process.mainModule.filename.includes('pro') ?
['solid', 'linear'] :
['flag']
// ['free']
const prefixes = {
brand: 'cib-',
flag: 'cif-',
free: 'cil-',
linear: 'cil-',
solid: 'cis-'
}
console.log(dirnames)
dirnames.forEach(name => {
const dirname = `svg/${name}/`
fs.readdir(dirname, (e, filenames) => {
if (e) {
return
}
filenames.forEach(filename => {
fs.readFile(dirname + filename, 'utf-8', function (e, content) {
if (e) {
return
}
fs.writeFile(
`svg/${name}/${prefixes[name]}${filename.toLowerCase()}`,
content,
() => fs.unlink(`svg/${name}/${filename}`, () => '')
)
})
})
})
})

0
svg/brand/500px-5.svg → svg/brand/cib-500px-5.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
svg/brand/500px.svg → svg/brand/cib-500px.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

0
svg/brand/about-me.svg → svg/brand/cib-about-me.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

0
svg/brand/abstract.svg → svg/brand/cib-abstract.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

0
svg/brand/acm.svg → svg/brand/cib-acm.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

0
svg/brand/addthis.svg → svg/brand/cib-addthis.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

0
svg/brand/adguard.svg → svg/brand/cib-adguard.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 697 B

After

Width:  |  Height:  |  Size: 697 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 1001 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 948 B

After

Width:  |  Height:  |  Size: 948 B

View File

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 811 B

View File

Before

Width:  |  Height:  |  Size: 748 B

After

Width:  |  Height:  |  Size: 748 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 908 B

View File

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 918 B

0
svg/brand/adobe-xd.svg → svg/brand/cib-adobe-xd.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
svg/brand/adobe.svg → svg/brand/cib-adobe.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

0
svg/brand/airbnb.svg → svg/brand/cib-airbnb.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
svg/brand/algolia.svg → svg/brand/cib-algolia.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
svg/brand/alipay.svg → svg/brand/cib-alipay.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 826 B

0
svg/brand/allocine.svg → svg/brand/cib-allocine.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 902 B

After

Width:  |  Height:  |  Size: 902 B

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

0
svg/brand/amazon.svg → svg/brand/cib-amazon.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

0
svg/brand/amd.svg → svg/brand/cib-amd.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

0
svg/brand/anaconda.svg → svg/brand/cib-anaconda.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

0
svg/brand/analogue.svg → svg/brand/cib-analogue.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 387 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
svg/brand/android.svg → svg/brand/cib-android.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 837 B

After

Width:  |  Height:  |  Size: 837 B

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 789 B

0
svg/brand/angular.svg → svg/brand/cib-angular.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 343 B

0
svg/brand/ansible.svg → svg/brand/cib-ansible.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 540 B

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
svg/brand/apache.svg → svg/brand/cib-apache.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 961 B

After

Width:  |  Height:  |  Size: 961 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

0
svg/brand/apple.svg → svg/brand/cib-apple.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
svg/brand/appveyor.svg → svg/brand/cib-appveyor.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

0
svg/brand/aral.svg → svg/brand/cib-aral.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 928 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
svg/brand/arduino.svg → svg/brand/cib-arduino.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

0
svg/brand/arxiv.svg → svg/brand/cib-arxiv.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
svg/brand/asana.svg → svg/brand/cib-asana.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 552 B

0
svg/brand/at-and-t.svg → svg/brand/cib-at-and-t.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 617 B

0
svg/brand/atom.svg → svg/brand/cib-atom.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
svg/brand/audible.svg → svg/brand/cib-audible.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 728 B

0
svg/brand/aurelia.svg → svg/brand/cib-aurelia.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
svg/brand/auth0.svg → svg/brand/cib-auth0.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 397 B

View File

Before

Width:  |  Height:  |  Size: 887 B

After

Width:  |  Height:  |  Size: 887 B

0
svg/brand/autotask.svg → svg/brand/cib-autotask.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

0
svg/brand/aventrix.svg → svg/brand/cib-aventrix.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 904 B

View File

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 890 B

View File

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 321 B

View File

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 569 B

0
svg/brand/babel.svg → svg/brand/cib-babel.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
svg/brand/baidu.svg → svg/brand/cib-baidu.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

0
svg/brand/bamboo.svg → svg/brand/cib-bamboo.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

0
svg/brand/bandcamp.svg → svg/brand/cib-bandcamp.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 180 B

0
svg/brand/basecamp.svg → svg/brand/cib-basecamp.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 544 B

0
svg/brand/bathasu.svg → svg/brand/cib-bathasu.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
svg/brand/behance.svg → svg/brand/cib-behance.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 388 B

0
svg/brand/bing.svg → svg/brand/cib-bing.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

0
svg/brand/bit.svg → svg/brand/cib-bit.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

0
svg/brand/bitcoin.svg → svg/brand/cib-bitcoin.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 635 B

0
svg/brand/bitly.svg → svg/brand/cib-bitly.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 884 B

0
svg/brand/blender.svg → svg/brand/cib-blender.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
svg/brand/blogger.svg → svg/brand/cib-blogger.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 794 B

After

Width:  |  Height:  |  Size: 794 B

View File

Before

Width:  |  Height:  |  Size: 369 B

After

Width:  |  Height:  |  Size: 369 B

View File

Before

Width:  |  Height:  |  Size: 518 B

After

Width:  |  Height:  |  Size: 518 B

0
svg/brand/boeing.svg → svg/brand/cib-boeing.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

0
svg/brand/boost.svg → svg/brand/cib-boost.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 610 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

0
svg/brand/bower.svg → svg/brand/cib-bower.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
svg/brand/brand-ai.svg → svg/brand/cib-brand-ai.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 962 B

After

Width:  |  Height:  |  Size: 962 B

0
svg/brand/brave.svg → svg/brand/cib-brave.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

0
svg/brand/btc.svg → svg/brand/cib-btc.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

0
svg/brand/buddy.svg → svg/brand/cib-buddy.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 503 B

0
svg/brand/buffer.svg → svg/brand/cib-buffer.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 849 B

After

Width:  |  Height:  |  Size: 849 B

Some files were not shown because too many files have changed in this diff Show More