Skip to content

Add magebox watch command for mage-os/magento-cache-clean and Hyva watcher - #66

Merged
peterjaap merged 2 commits into
mainfrom
feat/watch-cache-clean
Apr 6, 2026
Merged

peterjaap merged 2 commits into
mainfrom
feat/watch-cache-clean

Conversation

@peterjaap

Copy link
Copy Markdown
Collaborator

Runs cache-clean.js in the foreground against the current project, detecting the globally installed binary via PATH or Composer's global bin directory. Prompts to install via 'composer global require mage-os/magento-cache-clean' when missing. Ctrl-C exits cleanly.

Runs cache-clean.js in the foreground against the current project,
detecting the globally installed binary via PATH or Composer's global
bin directory. Prompts to install via 'composer global require
mage-os/magento-cache-clean' when missing. Ctrl-C exits cleanly.
@Aquive

Aquive commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Nice, this one was on my whishlist! 👍

@jakwinkler

Copy link
Copy Markdown
Contributor

@peterjaap awesome feature, lets merge :-)

@peterjaap

peterjaap commented Apr 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

I also made it open npm run watch in the Hyva theme dir if it is a Hyva project. It opens both watchers in tmux, so you see both panes. If tmux isn't installed, it'll show a message to install it.

image

- Detect Hyvä theme tailwind directory and run npm watch in a tmux
  split pane alongside cache-clean.js
- Run generate-cache-clean-config.php before starting the watcher to
  ensure var/cache-clean-config.json reflects current env.php
- Use project PHP binary for config generation
@peterjaap peterjaap changed the title Add magebox watch command for mage-os/magento-cache-clean Add magebox watch command for mage-os/magento-cache-clean and Hyva watcher Apr 6, 2026
@peterjaap
peterjaap merged commit e7ad56f into main Apr 6, 2026
11 checks passed
@Aquive

Aquive commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

@peterjaap nice feature. I have/had the same functionality in a command. Wasn't sure if it was to specific for my workflow or not.

Couple of questions:

  • What happens when there are are multiple Hyva themes?
  • Does it find the right tailwind dir automatically? (I have worked as an interim for another agency and they were changing the default tailwind dir)
  • Does it find Luma themes with Tailwind on top of it?

I know all edge cases, but it can all be solved of course. I gave my script a menu to choose the right theme when there is more than one. Other two are built in logic.

@peterjaap
peterjaap deleted the feat/watch-cache-clean branch April 6, 2026 17:49
@peterjaap

Copy link
Copy Markdown
Collaborator Author

@Aquive

Here's what changed:

1. Multiple themes: if more than one is found, a huh select prompt lets the user pick (same widget as magebox run), with a "None" option to skip
2. Custom tailwind dir: instead of hardcoding web/tailwind/, it walks the entire theme directory tree looking for any package.json that has a "watch"
script in its scripts section (skipping node_modules/vendor)
3. Any theme type: works for Hyvä, Luma+Tailwind, or any custom theme — renamed all Hyvä-specific references to generic "theme watcher"

#70

@Aquive

Aquive commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

@peterjaap this tool gets better by the day. Nice! I love the way I am so close to the source I can have an influence :) I'll keep sharing my ideas.

We have an internal demo scheduled tomorrow morning. So my collegues can switch over too.

@peterjaap

Copy link
Copy Markdown
Collaborator Author

@Aquive awesome!!

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.

3 participants