press-ui
Version:
简单、易用的跨端组件库,兼容 Vue2 和 Vue3,同时支持 uni-app和普通 Vue 项目
35 lines (26 loc) • 791 B
JavaScript
const {
hyphenate,
getComponentPath,
} = require('./generate-entry');
const { PATH_MAP, saveJsonToFile } = require('./helper');
function getBuildConfigJson(componentConfig) {
const res = {};
Object.keys(componentConfig)
.forEach((key) => {
const value = componentConfig[key];
const { list } = value;
list.forEach((item) => {
const hyphenatedName = hyphenate(item.name);
const compPath = getComponentPath(hyphenatedName);
res[hyphenatedName] = `./src/packages/press-${hyphenatedName}/press-${compPath}.vue`;
});
});
return res;
}
function writeBuildConfig(componentConfig) {
const json = getBuildConfigJson(componentConfig);
saveJsonToFile(PATH_MAP.BUILD_CONFIG, json);
}
module.exports = {
writeBuildConfig,
};