Commit 884cbe34 authored by 前端-许佳敏's avatar 前端-许佳敏

尝试调整构建cd

parent 6c7241c1
...@@ -49,8 +49,28 @@ const config: any = { ...@@ -49,8 +49,28 @@ const config: any = {
defaultSizes: 'parsed', // stat // gzip defaultSizes: 'parsed', // stat // gzip
}, },
inlineLimit: 10000, inlineLimit: 10000,
// 自定义修改webpack配置 chunks: ['vendors', 'umi'],
chainWebpack(memo, { env, webpack, createCSSRule }) { chainWebpack: function (config, { webpack }) {
config.merge({
optimization: {
minimize: true,
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 3,
automaticNameDelimiter: '.',
cacheGroups: {
vendor: {
name: 'vendors',
test({ resource }) {
return /[\\/]node_modules[\\/]/.test(resource);
},
priority: 10,
},
},
},
}
});
}, },
cssLoader: { cssLoader: {
localsConvention: 'camelCase', // 将style中的class由 .foo-body 转化为fooBody调用 localsConvention: 'camelCase', // 将style中的class由 .foo-body 转化为fooBody调用
......
// 这里的env只有对本地起效, 线上构建不用
module.exports = {
scm: {
SITE_ID: '1',
BACK_GATEWAY: 'http://lingxi-scm.wg.shushangyun.com',
USE_ROUTE_CONFIG: false,
SOCKET_URL: 'ws://lingxi-scm.wg.shushangyun.com'
}
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"name": "lingxi-business-paltform", "name": "lingxi-business-paltform",
"version": "1.0.4", "version": "1.0.4",
"scripts": { "scripts": {
"upload:scm": "cross-env local=scm taskName=upload yarn scripts:build",
"api": "god-ytt", "api": "god-ytt",
"scripts:build": "node scripts/run", "scripts:build": "node scripts/run",
"scripts:build-yxc": "node scripts/run http://yxc-web-demo.shushangyun.com/api", "scripts:build-yxc": "node scripts/run http://yxc-web-demo.shushangyun.com/api",
...@@ -86,8 +87,10 @@ ...@@ -86,8 +87,10 @@
"fs-extra": "^9.0.1", "fs-extra": "^9.0.1",
"god-yapi2ts": "^1.6.0", "god-yapi2ts": "^1.6.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-git": "^2.10.1",
"http-proxy-middleware": "^1.0.5", "http-proxy-middleware": "^1.0.5",
"json2ts": "^0.0.7", "json2ts": "^0.0.7",
"node-cmd": "^4.0.0",
"ora": "^4.0.4" "ora": "^4.0.4"
} }
} }
/**
* 手动上传文件
* @auth xjm
*/
const git = require('gulp-git')
const Logs = require('./utils/log')
const cmd = require('node-cmd')
/**
* 获取远程代码
*/
const pullRemoteCode = (done) => {
git.pull('origin', ['dev', 'test'], function(err) {
if (err) {
throw err
}
Logs.stop()
installPackage(done)
})
}
const installPackage = (done) => {
cmd.run('yarn', function(err) {
if (err) {
throw err
}
runBuild(done)
})
}
const runBuild = (done) => {
done()
}
const initUpload = (done) => {
pullRemoteCode(done)
}
module.exports = {
pullRemoteCode,
initUpload
}
\ No newline at end of file
...@@ -7,16 +7,22 @@ const runFile = './services' ...@@ -7,16 +7,22 @@ const runFile = './services'
const fetchConfig = require(runFile).fetchConfig const fetchConfig = require(runFile).fetchConfig
const gulp = require('gulp') const gulp = require('gulp')
const json2ts = require('json2ts') const json2ts = require('json2ts')
const uploadBuildStram = require('./build')
const rootPath = '../'; const rootPath = '../';
const outputPath = path.resolve(__dirname, rootPath, 'config/base.config.json') const outputPath = path.resolve(__dirname, rootPath, 'config/base.config.json')
const outputDts = path.resolve(__dirname, rootPath, 'src/global/config/global.d.ts') const outputDts = path.resolve(__dirname, rootPath, 'src/global/config/global.d.ts')
Logs.start('gulp start') // Logs.start('gulp start')
gulp.task('start', gulp.series(done => { gulp.task('start', gulp.series(done => {
getAsyncConfig(done) // getAsyncConfig(done)
}))
gulp.task('upload', gulp.series(done => {
Logs.start('use upload')
uploadBuildStram.initUpload(done)
})) }))
/** /**
......
const gulp = require('gulp') const gulp = require('gulp')
const envValue = require('../env')
const taskName = process.env.taskName || 'start'
// 本地构建时带上的环境变量
const local = process.env.local
if (local) {
process.env.SITE_ID = envValue[local].SITE_ID
process.env.BACK_GATEWAY = envValue[local].BACK_GATEWAY
process.env.USE_ROUTE_CONFIG = envValue[local].USE_ROUTE_CONFIG
process.env.SOCKET_URL = envValue[local].SOCKET_URL
}
function runTask(toRun) { function runTask(toRun) {
const metadata = { task: toRun }; const metadata = { task: toRun };
...@@ -23,4 +35,4 @@ function runTask(toRun) { ...@@ -23,4 +35,4 @@ function runTask(toRun) {
} }
require('./gulpfile') require('./gulpfile')
runTask('start') runTask(taskName)
\ No newline at end of file \ No newline at end of file
...@@ -12,8 +12,8 @@ const Logs = { ...@@ -12,8 +12,8 @@ const Logs = {
log(chalk.red(msg)) log(chalk.red(msg))
}, },
start() { start(msg) {
spinner.start() spinner.start(msg)
}, },
stop(msg, type) { stop(msg, type) {
......
import { IRoutes } from '.'; import { IRoutes } from '.';
import { history, RequestConfig, Redirect } from 'umi'; import { history, Redirect } from 'umi';
import React from 'react' import React from 'react'
import MobxProvider from './store' import MobxProvider from './store'
import '@/global/styles/reset.less'; // 重置antd样式 import '@/global/styles/reset.less'; // 重置antd样式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment