banboshi_V1/halftoneproject-master/HalftoneWeb/scripts/shared/base.cjs

42 lines
677 B
JavaScript
Raw Normal View History

2023-10-31 13:19:29 +08:00
/**
* 获取扩展名
* @param {string} type 模块类型
* @param {boolean} isMarkdown 是否是 markdown默认为 false
* @returns {string} 扩展名
*/
const showExt = (type, isMarkdown = false) => {
const isTs = type === 'api' || type === 'store' || type === 'module'
const ext = isMarkdown ? 'md' : isTs ? 'ts' : 'vue'
return ext
}
/**
* 模块类型
*/
const moduleTypes = [
'api',
'page',
'store',
'layout',
'module',
'component',
'composable',
]
/**
* 获取目录
* @param {string} type 类型
*/
const showDir = (type) => {
if (type === 'api') {
return 'api'
}
return `${type}s`
}
module.exports = {
showExt,
showDir,
moduleTypes,
}