ESTRUTURA NOVA: mobile/ + scripts/sync-html.mjs - mobile/package.json: Capacitor 6 + plugins (geolocation, local-notifications, network, preferences, status-bar) - mobile/capacitor.config.json: appId br.com.pontualtech.shivao, allowNavigation pra OSM/Windy/CDNs - mobile/.gitignore: protege keystore (NUNCA commitar chaves privadas) - mobile/README.md: setup completo (JDK + Android Studio + keystore + build APK/AAB + Play Store submission + iOS futuro + troubleshooting) - scripts/sync-html.mjs: copia app/diario-bordo.html → server/public + mobile/www (1 fonte da verdade) ADAPTER NATIVO no HTML (sincronizado app/ + server/public/): - isNative() / nativePlatform() detecta Capacitor - nativeWatchPosition() usa Capacitor.Geolocation (background-capable) com fallback navigator.geolocation - nativeNotify() usa Capacitor.LocalNotifications com fallback toast - initServiceWorker() pula registro no Capacitor (WebView nativo já tem cache próprio) NÃO INCLUI (ainda): - Build local: precisa JDK 17 + Android Studio (~3GB) — instruções no README - Keystore: gerar 1 vez via keytool (script no README) - AAB pra Play Store: comandos no README - Conta Google Play Developer: $25 1× pelo dono Próximo passo manual: instalar JDK + Android Studio, rodar 'npm install && npx cap add android'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
822 B
JavaScript
25 lines
822 B
JavaScript
// Sync único do HTML do Shivão pra todos os destinos.
|
|
// Fonte de verdade: app/diario-bordo.html
|
|
// Destinos: server/public/index.html (Express) + mobile/www/index.html (Capacitor)
|
|
import { copyFile, mkdir } from 'node:fs/promises';
|
|
import { dirname, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const root = resolve(__dirname, '..');
|
|
|
|
const src = resolve(root, 'app/diario-bordo.html');
|
|
const targets = [
|
|
resolve(root, 'server/public/index.html'),
|
|
resolve(root, 'mobile/www/index.html'),
|
|
];
|
|
|
|
async function sync() {
|
|
for (const t of targets) {
|
|
await mkdir(dirname(t), { recursive: true });
|
|
await copyFile(src, t);
|
|
console.log(`✓ ${src} → ${t}`);
|
|
}
|
|
}
|
|
|
|
sync().catch(e => { console.error(e); process.exit(1); });
|