Skip to content

Commit

Permalink
构建环境配置修改
Browse files Browse the repository at this point in the history
  • Loading branch information
amirliu committed Nov 23, 2021
1 parent a15dcd8 commit 845700a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .env.admin
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VUE_APP_isAdmin=true
VUE_APP_h5Preview=true
NODE_ENV=production
NODE_ENV=production
VUE_APP_theme=plans_PCUI
3 changes: 2 additions & 1 deletion .env.adminDev
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VUE_APP_isAdmin=true
VUE_APP_h5Preview=true
VUE_APP_h5Preview=true
VUE_APP_theme=plans_PCUI
2 changes: 1 addition & 1 deletion build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function init () {
name: 'theme',
message: '请选择构建主题',
choices: themes,
when: (answers) => answers.buildType !== 'cats-upload-admin',
// when: (answers) => answers.buildType !== 'cats-upload-admin',
default: 'false',
},
]
Expand Down
31 changes: 16 additions & 15 deletions build/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,33 @@ function queryThemes (params) {
async function init () {
const themes = await queryThemes()
const questions = [
{
type: 'list',
name: 'buildType',
message: '构建单个WP插件还是构建所有的WP插件',
choices: ['h5', 'wp-editor'],
default: 'h5',
},
{
type: 'list',
name: 'theme',
message: '请选择构建主题',
choices: themes,
default: 'false',
},
{
type: 'list',
name: 'h5Environment',
message: '请选择调试环境:',
choices: ['uat', 'pre', 'other'],
when: answers => answers.buildType === 'h5',
default: 'uat',
},
{
type: 'list',
name: 'h5URL',
message: '请选择WP地址:',
when: answers => answers.h5Environment !== 'other',
when: answers => answers.buildType === 'h5' && answers.h5Environment !== 'other',
choices: answers => answers.h5Environment === 'uat' ? uat : pre,
default: '',
},
Expand All @@ -47,20 +62,6 @@ async function init () {
when: answers => answers.h5Environment === 'other',
default: 'http://prewph5_9.cats-trade.com',
},
{
type: 'list',
name: 'buildType',
message: '构建单个WP插件还是构建所有的WP插件',
choices: ['h5', 'wp-editor'],
default: 'h5',
},
{
type: 'list',
name: 'theme',
message: '请选择构建主题',
choices: themes,
default: 'false',
},
]
inquirer.prompt(questions)
.then((answers) => {
Expand Down
4 changes: 2 additions & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ console.log(NODE_ENV, process.env.VUE_APP_isAdmin)
// console.log(process.env)
const { buildType = 'cats-upload-all', theme = 'plans', h5URL } = queryBuildConfig()
console.log(buildType, theme, h5URL)

process.env.VUE_APP_theme = theme
const alias = {
'vue$': 'vue/dist/vue.esm-bundler.js',
'@public': resolve('public'),
Expand Down Expand Up @@ -150,7 +150,7 @@ const config = {
}
},
'/cats-manage-api': {
target: h5URL, // prewph5公司id为2 prewph5_1公司id为60 'http://prewph5_9.cats-trade.com'
target: h5URL || 'http://prewph5_9.cats-trade.com', // prewph5公司id为2 prewph5_1公司id为60 'http://prewph5_9.cats-trade.com'
disableHostCheck: true,
onProxyReq: function (proxyReq, req, res, options) { // 由于vue中使用了body-parser 导致http中的body被序列化两次,从而使得配置代理后后端无法获取body中的数据
if (req.body) {
Expand Down

0 comments on commit 845700a

Please sign in to comment.