basic2/plopfile.js

14 lines
446 B
JavaScript
Raw Permalink Normal View History

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