Skip to content

fix(magento-standard): resolve Node/Grunt paths from the Magento root - #291

Merged
dermatz merged 3 commits into
mainfrom
fix/magento-standard-paths
Nov 12, 2026
Merged

dermatz merged 3 commits into
mainfrom
fix/magento-standard-paths

Conversation

@dermatz

@dermatz dermatz commented Nov 12, 2026

Copy link
Copy Markdown
Member

Problem

MagentoStandard\Builder hard-coded $rootPath = '.', so Node setup detection, auto repair and grunt watch only worked when the current working directory was the Magento root. It also only looked for a lowercase gruntfile.js, while the conventional name is Gruntfile.js, which is missed on case-sensitive filesystems.

Fix

  • Inject DirectoryList and use getRoot() as root path.
  • Run grunt watch via cd <root> && node_modules/.bin/grunt watch.
  • Detect both Gruntfile.js and gruntfile.js.
  • Tests updated, plus a new test for the capitalised Gruntfile.

Not part of this PR: GruntTaskRunner and NodePackageManager shell commands still run in the current directory, and the npm outdated handling is a separate finding.

Checks

phpunit (BuilderTest, DependencyUpdaterTest), phpcs, phpstan and mago lint/fmt: no new findings.

Use the Magento root directory instead of the current working directory
for Node setup detection, auto repair and watch mode, and also detect a
capitalised Gruntfile.js, which is the conventional name on
case-sensitive filesystems.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 22:44
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous test-coverage gap addressed.

Summary

MagentoStandard\Builder now uses the Magento root for Node setup checks and runs grunt watch there. It also detects Gruntfile.js.

  • Standard theme builds find Node setup from Magento’s root.
  • Grunt watch now starts inside Magento’s root.

Reviews (2) · Last reviewed commit: "style(magento-standard): fix PHPCS warni..." · Reviewed by Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The watch tests never reach execution, leaving the new working-directory and path-quoting behavior untested for paths containing spaces and an apostrophe and for successful and non-zero exits.

1 open issue
What changed in this PR

This PR makes Magento-standard theme setup detection and repair use the configured Magento root, and starts grunt watch from that directory.

Changes:

  • Injects DirectoryList to replace current-directory assumptions.
  • Recognises both Gruntfile.js and gruntfile.js, and quotes the root path in the watch command.
  • Updates root-path test expectations and adds capitalised Gruntfile detection coverage.
File Description
tests/​Unit/​Service/​ThemeBuilder/​MagentoStandard/​BuilderTest.php Adds the root-directory stub, updates expectations and tests capitalised Gruntfile detection.
src/​Service/​ThemeBuilder/​MagentoStandard/​Builder.php Uses the Magento root for setup checks, repair paths and watcher execution; supports both Gruntfile names.

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 22:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the Magento-root setup path resolution and Grunt watch changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 12, 2026 22:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the Magento root-based theme builder changes.

No open issues 🎉

Review effort: Balanced

@dermatz
dermatz merged commit 5f606c5 into main Nov 12, 2026
23 checks passed
@dermatz
dermatz deleted the fix/magento-standard-paths branch November 12, 2026 23:05
@github-actions github-actions Bot mentioned this pull request Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants