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