1 Star 0 Fork 47

摔倒的红烧肉 / tiny-vue

forked from OpenTiny / tiny-vue 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
count-api.js 879 Bytes
一键复制 编辑 原始数据 按行查看 历史
const fs = require('fs');
const basePath = './examples/sites/demos/pc/app';
const readFile = function (path) {
let componentCount = 0;
let apiCount = 0;
const readDir = fs.readdirSync(path);
readDir.forEach(i => {
const curDir = `${path}/${i}`;
const stat = fs.statSync(curDir);
if (stat.isFile() && i.endsWith('.js')) {
componentCount += 1;
const data = fs.readFileSync(curDir, 'utf-8');
let dataJson = null;
try {
dataJson = JSON.parse(data);
} catch (err) {
console.log('err:', err);
}
if (dataJson !== null) {
apiCount += (dataJson.attrs?.length || 0) + (dataJson.slots?.length || 0) + (dataJson.events?.length || 0) + (dataJson.methods?.length || 0);
}
}
});
console.log('componentCount:', componentCount);
console.log('apiCount:', apiCount);
}
readFile(basePath);
1
https://gitee.com/QQ927919732/tiny-vue.git
git@gitee.com:QQ927919732/tiny-vue.git
QQ927919732
tiny-vue
tiny-vue
dev

搜索帮助