Skip to content

Add Windows PowerShell alternative for "delete project with too many deployments" guide #31753

Description

@The-LukeZ

Existing documentation URL(s)

The current documentation for deleting a project with too many deployments relies on a shell script workflow that works for Linux/macOS shells, but is not Windows-friendly as written. It also throws a "jq not found" error in WSL for me.

What changes are you suggesting?

Please add examples in tabs to the guide:

  • Shell script (Linux/macOS)
  • PowerShell .ps1 (Windows)
$prod_id = ""
while ($true) {
    $json = npx wrangler pages deployment list --project-name <PROJECT_NAME> --json 2>$null
    $ids = ($json | ConvertFrom-Json) | Select-Object -ExpandProperty id
    $to_delete = $ids | Where-Object { $_ -ne $prod_id }
    if (-not $to_delete) {
        Write-Host "Done. Production: $prod_id"
        break
    }
    Write-Host "Deleting $(@($to_delete).Count) deployments..."
    foreach ($id in $to_delete) {
        $output = npx wrangler pages deployment delete $id --project-name <PROJECT_NAME> --force 2>&1
        if ($output -notmatch "Successfully deleted") {
            if ($output -match "active production deployment") {
                $prod_id = $id
            }
        }
    }
}

This would make the guide much more accessible for Windows users.

Additional information

I could make a PR, but I don't think I've got the time anytime soon. Maybe someone else is faster than me. If not, I will do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions