From f70e51437791c6f25146f15270867ec0b144bfe0 Mon Sep 17 00:00:00 2001 From: kiki Date: Fri, 2 Jun 2023 16:49:31 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- vue.config.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fe9bcfa..08416de 100644 --- a/package.json +++ b/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", diff --git a/vue.config.js b/vue.config.js index 48ad6c0..ca7e242 100644 --- a/vue.config.js +++ b/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`} + ] + } + } + } + ] + }) + } ) }