Files
harheimertc/scripts/playstore-assets.mjs
Torsten Schulz (local) 5c3d78245f
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 2m10s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped
feat: add Datenschutzerklärung and Konto löschen pages
- Created datenschutz.vue for the privacy policy with sections on data protection, responsible entity, data processing, rights, and contact information.
- Created konto-loeschen.vue for account deletion requests, detailing the process, affected data, and processing time.
- Added anonymize-playstore-screenshot.sh script for image anonymization using ImageMagick.
- Introduced playstore-assets.mjs for generating Play Store assets, including icons and feature graphics, using sharp.
- Added playstore-assets.sh script to execute the asset generation script.
2026-05-29 16:51:36 +02:00

70 lines
2.2 KiB
JavaScript

#!/usr/bin/env node
import { mkdir, readFile } from 'node:fs/promises'
import path from 'node:path'
import sharp from 'sharp'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const rootDir = path.resolve(__dirname, '..')
const logoSrc = path.join(rootDir, 'public', 'images', 'logos', 'Harheimer TC.svg')
const outDir = path.join(rootDir, 'android-app', 'playstore-assets', 'generated')
const iconOut = path.join(outDir, 'playstore-icon-512.png')
const featureOut = path.join(outDir, 'playstore-feature-graphic-1024x500.png')
const featureOverlaySvg = `
<svg width="1024" height="500" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#0f172a"/>
<stop offset="100%" stop-color="#1e293b"/>
</linearGradient>
</defs>
<rect width="1024" height="500" fill="url(#bg)"/>
<text x="430" y="185" font-size="66" font-family="DejaVu Sans, Arial, sans-serif" font-weight="700" fill="#e5e7eb">Harheimer TC</text>
<text x="430" y="250" font-size="30" font-family="DejaVu Sans, Arial, sans-serif" fill="#cbd5e1">Tischtennis in Frankfurt-Harheim</text>
</svg>
`
async function generateAssets() {
await mkdir(outDir, { recursive: true })
const logoBuffer = await readFile(logoSrc)
const resizedLogoForIcon = await sharp(logoBuffer)
.resize(440, 440, { fit: 'contain' })
.png()
.toBuffer()
await sharp({
create: {
width: 512,
height: 512,
channels: 4,
background: { r: 0, g: 0, b: 0, alpha: 0 },
},
})
.composite([{ input: resizedLogoForIcon, gravity: 'center' }])
.png()
.toFile(iconOut)
const resizedLogoForFeature = await sharp(logoBuffer)
.resize(320, 320, { fit: 'contain' })
.png()
.toBuffer()
await sharp(Buffer.from(featureOverlaySvg))
.composite([{ input: resizedLogoForFeature, left: 72, top: 90 }])
.png()
.toFile(featureOut)
console.log(`Fertig. Assets erzeugt in: ${outDir}`)
console.log(`- ${path.basename(iconOut)}`)
console.log(`- ${path.basename(featureOut)}`)
}
generateAssets().catch((error) => {
console.error('Fehler bei der Asset-Generierung:', error)
process.exitCode = 1
})