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

fix(mp): recursive merge platform options

上级 654c5949
const fs = require('fs')
const path = require('path')
const merge = require('merge')
const {
parsePages,
......@@ -30,6 +31,21 @@ function defaultCopy (name, value, json) {
json[name] = value
}
function isPlainObject (a) {
if (a === null) {
return false
}
return typeof a === 'object'
}
function deepCopy (name, value, json) {
if (isPlainObject(value) && isPlainObject(json[name])) {
json[name] = merge.recursive(true, json[name], value)
} else {
defaultCopy(name, value, json)
}
}
const pagesJson2AppJson = {
globalStyle: function (name, value, json) {
json.window = parseStyle(value)
......@@ -115,7 +131,7 @@ const manifestJson2ProjectJson = {
const platformJson2ProjectJson = {
appid: defaultCopy,
setting: defaultCopy,
setting: deepCopy,
miniprogramRoot: defaultCopy,
cloudfunctionRoot: defaultCopy,
qcloudRoot: defaultCopy,
......@@ -123,9 +139,9 @@ const platformJson2ProjectJson = {
compileType: defaultCopy,
libVersion: defaultCopy,
projectname: defaultCopy,
packOptions: defaultCopy,
debugOptions: defaultCopy,
scripts: defaultCopy,
packOptions: deepCopy,
debugOptions: deepCopy,
scripts: deepCopy,
cloudbaseRoot: defaultCopy
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册