name: flight-radar
base: core22
adopt-info: app
title: Flight Radar
summary: Real-time US flight tracker with FAA radar center aesthetic
description: |
  Flight Radar is an Electron app that renders OpenSky Network aircraft data in
  a Cesium-powered radar display.
license: MIT
contact: https://github.com/birge/flight-radar/issues
source-code: https://github.com/birge/flight-radar
issues: https://github.com/birge/flight-radar/issues
grade: stable
confinement: strict

apps:
  flight-radar:
    command: node_modules/electron/dist/electron $SNAP/main.js
    extensions: [gnome]
    plugs:
      - audio-playback
      - desktop
      - desktop-legacy
      - home
      - network
      - network-bind
      - opengl
      - wayland
      - x11

parts:
  app:
    plugin: nil
    source: .
    build-packages:
      - python3
      - make
      - g++
      - rsync
    override-build: |
      craftctl set version="$(node -p "require('./package.json').version")"
      npm ci --include=dev
      npm run setup
      rsync -a \
        --exclude='.git' \
        --exclude='dist' \
        --exclude='snap' \
        "$CRAFT_PART_SRC/" "$CRAFT_PART_INSTALL/"
      node "$CRAFT_PART_SRC/scripts/obfuscate-snap.js" "$CRAFT_PART_INSTALL"
      rsync -a --exclude='7zip-bin' node_modules/ "$CRAFT_PART_INSTALL/node_modules/"
      cp -a vendor "$CRAFT_PART_INSTALL/"
