@dcloudio/uni-cli-shared
Advanced tools
Comparing version 0.2.930 to 0.2.931
@@ -11,2 +11,4 @@ /** | ||
let globalUsingComponents = Object.create(null) | ||
function updateJsonFile (name, jsonStr) { | ||
@@ -49,3 +51,9 @@ changedJsonFileSet.add(name) | ||
if (usingComponents) { // merge usingComponents | ||
jsonObj.usingComponents = JSON.parse(oldJsonStr).usingComponents || {} | ||
if (process.env.UNI_PLATFORM !== 'mp-weixin') { // 简单处理其他平台全局组件,直接合并到独立 json 中 | ||
jsonObj.usingComponents = Object.assign({}, | ||
globalUsingComponents, | ||
JSON.parse(oldJsonStr).usingComponents || {}) | ||
} else { | ||
jsonObj.usingComponents = JSON.parse(oldJsonStr).usingComponents || {} | ||
} | ||
} | ||
@@ -57,2 +65,7 @@ const newJsonStr = JSON.stringify(jsonObj, null, 2) | ||
} else { // add | ||
if (process.env.UNI_PLATFORM !== 'mp-weixin') { // 简单处理其他平台全局组件,直接合并到独立 json 中 | ||
if (usingComponents) { | ||
jsonObj.usingComponents = Object.assign({}, globalUsingComponents, jsonObj.usingComponents || {}) | ||
} | ||
} | ||
updateJsonFile(name, jsonObj) | ||
@@ -62,3 +75,2 @@ } | ||
// TODO 需要合并开发者自己在 pages.json 中引用的 components | ||
function updateUsingComponents (name, usingComponents, type) { | ||
@@ -68,2 +80,10 @@ if (type === 'Component') { | ||
} | ||
if (type === 'App') { // 记录全局组件 | ||
globalUsingComponents = usingComponents | ||
} | ||
if (process.env.UNI_PLATFORM !== 'mp-weixin') { // 简单处理其他平台全局组件,直接合并到独立 json 中 | ||
usingComponents = Object.assign({}, globalUsingComponents, usingComponents) | ||
} | ||
const oldJsonStr = getJsonFile(name) | ||
@@ -70,0 +90,0 @@ if (oldJsonStr) { // update |
{ | ||
"name": "@dcloudio/uni-cli-shared", | ||
"version": "0.2.930", | ||
"version": "0.2.931", | ||
"description": "uni-cli-shared", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34696
793