Skip to content

Commit 17f166c

Browse files
Add remote asset listing to build (#1502)
## Motivation for the change, related issues This PR adds a remote asset listing to minified WP builds so we can later tell which files are expected to exist remotely and which should be considered missing if they are not present locally. This was originally part of request routing PRs #1417 and #1490, but since there are some sensitive edge cases around the routing changes and browser storage, I am breaking the build changes into their own PR so the more sensitive changes can be reviewed more easily on their own. ## Implementation details This PR updates the minified WP build process to generate a wordpress-remote-asset-paths file containing the WP-relative paths of all assets not included in the minified build. That way, we have the necessary information to judge whether a requested resource can be requested from playground.wordpress.net when it does not exist locally. We include this listing with new minified WP builds. In case browser storage has already cached a minified WP build without this listing, we also make it available remotely so it can be retrieved as needed. ## Testing Instructions (or ideally a Blueprint) - CI tests
1 parent 3176a19 commit 17f166c

File tree

306 files changed

+106044
-70220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+106044
-70220
lines changed

packages/playground/wordpress-builds/build/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ RUN cp -r wordpress wordpress-static && \
3737
# Remove all empty directories
3838
find . -type d -empty -delete
3939

40+
# Remove the sqlite database integration from the static files
41+
RUN rm -rf wordpress-static/wp-content/mu-plugins
42+
43+
# List assets that will be available to remotely so Playground can judge whether
44+
# to request a remote asset or delegate the request for a missing file to PHP.
45+
RUN find wordpress-static -type f | sed 's#^wordpress-static/##'> wordpress-remote-asset-paths
46+
47+
# Make the remote asset listing available remotely so it can be downloaded
48+
# directly in cases where an older minified WordPress build without this file
49+
# has been saved to browser storage.
50+
RUN cp wordpress-remote-asset-paths wordpress-static/
51+
4052
# Move the static files to the final output directory
4153
RUN mkdir /root/output/$OUT_FILENAME
4254
RUN mv wordpress-static/* /root/output/$OUT_FILENAME/
@@ -122,6 +134,7 @@ RUN cd wordpress && \
122134

123135
# Build the final wp.zip file
124136
RUN mv wordpress /wordpress && \
137+
cp wordpress-remote-asset-paths /wordpress/ && \
125138
cd /wordpress && \
126139
zip /root/output/$OUT_FILENAME.zip -r .
127140

0 commit comments

Comments
 (0)