feat: add easy-slides CLI
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const directory = path.dirname(fileURLToPath(import.meta.url))
|
||||
const bundledTheme = path.resolve(directory, '..', 'theme')
|
||||
const workspaceTheme = path.resolve(directory, '..', '..', 'packages', 'slidev-theme-easy-jyy')
|
||||
|
||||
export function resolveTheme(theme?: string) {
|
||||
if (theme)
|
||||
return theme
|
||||
if (existsSync(path.join(bundledTheme, 'package.json')))
|
||||
return bundledTheme
|
||||
if (existsSync(path.join(workspaceTheme, 'package.json')))
|
||||
return workspaceTheme
|
||||
throw new Error('easy-slides 主题不存在;请重新安装或构建 @easy-slides/cli')
|
||||
}
|
||||
Reference in New Issue
Block a user