feat: 使用prettierrc对代码进行格式化

This commit is contained in:
piexlMax(奇淼
2024-11-09 10:32:26 +08:00
parent 87a4ce17e1
commit 7d9af64f6d
139 changed files with 12677 additions and 12656 deletions
+37 -15
View File
@@ -1,30 +1,52 @@
/**
* 网站配置文件
*/
const greenText = (text) => `\x1b[32m${text}\x1b[0m`;
const greenText = (text) => `\x1b[32m${text}\x1b[0m`
const config = {
appName: 'Gin-Vue-Admin',
appLogo: 'logo.png',
showViteLogo: true,
logs: [],
logs: []
}
export const viteLogo = (env) => {
if (config.showViteLogo) {
console.log(greenText(`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`));
console.log(greenText(`> 当前版本:v2.7.7`));
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`));
console.log(greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`));
console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`));
console.log(greenText(`> GVA讨论社区:https://support.qq.com/products/371961`));
console.log(greenText(`> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html`));
console.log(greenText(`> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}`));
console.log(greenText(`--------------------------------------版权声明--------------------------------------`));
console.log(greenText(`** 版权所有方:flipped-aurora开源团队 **`));
console.log(greenText(`** 版权持有公司:北京翻转极光科技有限责任公司 **`));
console.log(greenText(`** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **`));
console.log('\n');
console.log(
greenText(
`> 欢迎使用Gin-Vue-Admin,开源地址:https://github.com/flipped-aurora/gin-vue-admin`
)
)
console.log(greenText(`> 当前版本:v2.7.7`))
console.log(greenText(`> 加群方式:微信:shouzi_1994 QQ群:470239250`))
console.log(
greenText(`> 项目地址:https://github.com/flipped-aurora/gin-vue-admin`)
)
console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`))
console.log(
greenText(`> GVA讨论社区:https://support.qq.com/products/371961`)
)
console.log(
greenText(
`> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html`
)
)
console.log(
greenText(`> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}`)
)
console.log(
greenText(
`--------------------------------------版权声明--------------------------------------`
)
)
console.log(greenText(`** 版权所有方:flipped-aurora开源团队 **`))
console.log(greenText(`** 版权持有公司:北京翻转极光科技有限责任公司 **`))
console.log(
greenText(
`** 剔除授权标识需购买商用授权:https://gin-vue-admin.com/empower/index.html **`
)
)
console.log('\n')
}
}
+17 -11
View File
@@ -10,21 +10,26 @@ const createIconComponent = (name) => ({
name: 'SvgIcon',
render() {
return h(svgIcon, {
name: name,
name: name
})
},
}
})
const registerIcons = async(app) => {
const registerIcons = async (app) => {
const iconModules = import.meta.glob('@/assets/icons/**/*.svg') // 系统目录 svg 图标
const pluginIconModules = import.meta.glob('@/plugin/**/assets/icons/**/*.svg') // 插件目录 svg 图标
const mergedIconModules = Object.assign({}, iconModules, pluginIconModules); // 合并所有 svg 图标
const pluginIconModules = import.meta.glob(
'@/plugin/**/assets/icons/**/*.svg'
) // 插件目录 svg 图标
const mergedIconModules = Object.assign({}, iconModules, pluginIconModules) // 合并所有 svg 图标
for (const path in mergedIconModules) {
let pluginName = ""
if (path.startsWith("/src/plugin/")) {
let pluginName = ''
if (path.startsWith('/src/plugin/')) {
pluginName = `${path.split('/')[3]}-`
}
const iconName = path.split('/').pop().replace(/\.svg$/, '')
const iconName = path
.split('/')
.pop()
.replace(/\.svg$/, '')
// 如果iconName带空格则不加入到图标库中并且提示名称不合法
if (iconName.indexOf(' ') !== -1) {
console.error(`icon ${iconName}.svg includes whitespace in ${path}`)
@@ -32,11 +37,12 @@ const registerIcons = async(app) => {
}
const key = `${pluginName}${iconName}`
// 开发模式下列出所有 svg 图标,方便开发者直接查找复制使用
import.meta.env.MODE == 'development' && console.log(`svg-icon-component: <${key} />`)
import.meta.env.MODE == 'development' &&
console.log(`svg-icon-component: <${key} />`)
const iconComponent = createIconComponent(key)
config.logs.push({
'key': key,
'label': key,
key: key,
label: key
})
app.component(key, iconComponent)
}