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

feat(mp-alipay): custom mini.project.json (#3929)

上级 29b404ee
const path = require('path') const path = require('path')
const { parseJson } = require('@dcloudio/uni-cli-shared/lib/json') const {
parseJson
} = require('@dcloudio/uni-cli-shared/lib/json')
module.exports = { module.exports = {
options: { options: {
...@@ -17,7 +19,8 @@ module.exports = { ...@@ -17,7 +19,8 @@ module.exports = {
filter: '.sjs' filter: '.sjs'
}, },
filterTag: 'sjs', filterTag: 'sjs',
subPackages: true subPackages: true,
project: 'mini.project.json'
}, },
copyWebpackOptions (platformOptions, vueOptions) { copyWebpackOptions (platformOptions, vueOptions) {
const copyOptions = ['mycomponents', 'customize-tab-bar', 'ext.json'] const copyOptions = ['mycomponents', 'customize-tab-bar', 'ext.json']
...@@ -35,4 +38,4 @@ module.exports = { ...@@ -35,4 +38,4 @@ module.exports = {
return copyOptions return copyOptions
} }
} }
const fs = require('fs')
const path = require('path')
const { const {
parsePages parsePages,
getPlatformProject
} = require('@dcloudio/uni-cli-shared') } = require('@dcloudio/uni-cli-shared')
const { const {
...@@ -84,13 +88,21 @@ module.exports = function (pagesJson, manifestJson) { ...@@ -84,13 +88,21 @@ module.exports = function (pagesJson, manifestJson) {
if (app.usingComponents) { if (app.usingComponents) {
updateAppJsonUsingComponents(app.usingComponents) updateAppJsonUsingComponents(app.usingComponents)
} }
const projectName = getPlatformProject()
const project = Object.assign({ let project = {}
appid: platformJson.appid
})
project.component2 = hasOwn(platformJson, 'component2') ? platformJson.component2 : true const projectPath = path.resolve(process.env.UNI_INPUT_DIR, projectName)
project.enableAppxNg = hasOwn(platformJson, 'enableAppxNg') ? platformJson.enableAppxNg : true if (fs.existsSync(projectPath)) {
project = require(projectPath)
} else {
if (platformJson.appid) {
project.appid = platformJson.appid
}
project.component2 = hasOwn(platformJson, 'component2') ? platformJson.component2 : true
project.enableAppxNg = hasOwn(platformJson, 'enableAppxNg') ? platformJson.enableAppxNg : true
}
return [{ return [{
name: 'app', name: 'app',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册