Skip to content

Commit

Permalink
fix(cli): component:true
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Oct 14, 2019
1 parent 3b0af0d commit f3d3e2e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/uni-cli-shared/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,30 @@ function getChangedJsonFileMap (clear = true) {
}

function updateAppJson (name, jsonObj) {
updateComponentJson(name, jsonObj)
updateComponentJson(name, jsonObj, true, 'App')
}

function updatePageJson (name, jsonObj) {
pageSet.add(name)
updateComponentJson(name, jsonObj)
updateComponentJson(name, jsonObj, true, 'Page')
}

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'

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)
if (oldJsonStr) { // update
if (usingComponents) { // merge usingComponents
Expand Down

0 comments on commit f3d3e2e

Please sign in to comment.