Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created September 6, 2025 14:42
Show Gist options
  • Save easierbycode/0ca9c9bd526e4b9b1764e6f1b87d8851 to your computer and use it in GitHub Desktop.
Save easierbycode/0ca9c9bd526e4b9b1764e6f1b87d8851 to your computer and use it in GitHub Desktop.
appify:mac - compiled deno to DMG
{
"tasks": {
"dev": "deno run -A --watch=server.ts,static/,games/ server.ts",
"start": "deno run -A server.ts",
"copy:assets:windows": "powershell -NoProfile -Command \"New-Item -ItemType Directory -Force build/windows | Out-Null; Copy-Item -Recurse -Force static build/windows/static; if (Test-Path games) { Copy-Item -Recurse -Force games build/windows/games }\"",
"build:windows": "deno compile --allow-all --target x86_64-pc-windows-msvc --output build/windows/codemonkey-games-launcher.exe server.ts && deno task copy:assets:windows",
"run:windows": "build/windows/codemonkey-games-launcher.exe",
"build-run:windows": "deno task build:windows && deno task run:windows",
"fmt": "deno fmt",
"lint": "deno lint",
"build:kazeta": "deno run -A scripts/kazeta.ts",
"copy:assets:mac": "sh -c 'mkdir -p build/mac && cp -R static build/mac/static && if [ -d games ]; then cp -R games build/mac/games; fi'",
"build:mac:binary": "deno compile --allow-all --output build/mac/codemonkey-games-launcher server.ts && deno task copy:assets:mac",
"appify:mac": "sh -c 'set -e; APP_NAME=${APP_NAME:-CodemonkeyGamesLauncher}; APP_DISPLAY_NAME=${APP_DISPLAY_NAME:-Codemonkey Games Launcher}; BDIR=build/mac; APP=\"$BDIR/$APP_NAME.app\"; BIN=\"$BDIR/codemonkey-games-launcher\"; rm -rf \"$APP\"; mkdir -p \"$APP/Contents/MacOS\" \"$APP/Contents/Resources\"; if [ ! -f \"$BIN\" ]; then echo \"Binary not found at $BIN. Run deno task build:mac:binary first.\" >&2; exit 1; fi; cp \"$BIN\" \"$APP/Contents/MacOS/codemonkey-games-launcher\"; chmod +x \"$APP/Contents/MacOS/codemonkey-games-launcher\"; if [ -d \"$BDIR/static\" ]; then cp -R \"$BDIR/static\" \"$APP/Contents/MacOS/static\"; fi; if [ -d \"$BDIR/games\" ]; then cp -R \"$BDIR/games\" \"$APP/Contents/MacOS/games\"; fi; cat > \"$APP/Contents/Info.plist\" <<\"PLIST\"\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n <dict>\n <key>CFBundleName</key><string>$APP_DISPLAY_NAME</string>\n <key>CFBundleDisplayName</key><string>$APP_DISPLAY_NAME</string>\n <key>CFBundleIdentifier</key><string>com.codemonkey.games.launcher</string>\n <key>CFBundleVersion</key><string>${CMG_VERSION:-1.0.0}</string>\n <key>CFBundleShortVersionString</key><string>${CMG_VERSION:-1.0.0}</string>\n <key>CFBundleExecutable</key><string>codemonkey-games-launcher</string>\n <key>CFBundlePackageType</key><string>APPL</string>\n <key>LSMinimumSystemVersion</key><string>10.15</string>\n </dict>\n</plist>\nPLIST'",
"package:mac:dmg": "sh -c 'set -e; APP_NAME=${APP_NAME:-CodemonkeyGamesLauncher}; APP_DISPLAY_NAME=${APP_DISPLAY_NAME:-Codemonkey Games Launcher}; BDIR=build/mac; APP=\"$BDIR/$APP_NAME.app\"; if [ ! -d \"$APP\" ]; then echo \"App not found at $APP. Run deno task appify:mac first.\" >&2; exit 1; fi; STAGE=\"$BDIR/dmg-stage\"; rm -rf \"$STAGE\"; mkdir -p \"$STAGE\"; cp -R \"$APP\" \"$STAGE/\"; (cd \"$STAGE\" && ln -s /Applications Applications || true); DMG_NAME=$(printf %s \"$APP_NAME\" | tr \" \" -); hdiutil create -volname \"$APP_DISPLAY_NAME\" -srcfolder \"$STAGE\" -ov -format UDZO \"$BDIR/$DMG_NAME.dmg\" >/dev/null'",
"package:mac:pkg": "sh -c 'set -e; APP_NAME=${APP_NAME:-CodemonkeyGamesLauncher}; APP_DISPLAY_NAME=${APP_DISPLAY_NAME:-Codemonkey Games Launcher}; BDIR=build/mac; APP=\"$BDIR/$APP_NAME.app\"; if [ ! -d \"$APP\" ]; then echo \"App not found at $APP. Run deno task appify:mac first.\" >&2; exit 1; fi; ROOT=\"build/pkgroot\"; rm -rf \"$ROOT\"; mkdir -p \"$ROOT/Applications\"; cp -R \"$APP\" \"$ROOT/Applications/$APP_NAME.app\"; PKG_NAME=$(printf %s \"$APP_NAME\" | tr \" \" -); pkgbuild --root \"$ROOT\" --identifier com.codemonkey.games.launcher --version ${CMG_VERSION:-1.0.0} \"$BDIR/$PKG_NAME.pkg\" >/dev/null'",
"build:mac": "deno task build:mac:binary && deno task appify:mac && deno task package:mac:dmg",
"build:mac:pkg": "deno task build:mac:binary && deno task appify:mac && deno task package:mac:pkg",
"run:mac": "build/mac/codemonkey-games-launcher",
"run:mac:app": "sh -c 'open \"build/mac/${APP_NAME:-CodemonkeyGamesLauncher}.app\"'",
"build-run:mac": "deno task build:mac:binary && deno task run:mac"
},
"fmt": {
"useTabs": false,
"indentWidth": 2,
"lineWidth": 100
},
"lint": {
"rules": {
"tags": ["recommended"]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment