From 54f00ff5774b007eaab3828dd702f2915b8f1fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E8=89=B2=E9=98=B3=E5=85=89?= <1122@hizhou.cn> Date: Wed, 17 Jul 2024 18:00:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=201.2.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.cjs | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/index.cjs b/dist/index.cjs index c3ca816..ed61177 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -230,7 +230,12 @@ const deploy = async ({ // 规则 rule, config, + callback, }) => { + const { + deployBefore, + deployAfter, + } = callback || {}; const startTime = Date.now(); console.log(chalk__default["default"].white(` 正在扫描目录[${dir}] `)); const { @@ -286,6 +291,9 @@ const deploy = async ({ width: Math.min(total * 2, 30), }); + if (typeof deployBefore === 'function') { + await deployBefore(files, tasks, transferToTasks); + } try { // OSS上传 if (tasks.oss.length) { @@ -316,6 +324,9 @@ const deploy = async ({ console.log(chalk__default["default"].bgRed(' 部署异常 ')); throw error; } + if (typeof deployAfter === 'function') { + await deployAfter(files, tasks); + } console.log(chalk__default["default"].bgBlue(' 部署完成 ')); }; diff --git a/package.json b/package.json index 619ff8d..4923da0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ossso/front-deploy", - "version": "1.2.0", + "version": "1.2.3", "description": "前端内容自动化部署工具", "main": "index.js", "exports": {