Skip to content

Consolidate build and publish scripts #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 11, 2022

Conversation

eliot-akira
Copy link
Collaborator

@eliot-akira eliot-akira commented Sep 29, 2022

Resolves #15. The NPM scripts were getting long and unwieldy to edit inside package.json, so I moved them into separate files. I made a couple of other small improvements along the way.

tar -xzf wordpress-6.0.1.tar.gz
rm wordpress-6.0.1.tar.gz
# Download latest version of WordPress
wp_tarfile=wordpress-latest.tar.gz
Copy link
Collaborator

@adamziel adamziel Oct 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel pretty confident about defaulting to the latest minor release, e.g. 6.0.2. Auto-upgrading to the next major release like 6.1.0 could break the build, though, if anything essential changes. I'd rather keep doing this manually every few months until there are more checks and balances in place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - that would be more stable and reliable than always pulling the newest version automatically. OK, updated.

@adamziel
Copy link
Collaborator

adamziel commented Oct 3, 2022

Great PR @eliot-akira, the code reads well! I'll also test it soon. Debugging #1 made my local setup quite unwieldy, but I will give this PR some testing soon.

@eliot-akira
Copy link
Collaborator Author

eliot-akira commented Oct 3, 2022

Thank you for the review!

I'll make another commit so the WordPress download is pinned to a specific version.

In that case, what do you think about "caching" the tar file (by not removing it every time)?

wp_tarfile=wordpress-6.0.2.tar.gz
if [ ! -f $wp_tarfile ]; then
  wget https://wordpress.org/$wp_tarfile
fi
tar -xzf $wp_tarfile

The file could be added to .gitignore.


As an aside - I've continued trying to solve #24 with a "hand shake" between app.mjs and service worker (event message and response, then set iframe src) - but ran into difficulty with some fetch events from the iframe that don't have client ID for some reason, that cannot be distinguished from fetch events from the host. For this I'm testing on Chromium, and have observed #1 on occasion, "Aw snap".

Copy link
Collaborator

@adamziel adamziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution as always @eliot-akira! 👍 I'm not merging yet as there is an ongoing discussion, but I'm approving already.

@eliot-akira
Copy link
Collaborator Author

eliot-akira commented Oct 6, 2022

Thanks! This last change (mainly commit 6733446) turned out to be bigger than I expected. It'd be great if you could test drive the scripts to check that they all do everything as expected, same as before.

I reorganized the dev and build scripts in package.json, and renamed some of them for consistency. I also changed some of the dev scripts to run the corresponding build script with --watch option, to reduce duplicated commands and options.

  • dev - Alias for dev:web
    • dev:web - Runs dev:web:* in parallel
      • dev:web:app
      • dev:web:html
      • dev:web:serve
      • dev:web:service-worker
      • dev:web:web-worker
    • dev:node
  • build - Alias for build:web
    • build:web - Runs build:web:* in parallel
      • build:web:app
      • build:web:html
      • build:web:service-worker
      • build:web:web-worker
    • build:node
    • build:php - Runs build:php:* sequentially
      • build:php:web
      • build:php:node
    • build:wp
    • build:app - Runs build:web and build:node sequentially
  • clean - Runs clean:* in parallel
    • clean:php
    • clean:wp

@adamziel
Copy link
Collaborator

adamziel commented Oct 11, 2022

It all works in my testing. There were a few merge conflicts with #28 so I went ahead and rebased this PR. Splendid work @eliot-akira, the scripts structure feels much cleaner now. Thank you so much!

@adamziel adamziel merged commit a43e0bd into WordPress:trunk Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge "build" and "publish" package.json scripts into just "build"
2 participants