Repository navigation
fix(magento-standard): resolve Node/Grunt paths from the Magento root - #291
Merged
Merged
Conversation
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>
[Medium impact] The PR appears safe to merge, with the previous test-coverage gap addressed.
|
Contributor
There was a problem hiding this comment.
🟡 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
DirectoryListto replace current-directory assumptions. - Recognises both
Gruntfile.jsandgruntfile.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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
MagentoStandard\Builderhard-coded$rootPath = '.', so Node setup detection, auto repair andgrunt watchonly worked when the current working directory was the Magento root. It also only looked for a lowercasegruntfile.js, while the conventional name isGruntfile.js, which is missed on case-sensitive filesystems.Fix
DirectoryListand usegetRoot()as root path.grunt watchviacd <root> && node_modules/.bin/grunt watch.Gruntfile.jsandgruntfile.js.Not part of this PR:
GruntTaskRunnerandNodePackageManagershell commands still run in the current directory, and thenpm outdatedhandling is a separate finding.Checks
phpunit (BuilderTest, DependencyUpdaterTest), phpcs, phpstan and mago lint/fmt: no new findings.