mirror of
https://gitee.com/veigarchen/iconfont-download.git
synced 2025-10-13 21:30:31 +00:00
更新总文件
This commit is contained in:
@@ -1,11 +1,10 @@
|
|||||||
import { resolve, join } from 'path'
|
import { resolve, join } from 'path'
|
||||||
import FileUtil from './src/utils/FileUtil'
|
import FileUtil from './src/utils/FileUtil'
|
||||||
|
|
||||||
const siconUrl = resolve('E:/repo/test/ssly-admin/admin/public/static_res')
|
const siconUrl = resolve('E:/Desktop/ts')
|
||||||
const staticIconUrl = resolve('E:/repo/test/ssly-admin/admin/public/static_res/sicon')
|
const staticIconUrl = resolve('E:/Desktop/sicon')
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
await FileUtil.deleteFileOrDirectory(staticIconUrl)
|
|
||||||
await FileUtil.readDirectory(siconUrl, async (filepath: string) => {
|
await FileUtil.readDirectory(siconUrl, async (filepath: string) => {
|
||||||
if (filepath.endsWith('.ts')) {
|
if (filepath.endsWith('.ts')) {
|
||||||
const filename =
|
const filename =
|
||||||
@@ -20,16 +19,19 @@ const init = async () => {
|
|||||||
const ctx = JSON.parse(fstr.replaceAll("'", '"'))
|
const ctx = JSON.parse(fstr.replaceAll("'", '"'))
|
||||||
|
|
||||||
const keys = [] as any[]
|
const keys = [] as any[]
|
||||||
|
const allObj = {} as any
|
||||||
Object.keys(ctx).forEach((key) => {
|
Object.keys(ctx).forEach((key) => {
|
||||||
let _res = JSON.stringify(ctx[key])
|
let _res = JSON.stringify(ctx[key])
|
||||||
if (typeof ctx[key] === 'string') {
|
if (typeof ctx[key] === 'string') {
|
||||||
_res = _res.substring(1, _res.length - 1)
|
_res = _res.substring(1, _res.length - 1)
|
||||||
}
|
}
|
||||||
key = key.replaceAll(':','-')
|
key = key.replaceAll(':', '-')
|
||||||
keys.push(key)
|
keys.push(key)
|
||||||
|
allObj[key] = ctx[key]
|
||||||
FileUtil.writeFile(join(staticIconUrl, `./${filename}/${key}.json`), _res)
|
FileUtil.writeFile(join(staticIconUrl, `./${filename}/${key}.json`), _res)
|
||||||
})
|
})
|
||||||
FileUtil.writeFile(join(staticIconUrl, `./${filename}/_keys.json`), JSON.stringify(keys))
|
FileUtil.writeFile(join(staticIconUrl, `./${filename}/_keys.json`), JSON.stringify(keys))
|
||||||
|
FileUtil.writeFile(join(staticIconUrl, `./${filename}/_all.json`), JSON.stringify(allObj))
|
||||||
} catch {
|
} catch {
|
||||||
console.log('处理失败', filename)
|
console.log('处理失败', filename)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user