2023-06-12 00:24:39 +08:00

45 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: weisheng
* @Date: 2023-06-10 23:33:04
* @LastEditTime: 2023-06-10 23:42:45
* @LastEditors: weisheng
* @Description:
* @FilePath: \wot-design-uni\build\test.js
* 记得注释
*/
const fs = require('fs')
const path = require('path')
// 文件夹父目录
const src = path.resolve(__dirname, '../src/uni_modules/wot-design-uni/components')
const make = (local) => {
fs.readdir(local, function (err, files) {
if (err === null) {
files.forEach(function (filename) {
const url = path.resolve(local, filename + '/' + filename + '.vue')
// 检查创建路径是否存在
if (!fs.existsSync(url)) {
// vue模板代码
const vueTemplate = `<template>
</template>
<script>
</script>
<style lang="scss" scoped>
</style>`
// 创建vue组件
fs.writeFile(`${url}`, vueTemplate, (err) => {
if (err) throw err
})
} else {
console.error('warning文件夹已存在', url)
}
})
} else {
if (err) console.error(err)
}
})
}
make(src)