chore: configure vite for GitHub Pages deployment

This commit is contained in:
LC mac
2026-01-29 00:21:26 +08:00
parent c55390228b
commit b7da81c5d4
2 changed files with 15 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
VERSION=$1 VERSION=$1
@@ -9,23 +10,26 @@ if [ -z "$VERSION" ]; then
fi fi
echo "🔨 Building $VERSION..." echo "🔨 Building $VERSION..."
# Remove old build files but keep .git
rm -rf dist/assets dist/index.html dist/*.js dist/*.css dist/vite.svg
bun run build bun run build
echo "📄 Adding README..." echo "📄 Adding README..."
cp public/README.md dist/README.md if [ -f public/README.md ]; then
cp public/README.md dist/README.md
fi
echo "📦 Deploying to GitHub Pages..." echo "📦 Deploying to GitHub Pages..."
cd dist cd dist
git add . git add .
git commit -m "Deploy $VERSION" || echo "No changes to commit" git commit -m "Deploy $VERSION" || echo "No changes to commit"
git push git push
cd .. cd ..
echo "✅ Deployed to https://kccleoc.github.io/seedpgp-web-app/" echo "✅ Deployed to https://kccleoc.github.io/seedpgp-web-app/"
echo "📖 Repo: https://github.com/kccleoc/seedpgp-web-app" echo ""
echo "🏷️ Don't forget to tag: git tag $VERSION && git push --tags" echo "Tag private repo:"
echo "./scripts/deploy.sh v1.2.0" echo " git tag $VERSION && git push origin --tags"
echo "git tag v1.2.0"
echo "git push --tags"

View File

@@ -3,16 +3,9 @@ import react from '@vitejs/plugin-react'
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
base: '/seedpgp-web-app/', // Match your repo name base: '/seedpgp-web-app/',
build: { build: {
chunkSizeWarningLimit: 600, // Suppress warning outDir: 'dist',
rollupOptions: { emptyOutDir: false,
output: {
manualChunks: {
'openpgp': ['openpgp'], // Separate chunk for PGP
}
}
}
} }
}) })