张恒

添加控制台部分中文输出

...@@ -21,7 +21,7 @@ let hotMiddleware ...@@ -21,7 +21,7 @@ let hotMiddleware
21 function logStats(proc, data) { 21 function logStats(proc, data) {
22 let log = '' 22 let log = ''
23 23
24 - log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`) 24 + log += chalk.yellow.bold(`┏ ${proc} ${config.dev.chineseLog ? '编译过程' : 'Process'} ${new Array((19 - proc.length) + 1).join('-')}`)
25 log += '\n\n' 25 log += '\n\n'
26 26
27 if (typeof data === 'object') { 27 if (typeof data === 'object') {
...@@ -114,7 +114,7 @@ function startMain() { ...@@ -114,7 +114,7 @@ function startMain() {
114 const compiler = webpack(mainConfig) 114 const compiler = webpack(mainConfig)
115 115
116 compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { 116 compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => {
117 - logStats('Main', chalk.white.bold('compiling...')) 117 + logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, chalk.white.bold(`${config.dev.chineseLog ? '正在处理资源文件...' : 'compiling...'}`))
118 hotMiddleware.publish({ action: 'compiling' }) 118 hotMiddleware.publish({ action: 'compiling' })
119 done() 119 done()
120 }) 120 })
...@@ -125,7 +125,7 @@ function startMain() { ...@@ -125,7 +125,7 @@ function startMain() {
125 return 125 return
126 } 126 }
127 127
128 - logStats('Main', stats) 128 + logStats(`${config.dev.chineseLog ? '主进程' : 'Main'}`, stats)
129 129
130 if (electronProcess && electronProcess.kill) { 130 if (electronProcess && electronProcess.kill) {
131 manualRestart = true 131 manualRestart = true
...@@ -179,7 +179,7 @@ function electronLog(data, color) { ...@@ -179,7 +179,7 @@ function electronLog(data, color) {
179 }) 179 })
180 if (/[0-9A-z]+/.test(log)) { 180 if (/[0-9A-z]+/.test(log)) {
181 console.log( 181 console.log(
182 - chalk[color].bold('┏ Electron -------------------') + 182 + chalk[color].bold(`┏ ${config.dev.chineseLog ? '主程序日志' : 'Electron'} -------------------`) +
183 '\n\n' + 183 '\n\n' +
184 log + 184 log +
185 chalk[color].bold('┗ ----------------------------') + 185 chalk[color].bold('┗ ----------------------------') +
...@@ -205,7 +205,7 @@ function greeting() { ...@@ -205,7 +205,7 @@ function greeting() {
205 space: false 205 space: false
206 }) 206 })
207 } else console.log(chalk.yellow.bold('\n electron-vue')) 207 } else console.log(chalk.yellow.bold('\n electron-vue'))
208 - console.log(chalk.blue(' getting ready...') + '\n') 208 + console.log(chalk.blue(`${config.dev.chineseLog ? ' 准备启动...' : ' getting ready...'}`) + '\n')
209 } 209 }
210 210
211 async function init() { 211 async function init() {
......
...@@ -6,6 +6,7 @@ module.exports = { ...@@ -6,6 +6,7 @@ module.exports = {
6 dev: { 6 dev: {
7 env: require('./dev.env'), 7 env: require('./dev.env'),
8 removeElectronJunk: true, 8 removeElectronJunk: true,
9 + chineseLog: false,
9 port: 9080 10 port: 9080
10 }, 11 },
11 UseStartupChart: true, 12 UseStartupChart: true,
......
1 module.exports = { 1 module.exports = {
2 NODE_ENV: '"production"', 2 NODE_ENV: '"production"',
3 - BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"' 3 + BASE_API: ''
4 } 4 }
......