修改打包命令

merge-requests/1/head
ch 2 years ago
parent 9403e17b29
commit e99accc36b

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-05 14:40:00 * @Date: 2022-05-05 14:40:00
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-07 10:09:54 * @LastEditTime: 2022-05-07 10:51:53
* @Description: 根据git分支生成对应环境的环境变量 * @Description: 根据git分支生成对应环境的环境变量
* 开发时如果环境变量换了可以不用重启服务直接运行node env.config.js即可 * 开发时如果环境变量换了可以不用重启服务直接运行node env.config.js即可
*/ */
@ -25,21 +25,16 @@ const envConfig = {
} }
} }
const branch = getRepoInfo().branch; // 调用获取git信息 const branch = getRepoInfo().branch; // 调用获取git信息
let curEnvConfig = {}; let curEnvConfig = null;
switch (branch){ const argv = global.process.argv;
case 'msb_test': for(key in envConfig){
curEnvConfig = envConfig.test; if(argv.includes(`--ENV:${key}`)){
break; curEnvConfig = envConfig[key];
case 'msb_beta': break;
curEnvConfig = envConfig.beta; }
break; }
case 'msb_prod': if(!curEnvConfig){
curEnvConfig = envConfig.prod; curEnvConfig = envConfig.dev;
break;
default:
curEnvConfig = envConfig.dev;
break;
} }
fs.writeFileSync(`${path.resolve(__dirname, './plugins/config')}/env.js`, fs.writeFileSync(`${path.resolve(__dirname, './plugins/config')}/env.js`,
`const ENV = ${JSON.stringify(curEnvConfig)}; export default ENV;`); `const ENV = ${JSON.stringify(curEnvConfig)}; export default ENV;`);

@ -4,7 +4,11 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "node env.config.js & nuxt", "dev": "node env.config.js & nuxt",
"build": "node env.config.js & nuxt build", "dev:beta": "node env.config.js --ENV:beta & nuxt",
"dev:prod": "node env.config.js --ENV:prod & nuxt",
"build:test": "node env.config.js --ENV:test & nuxt build",
"build:beta": "node env.config.js --ENV:beta & nuxt build",
"build:prod": "node env.config.js --ENV:prod & nuxt build",
"start": "nuxt start", "start": "nuxt start",
"generate": "nuxt generate", "generate": "nuxt generate",
"test": "jest" "test": "jest"

@ -2,14 +2,16 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:43:19 * @LastEditTime: 2022-05-07 10:27:01
* @Description: file content * @Description: file content
*/ */
import {axiosTk} from "../axiosTk"; import {axiosTk} from "../axiosTk";
import {axios} from "../axios"; import {axios} from "../axios";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/uc`;
const BASE_URL = '/uc';
/** /**
* 获取当前登录用户信息 * 获取当前登录用户信息
*/ */

@ -2,14 +2,16 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:42:08 * @LastEditTime: 2022-05-07 10:28:22
* @Description: file content * @Description: file content
*/ */
import {axiosTk} from "../axiosTk"; import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/mall/base`;
const BASE_URL = '/mall/base';
/** /**
* 获取收货地址 * 获取收货地址
*/ */

@ -2,13 +2,15 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:41:25 * @LastEditTime: 2022-05-07 10:29:08
* @Description: file content * @Description: file content
*/ */
import {axiosTk} from "../axiosTk"; import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/mall/product`;
const BASE_URL = '/mall/product';
/** /**
* 设置购物车数量 * 设置购物车数量

@ -2,13 +2,15 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:40:26 * @LastEditTime: 2022-05-07 10:29:22
* @Description: file content * @Description: file content
*/ */
import {axios} from "../axios"; import {axios} from "../axios";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/mall/product`;
const BASE_URL = '/mall/product';
/** /**
* 获取商品瀑布流 * 获取商品瀑布流
* @param {*} params * @param {*} params

@ -4,12 +4,14 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:17:25 * @Date: 2022-05-04 18:17:25
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:46:02 * @LastEditTime: 2022-05-07 10:29:48
* @Description: file content * @Description: file content
*/ */
import {axiosTk} from "../axiosTk"; import {axiosTk} from "../axiosTk";
import ENV from '../config/env';
const BASE_URL = `${ENV.base_url}/mall/trade`;
const BASE_URL = '/mall/trade';
const APPID = 'wx0643970a8e86d028'; const APPID = 'wx0643970a8e86d028';
/** /**

@ -2,14 +2,19 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:40:06 * @LastEditTime: 2022-05-07 10:30:17
* @Description: file content * @Description: file content
*/ */
import {axiosTk} from "../axiosTk"; import {axiosTk} from "../axiosTk";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = '/oss/oss'; const BASE_URL = `${ENV.base_url}/oss/oss`;
/**
* 获取OOS信息
* @param {*} data
*/
export const ApiPostGetOssConfig = (data) => export const ApiPostGetOssConfig = (data) =>
ToAsyncAwait(axiosTk.post(`${BASE_URL}/generateOssSignature`, data)); ToAsyncAwait(axiosTk.post(`${BASE_URL}/generateOssSignature`, data));

@ -2,13 +2,14 @@
* @Author: ch * @Author: ch
* @Date: 2022-05-04 18:24:03 * @Date: 2022-05-04 18:24:03
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-05-04 22:44:12 * @LastEditTime: 2022-05-07 10:30:28
* @Description: file content * @Description: file content
*/ */
import {axios} from "../axios"; import {axios} from "../axios";
import { ToAsyncAwait } from "../utils"; import { ToAsyncAwait } from "../utils";
import ENV from '../config/env';
const BASE_URL = '/mall/marketing'; const BASE_URL = `${ENV.base_url}/mall/marketing`;
export const ApiGetHomeSeckill = () => export const ApiGetHomeSeckill = () =>
ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/home`)); ToAsyncAwait(axios.get(`${BASE_URL}/app/activity/home`));

Loading…
Cancel
Save