basic2/plopfile.js

14 lines
446 B
JavaScript
Raw Normal View History

2023-10-31 20:57:22 +08:00
import { promises as fs } from 'node:fs'
2023-10-31 20:57:22 +08:00
export default async function (plop) {
2022-09-25 23:32:45 +08:00
plop.setWelcomeMessage('请选择需要创建的模式:')
2023-10-31 20:57:22 +08:00
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)
}
}
2021-08-27 10:32:21 +08:00
}