mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-05 21:47:55 +08:00
14 lines
446 B
JavaScript
Executable File
14 lines
446 B
JavaScript
Executable File
import { promises as fs } from 'node:fs'
|
|
|
|
export default async function (plop) {
|
|
plop.setWelcomeMessage('请选择需要创建的模式:')
|
|
const items = await fs.readdir('./plop-templates')
|
|
for (const item of items) {
|
|
const stat = await fs.lstat(`./plop-templates/${item}`)
|
|
if (stat.isDirectory()) {
|
|
const prompt = await import(`./plop-templates/${item}/prompt.js`)
|
|
plop.setGenerator(item, prompt.default)
|
|
}
|
|
}
|
|
}
|