Make reprint.phar a dynamically downloaded dependency#3690
Conversation
…updated-dependency
…updated-dependency
📊 Performance Test ResultsComparing ad66936 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
…-reprint-a-dynamically-updated-dependency # Conflicts: # apps/cli/vite.config.base.ts
| // refresh it on the shared dependency-update throttle (see `updateServerFiles` in `setup.ts`). | ||
| const REPRINT_REPO = 'adamziel/reprint'; // TODO: Review this if the repo is moved to the Automattic repository | ||
| const REPRINT_ASSET = 'reprint.phar'; | ||
| const LATEST_RELEASE_URL = `https://api.github.com/repos/${ REPRINT_REPO }/releases/latest`; |
There was a problem hiding this comment.
Should we use the tagged version link to ensure we intentionally use a specific version?
|
Echoing @wojtekn's point above and relaying what @epeicher and I discussed in a huddle: we agreed to change this implementation so that every version of Studio ships a fixed version of reprint. There should be a script that automatically extracts the PHAR from the latest reprint release and puts it in the So, we should look to |
The download part should be straightforward, e.g.: https://github.com/adamziel/reprint/releases/download/v0.8.1/reprint.phar |
…udio-make-reprint-a-dynamically-updated-dependency
|
Thanks @wojtekn and @fredrikekelund for your comments. I have addressed them, so now |
…updated-dependency
wojtekn
left a comment
There was a problem hiding this comment.
The code change looks good, and works correctly:
[reprint] Downloading reprint.phar (v0.8.1) ...
[reprint] Moving reprint.phar to destination ...
[reprint] Files extracted
|
|
||
| // reprint.phar ships bundled with every Studio build — downloaded here at build time, not at | ||
| // runtime. Pin a specific release so each build embeds a known, fixed version; bump this constant | ||
| // to upgrade. See https://github.com/adamziel/reprint/releases. |
There was a problem hiding this comment.
The code below is self-explanatory, not sure if we need the comment.
…udio-make-reprint-a-dynamically-updated-dependency
…updated-dependency
Related issues
How AI was used in this PR
Implemented with Claude Code (Opus): updated the build-time download script, the runtime path resolution, and the tests, and removed the earlier runtime-download module. I reviewed the changes.
Proposed Changes
reprint.phar(the PHP archive behind the experimentalpull-reprintmigration) now ships as a fixed, pinned version bundled into every Studio build. A build-time step downloads it intowp-files/using the same mechanism as WordPress, wp-cli, and the SQLite plugin (scripts/download-wp-server-files.ts), so it is part of the installer instead of being fetched or auto-updated at runtime.The version is pinned to
v0.8.1. Bumping it is a one-line change to a constant in the download script.User impact:
pull-reprintto obtain the phar.This replaces the earlier runtime auto-download approach, which has been removed.
Testing Instructions
npm ci.wp-files/reprint/reprint.pharis downloaded from thev0.8.1release.npm run cli:build. Confirmapps/cli/dist/cli/wp-files/reprint/reprint.pharexists andapps/cli/dist/cli/reprint.phardoes not.reprint.pharis there by runningnpm run makeand then checkingls -l apps/studio/out/Studio-darwin-arm64/Studio.app/Contents/Resources/cli/wp-files/reprintPre-merge Checklist