#!/usr/bin/env bash set -e cd "$(dirname "$0")" VERSION=$(node -p "require('./package.json').version") OUT="build/PLWL-$VERSION.tar.gz" bash tools/svg2png.sh renderer/plwl.svg renderer/plwl.png 256 # 1. Electron runtime is the base of the release (the binary detects # resources/app.asar automatically, so the whole app lives inside the asar). if [ ! -d node_modules/electron/dist ]; then npm install fi rm -rf build/dist mkdir -p build/dist/PLWL cp -r node_modules/electron/dist build/dist/PLWL/electron # 2. Pack the app payload (code + renderer + bundled files) into app.asar. STAGE=build/dist/.app-stage mkdir -p "$STAGE" cp -r src renderer files package.json "$STAGE/" npx asar pack "$STAGE" build/dist/PLWL/electron/resources/app.asar rm -rf "$STAGE" # 3. Launcher, desktop entry and installer. cat > build/dist/PLWL/plwl << 'EOF' #!/usr/bin/env bash set -e cd "$(dirname "$0")" exec ./electron/electron . "$@" EOF chmod +x build/dist/PLWL/plwl cat > build/dist/PLWL/plwl.desktop << 'EOF' [Desktop Entry] Type=Application Name=PLWL Comment=Portable Linux Wine Launcher Exec=plwl Icon=plwl Terminal=false Categories=Game; EOF cp tools/install.sh build/dist/PLWL/install.sh chmod +x build/dist/PLWL/install.sh # 4. Tarball. mkdir -p build tar -czf "$OUT" -C build/dist PLWL rm -rf build/dist echo "Built $OUT"