From bc3ca0f3b9acf0652e8aad98097ad498d100bb2f Mon Sep 17 00:00:00 2001 From: Kaloyan Danchev Date: Sat, 24 Oct 2026 11:44:04 +0300 Subject: [PATCH] Add build script and gitignore for settings theme Build script minifies and base64-encodes the theme for telnet transfer. Outputs to settings-theme/dist/ (gitignored). Co-Authored-By: Claude Opus 4.6 --- .gitignore | 1 + settings-theme/build.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 .gitignore create mode 100644 settings-theme/build.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/settings-theme/build.js b/settings-theme/build.js new file mode 100644 index 0000000..82b0678 --- /dev/null +++ b/settings-theme/build.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const path = require('path'); + +const src = path.join(__dirname, 'com.palm.app.settings.js'); +const code = fs.readFileSync(src, 'utf8'); + +let minified = code + .replace(/\/\/[^\n]*/g, '') + .replace(/\/\*[\s\S]*?\*\//g, '') + .replace(/\n\s*\n/g, '\n') + .replace(/^\s+/gm, '') + .replace(/\n/g, '') + .replace(/ +/g, ' '); + +console.log('Original size:', code.length, 'bytes'); +console.log('Minified size:', minified.length, 'bytes'); + +const outDir = path.join(__dirname, 'dist'); +fs.mkdirSync(outDir, { recursive: true }); + +const outPath = path.join(outDir, 'com.palm.app.settings.min.js'); +fs.writeFileSync(outPath, minified); +console.log('Written to:', outPath); + +const b64 = Buffer.from(minified).toString('base64'); +const b64Path = path.join(outDir, 'com.palm.app.settings.b64'); +fs.writeFileSync(b64Path, b64); +console.log('Base64 size:', b64.length, 'bytes'); +console.log('Base64 written to:', b64Path);