From ae75c82505e774f0b941e7191b6b293bb0ccce9a Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Sat, 28 Mar 2026 13:03:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96=20dailyVersionin?= =?UTF-8?q?g=20=E6=8F=92=E4=BB=B6=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/vite.config.js b/vite.config.js index 6a53196..5a607bb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -9,18 +9,10 @@ function dailyVersioning() { name: 'daily-versioning', enforce: 'post', writeBundle(options, bundle) { - const now = new Date() - const date = now.getFullYear() - + String(now.getMonth() + 1).padStart(2, '0') - + String(now.getDate()).padStart(2, '0') - - const oldPath = join(options.dir || 'dist', 'index.html') - const newName = `grandclaw-archtype-${date}.html` - const newPath = join(options.dir || 'dist', newName) - - if (bundle['index.html']) { - renameSync(oldPath, newPath) - } + if (!bundle['index.html']) return + const dir = options.dir || 'dist' + const date = new Date().toISOString().slice(0, 10).replace(/-/g, '') + renameSync(join(dir, 'index.html'), join(dir, `grandclaw-archtype-${date}.html`)) } } }