mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-02 03:57:37 +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)
|
|
}
|
|
}
|
|
}
|