|
| 1 | +app-id: io.github.foxxmd.multiscrobbler |
| 2 | +runtime: org.freedesktop.Platform |
| 3 | +runtime-version: '22.08' |
| 4 | +sdk: org.freedesktop.Sdk |
| 5 | +command: multiscrobbler |
| 6 | +finish-args: |
| 7 | + - --share=network |
| 8 | + # used for access to MPRIS in order to scrobble |
| 9 | + - --own-name=org.mpris.MediaPlayer2.* |
| 10 | +sdk-extensions: |
| 11 | + - org.freedesktop.Sdk.Extension.node18 |
| 12 | +modules: |
| 13 | + - name: multiscrobbler |
| 14 | + buildsystem: simple |
| 15 | + build-options: |
| 16 | + append-path: /usr/lib/sdk/node18/bin |
| 17 | + env: |
| 18 | + XDG_CACHE_HOME: /run/build/multiscrobbler/flatpak-node/cache |
| 19 | + npm_config_cache: /run/build/multiscrobbler/flatpak-node/npm-cache |
| 20 | + npm_config_nodedir: /usr/lib/sdk/node18 |
| 21 | + npm_config_offline: 'true' |
| 22 | + build-commands: |
| 23 | + # install npm dependencies |
| 24 | + - npm install --offline |
| 25 | + |
| 26 | + # build app |
| 27 | + - npm run build |
| 28 | + |
| 29 | + # makes node and npm available |
| 30 | + - mkdir -p /app/bin /app/lib /app/lib/src |
| 31 | + - cp -a /usr/lib/sdk/node18/bin/{node,npm} /app/bin |
| 32 | + - cp -a /usr/lib/sdk/node18/lib/* /app/lib |
| 33 | + - rm -r /app/lib/node_modules/npm/{docs,man} |
| 34 | + |
| 35 | + # remove dev dependencies |
| 36 | + - npm prune --production |
| 37 | + |
| 38 | + # copy node_modules needed to run app |
| 39 | + - cp -r node_modules/* /app/lib/node_modules |
| 40 | + |
| 41 | + # delete typescript files (not needed for running app) |
| 42 | + - find src/ -name "*.ts" -type f -delete |
| 43 | + |
| 44 | + # copy app files to runtime dir |
| 45 | + - cp -r src/* /app/lib/src |
| 46 | + - cp -r config /app/lib/config |
| 47 | + - cp flatpak/defaultConfig.json /app/lib/config/config.json |
| 48 | + |
| 49 | + - install -Dm644 flatpak/${FLATPAK_ID}.desktop /app/share/applications/${FLATPAK_ID}.desktop |
| 50 | + - install -Dm644 flatpak/icon.png /app/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png |
| 51 | + - install -Dm644 flatpak/${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml |
| 52 | + |
| 53 | + - install -Dm755 ../run.sh /app/bin/multiscrobbler |
| 54 | + subdir: main |
| 55 | + sources: |
| 56 | + - type: git |
| 57 | + url: https://github.com/FoxxMD/multi-scrobbler |
| 58 | + commit: 9a578e54a89f87c82ff811bb04257c9b641b199a |
| 59 | + dest: main |
| 60 | + # Wrapper to launch the app |
| 61 | + - type: script |
| 62 | + dest-filename: run.sh |
| 63 | + commands: |
| 64 | + # Run config check and copy examples + default config (disable file logging) |
| 65 | + - | |
| 66 | + echo -e "Checking CONFIG_DIR for existing configs: ${XDG_CONFIG_HOME}" |
| 67 | + if [ "$(ls -A ${XDG_CONFIG_HOME})" ]; then |
| 68 | + echo "Directory is not empty! Will not add default config/examples" |
| 69 | + else |
| 70 | + echo "Directory is empty! Adding default config/examples" |
| 71 | + cp -r /app/lib/config/. "${XDG_CONFIG_HOME}"/ |
| 72 | + #cp /app/lib/defaultConfig.json $XDG_CONFIG_HOME/config.json |
| 73 | + fi |
| 74 | + - cd /app/lib && CONFIG_DIR=$XDG_CONFIG_HOME IS_LOCAL=true node src/index.js |
| 75 | + |
| 76 | + - generated-sources.json |
0 commit comments