Browse Source

chore: 增加打包脚本

master
kiki 2 years ago
parent
commit
f70e514377
  1. 3
      package.json
  2. 31
      vue.config.js

3
package.json

@ -87,7 +87,8 @@
"sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
"vue-template-compiler": "2.6.12"
"vue-template-compiler": "2.6.12",
"filemanager-webpack-plugin": "3.1.1"
},
"engines": {
"node": ">=8.9",

31
vue.config.js

@ -1,5 +1,6 @@
'use strict'
const path = require('path')
const FileManagerPlugin = require('filemanager-webpack-plugin')
function resolve(dir) {
return path.join(__dirname, dir)
@ -166,6 +167,36 @@ module.exports = {
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './' //到根目录下
}
config.plugin('fileManager')
.use(FileManagerPlugin)
.tap(args => {
let env = process.env["ENV"];
const fileName = env === 'production' ? '生产环境' : '开发环境'
const disDir = 'dist'
// 获取当前时间的可读
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
const zipFileName = `卡卡管理后台-${fileName}-${year}-${month}-${day}-${hour}-${minute}-${second}`
return [
{
events: {
onEnd: {
archive: [ // 选择文件夹将之打包成xxx.zip并放在根目录
{source: `./${disDir}`, destination: `./archives/${zipFileName}.zip`}
]
}
}
}
]
})
}
)
}

Loading…
Cancel
Save