提交 f3d3e2e4 编写于 作者: fxy060608's avatar fxy060608

fix(cli): component:true

上级 3b0af0d5
...@@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) { ...@@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) {
} }
function updateAppJson (name, jsonObj) { function updateAppJson (name, jsonObj) {
updateComponentJson(name, jsonObj) updateComponentJson(name, jsonObj, true, 'App')
} }
function updatePageJson (name, jsonObj) { function updatePageJson (name, jsonObj) {
pageSet.add(name) pageSet.add(name)
updateComponentJson(name, jsonObj) updateComponentJson(name, jsonObj, true, 'Page')
} }
function updateProjectJson (name, jsonObj) { function updateProjectJson (name, jsonObj) {
updateComponentJson(name, jsonObj, false) updateComponentJson(name, jsonObj, false, 'Project')
} }
const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq' const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-qq'
function updateComponentJson (name, jsonObj, usingComponents = true) { function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Component') {
if (type === 'Component') {
jsonObj.component = true
}
if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
}
}
const oldJsonStr = getJsonFile(name) const oldJsonStr = getJsonFile(name)
if (oldJsonStr) { // update if (oldJsonStr) { // update
if (usingComponents) { // merge usingComponents if (usingComponents) { // merge usingComponents
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册