- 添加 jenkins 构建环境配置,

This commit is contained in:
sin
2019-03-10 16:40:16 +08:00
parent 6d93e6cec8
commit 45874e36d3
6 changed files with 75 additions and 20 deletions

View File

@@ -0,0 +1,31 @@
// development 和 production
import path from 'path';
import proxyDev from './proxy.dev';
import proxyProd from './proxy.prod';
function basePathBuilder(proxys, basePath) {
for (const key in proxys) {
const proxy = proxys[key];
const pathRewrite = proxy.pathRewrite;
const newPathRewrite = {};
for (const key2 in pathRewrite) {
const item = pathRewrite[key2];
newPathRewrite[key2] = path.join(basePath, item);
}
proxy.pathRewrite = newPathRewrite;
}
return proxys;
}
export default function(NODE_ENV, basePath) {
console.log('development', NODE_ENV === 'development');
console.log('undefined', NODE_ENV === 'undefined');
console.log(NODE_ENV);
let proxys = NODE_ENV === 'development' || NODE_ENV === 'undefined' ? proxyDev : proxyProd;
if (basePath) {
proxys = basePathBuilder(proxys, basePath);
}
console.log('proxys------>', proxys);
return proxys;
}

View File

@@ -0,0 +1,14 @@
// 开发环境,的代理配置
export default {
'/admin-api/': {
target: 'http://180.167.213.26:18083/',
changeOrigin: true,
pathRewrite: {},
},
'/server/api/': {
target: 'https://preview.pro.ant.design/',
changeOrigin: true,
pathRewrite: { '^/server': '' },
},
};

View File

@@ -0,0 +1,16 @@
// production 配置文件
export default {
'/admin-api/': {
target: 'http://180.167.213.26:18083/',
changeOrigin: true,
pathRewrite: {
'^/admin-api': `/admin-web/admin-api`,
},
},
'/server/api/': {
target: 'https://preview.pro.ant.design/',
changeOrigin: true,
pathRewrite: { '^/server': '' },
},
};