HuLa/build/config/version.ts
nongyehong e17cb7c24a feat(style): 新增项目版本信息打印
移除主题切换时的Transitions效果
2024-04-29 21:20:01 +08:00

43 lines
1002 B
TypeScript

import pkg from '../../package.json'
/** npm依赖包版本信息 */
export interface PkgVersionInfo {
name: string
version: string
}
interface Package {
name: string
version: string
author: Record<string, string>
dependencies: Record<string, string>
devDependencies: Record<string, string>
[key: string]: any
}
interface PkgJson {
name: string
version: string
author: Record<string, string>
dependencies: PkgVersionInfo[]
devDependencies: PkgVersionInfo[]
}
const pkgWithType = pkg as Package
const transformVersionData = (tuple: [string, string]): PkgVersionInfo => {
const [name, version] = tuple
return {
name,
version
}
}
export const pkgJson: PkgJson = {
name: pkgWithType.name,
version: pkgWithType.version,
author: pkgWithType.author,
dependencies: Object.entries(pkgWithType.dependencies).map((item) => transformVersionData(item)),
devDependencies: Object.entries(pkgWithType.devDependencies).map((item) => transformVersionData(item))
}