Skip to content

Instantly share code, notes, and snippets.

@ra9r
Last active September 1, 2025 19:46
Show Gist options
  • Select an option

  • Save ra9r/bf98b57340fc772c86eaa6a641912700 to your computer and use it in GitHub Desktop.

Select an option

Save ra9r/bf98b57340fc772c86eaa6a641912700 to your computer and use it in GitHub Desktop.
Creates a Zip of your Playdate PDX file. Requires two files (see below). Files must be placed in `<project>/scripts/zip-pdx.ps1` and `<project>/.vscode/tasks.json` respectively
// Build tasks - documentation can be found at: https://code.visualstudio.com/docs/editor/tasks
{
"version": "2.0.0",
"tasks": [
{
// Use "pdc" command to build Playdate project into .pdx
"label": "Playdate: Build",
"type": "pdc",
// Look for build problems that match a specific format and output it to the "problems" window
"problemMatcher": ["$pdc-lua", "$pdc-external"],
"presentation": {
// Switch to problems tab on error
"revealProblems": "onProblem",
// Share same terminal window as other tasks
"panel": "shared",
// Don't show "Terminal will be reused by tasks, press any key to close it" message
"showReuseMessage": false
}
},
{
// Opens the Playdate Simulator with our project .pdx
"label": "Playdate: Run",
"type": "playdate-simulator",
// Look for build problems that match a specific format and output it to the "problems" window
"problemMatcher": ["$pdc-external"],
// Close any existing simulator windows before launching a new one
"kill": true,
"presentation": {
// Switch to problems tab on error
"revealProblems": "onProblem",
// Share same terminal window as other tasks
"panel": "shared",
// Don't show "Terminal will be reused by tasks, press any key to close it" message
"showReuseMessage": false
}
},
{
// Build and then launch the Playdate Simulator with our newly build .pdx
"label": "Playdate: Build and Run",
"dependsOn": ["Playdate: Build", "Playdate: Run"],
"dependsOrder": "sequence",
// Set as our default built task under Terminal->Run Build Task, or with ctrl/cmd+shift+B
"group": {
"kind": "build",
"isDefault": true,
}
},
{
// Creates a Zip file containing the *.pdx directory from the /builds directory
// IMPORTANT: Expects /scripts/zip-pdx.ps1
"label": "Playdate: Zip PDX",
"type": "shell",
"command": "powershell",
"args": [
"-NoProfile",
"-ExecutionPolicy", "Bypass",
"-File", "${workspaceFolder}/scripts/zip-pdx.ps1"
],
"problemMatcher": []
},
{
// Build and then zips the .pdx
"label": "Playdate: Build and Zip PDX",
"dependsOn": ["Playdate: Build", "Playdate: Zip PDX"],
"dependsOrder": "sequence",
"group": {
"kind": "build",
"isDefault": true,
}
},
]
}
# Get game name from pdxinfo
$name = (Get-Content source/pdxinfo | Select-String "^name=").ToString().Split("=")[1].Trim()
# Build paths
$src = "builds/$name.pdx"
$dst = "builds/$name.pdx.zip"
# Ensure source exists
if (-not (Test-Path $src)) {
throw "PDX folder not found: $src"
}
# Remove existing zip if necessary
if (Test-Path $dst) {
Remove-Item $dst -Force
}
# Create archive
#Compress-Archive -Path $src -DestinationPath $dst -Force
# Create archive with tar
# -a : choose format based on extension (.zip → zip format)
# -c : create new archive
# -f : specify archive file
# -C : change directory so that $src folder is top-level in the archive
tar -a -cf $dst -C (Split-Path $src -Parent) (Split-Path $src -Leaf)
Write-Output "Created: $dst"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment