|
|
@ -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`} |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|