Add delete old deplyoments script#2334
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2334 +/- ##
==========================================
+ Coverage 37.34% 37.65% +0.30%
==========================================
Files 1021 1035 +14
Lines 66288 66851 +563
Branches 3428 3503 +75
==========================================
+ Hits 24756 25170 +414
- Misses 41156 41301 +145
- Partials 376 380 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a small “scripts” workspace package containing a maintenance script to help identify and delete old Vercel deployments across all apps in the monorepo, with optional alias fetching to aid review.
Changes:
- Introduces
scripts/remove-old-vercel-deployments.tsto list old deployments and printvercel remove ... --safe --yescommands. - Adds a
scriptsworkspace package (tsconfig + package.json + README) and wires it intopnpm-workspace.yaml. - Updates
cspell.config.js(new words) and updatespnpm-lock.yamlaccordingly.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/tsconfig.json | Adds TS config for the new scripts workspace. |
| scripts/remove-old-vercel-deployments.ts | New Node/TS script to list old deployments and (optionally) fetch aliases. |
| scripts/package.json | Defines the scripts workspace package and a pnpm script entrypoint. |
| scripts/README.md | Documents how to run the script and how it works. |
| pnpm-workspace.yaml | Registers scripts as a workspace package. |
| pnpm-lock.yaml | Lockfile updates for the new workspace importer and dependency graph shifts. |
| cspell.config.js | Adds spellchecker allowlist entries used in the new docs/script output. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| ```bash | ||
| # List old deployments for every app (default: older than 7 days) | ||
| VERCEL_TEAM_SLUG=... \ | ||
| pnpm remove-old-vercel-deployments | ||
|
|
||
| # Only one app | ||
| pnpm remove-old-vercel-deployments --app=stripe | ||
|
|
||
| # Custom age threshold | ||
| pnpm remove-old-vercel-deployments --max-age-days=14 | ||
| ``` |
There was a problem hiding this comment.
The usage examples imply you can run this from the repo root via pnpm remove-old-vercel-deployments, but the root package.json doesn’t define that script. As written, users will need pnpm -C scripts remove-old-vercel-deployments or pnpm --filter @saleor/apps-scripts remove-old-vercel-deployments (and update the examples accordingly).
| aliased ones from the batch. The script does NOT fetch aliases itself. | ||
|
|
||
| Recommended workflow: |
There was a problem hiding this comment.
This section says “The script does NOT fetch aliases itself”, but the script now has a --with-aliases flag that does fetch aliases and append them to the output. Please update the wording to clarify the default behavior vs the optional flag, so the docs don’t contradict the implementation.
| aliased ones from the batch. The script does NOT fetch aliases itself. | |
| Recommended workflow: | |
| aliased ones from the batch. By default, the script does not fetch aliases | |
| itself; if you pass `--with-aliases`, it fetches team aliases once and appends | |
| each deployment's active alias domains to its output row for visibility. | |
| Recommended workflow (default mode, without `--with-aliases`): |
| | --- | --- | --- | | ||
| | `--max-age-days=<n>` | `7` | Consider deployments older than this many days. | | ||
| | `--app=<dirname>` | all | Limit to a single app directory under `apps/`. | | ||
| | `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs ~1 paginated API call regardless of project count. | |
There was a problem hiding this comment.
The --with-aliases description claims it “Costs ~1 paginated API call”, but alias listing is explicitly paginated and can take multiple requests depending on alias count. Consider rephrasing to something like “one paginated alias-listing loop for the whole team (not per project)”.
| | `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs ~1 paginated API call regardless of project count. | | |
| | `--with-aliases` | off | Fetch team aliases once and append each deployment's active alias domains to its row. Costs one paginated alias-listing loop for the whole team (not per project). | |
| "compilerOptions": { | ||
| "target": "es2023", | ||
| "module": "nodenext", | ||
| "moduleResolution": "nodenext", | ||
| "types": ["node"], | ||
| "strict": true, | ||
| "noEmit": true, | ||
| "skipLibCheck": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "esModuleInterop": true |
There was a problem hiding this comment.
Most workspaces in this repo extend @saleor/typescript-config-apps/base.json for consistent TS defaults. Consider doing the same here and only overriding the Node-specific bits (module/moduleResolution/types/target) so scripts stay aligned with repo-wide compiler settings.
| "compilerOptions": { | |
| "target": "es2023", | |
| "module": "nodenext", | |
| "moduleResolution": "nodenext", | |
| "types": ["node"], | |
| "strict": true, | |
| "noEmit": true, | |
| "skipLibCheck": true, | |
| "resolveJsonModule": true, | |
| "isolatedModules": true, | |
| "esModuleInterop": true | |
| "extends": "@saleor/typescript-config-apps/base.json", | |
| "compilerOptions": { | |
| "target": "es2023", | |
| "module": "nodenext", | |
| "moduleResolution": "nodenext", | |
| "types": ["node"] |
Differences FoundExpandLicense Package <<missing>> @saleor/apps-scripts SummaryExpand
|
Adds script to delete old deployments from Vercel.
Requires installing Vercel CLI - script fetches deployments from their API and outputs it as a command to run via Vercel CLI.
The actual safety check is done by Vercel CLI:
--safeflag makes sure that no deployment is deleted if it has alias assigned (production, staging, branch name, etc.).Deployments with alias have to be deleted manually, when no
--safe --yesflags are passed, Vercel CLI asks for confirmation before delete.Example output: