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

fix(mp): remove unused key (app.json)

上级 5386a4cd
......@@ -9,7 +9,8 @@ const {
const {
hasOwn,
parseStyle,
parseTabBar
parseTabBar,
NON_APP_JSON_KEYS
} = require('../util')
function defaultCopy (name, value, json) {
......@@ -38,6 +39,8 @@ function copyToJson (json, fromJson, options) {
})
}
const projectKeys = ['component2', 'enableAppxNg']
module.exports = function (pagesJson, manifestJson) {
const app = {
pages: [],
......@@ -72,9 +75,7 @@ module.exports = function (pagesJson, manifestJson) {
const platformJson = manifestJson['mp-alipay'] || {}
Object.keys(platformJson).forEach(key => {
if (
['usingComponents', 'optimization', 'uniStatistics', 'appid'].indexOf(key) === -1
) {
if (!projectKeys.includes(key) && !NON_APP_JSON_KEYS.includes(key)) {
// usingComponents 是编译模式开关,需要过滤,不能拷贝到 app
app[key] = platformJson[key]
}
......@@ -84,16 +85,12 @@ module.exports = function (pagesJson, manifestJson) {
updateAppJsonUsingComponents(app.usingComponents)
}
const project = Object.assign({}, manifestJson['mp-alipay'] || {})
delete project.usingComponents
delete project.plugins
delete project.useDynamicPlugins
if (!hasOwn(project, 'component2')) {
project.component2 = true
}
if (!hasOwn(project, 'enableAppxNg')) {
project.enableAppxNg = true
}
const project = Object.assign({
appid: platformJson.appid
})
project.component2 = hasOwn(platformJson, 'component2') ? platformJson.component2 : true
project.enableAppxNg = hasOwn(platformJson, 'enableAppxNg') ? platformJson.enableAppxNg : true
return [{
name: 'app',
......
......@@ -20,7 +20,8 @@ const {
const {
hasOwn,
parseStyle,
trimMPJson
trimMPJson,
NON_APP_JSON_KEYS
} = require('../util')
const uniI18n = require('@dcloudio/uni-cli-i18n')
......@@ -262,7 +263,7 @@ module.exports = function (pagesJson, manifestJson, project = {}) {
Object.keys(platformJson).forEach(key => {
if (
!projectKeys.includes(key) && ['usingComponents', 'optimization'].indexOf(key) === -1
!projectKeys.includes(key) && !NON_APP_JSON_KEYS.includes(key)
) {
// usingComponents 是编译模式开关,需要过滤,不能拷贝到 app
app[key] = platformJson[key]
......
......@@ -129,10 +129,19 @@ function parseTabBar (style = {}) {
return style
}
const NON_APP_JSON_KEYS = [
'appid',
'unipush',
'usingComponents',
'optimization',
'scopedSlotsCompiler',
'usingComponents',
'uniStatistics'
]
module.exports = {
hasOwn,
parseStyle,
parseTabBar,
trimMPJson
}
trimMPJson,
NON_APP_JSON_KEYS
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册