Repository navigation
fix(node): report outdated npm packages correctly - #292
Merged
Merged
Conversation
The outdated check treated the '{}' output of npm as outdated packages and
ignored that npm exits non-zero when packages are outdated. The standard
builder additionally ran the check in the current working directory.
Reuse the normalised getOutdatedPackages() result for all builders and
run the standard builder check in the Magento root.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the updated npm package reporting and Magento-root delegation.
No open issues 🎉
What changed in this PR
Fixes outdated npm package reporting in MageForge’s theme tooling, avoiding false warnings for up-to-date packages and correctly reporting genuine outdated results.
Changes:
- Reuses the shared JSON parser to display readable package versions, remain silent for empty results, and report failures only in verbose mode.
- Delegates the standard Magento builder’s check to
NodePackageManager, targeting the Magento root. - Updates tests for reporting, verbosity, and root-directory delegation.
| File | Description |
|---|---|
tests/Unit/Service/ThemeBuilder/MagentoStandard/BuilderTest.php |
Verifies delegation with the Magento root path. |
tests/Unit/Service/NodePackageManagerTest.php |
Covers formatted output, empty results, and verbose-only failures. |
src/Service/ThemeBuilder/MagentoStandard/Builder.php |
Removes the duplicate check and uses the shared manager. |
src/Service/NodePackageManager.php |
Reports parsed package results instead of interpreting raw output. |
Review effort: Balanced
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
npm outdated --jsonprints{}when everything is up to date and exits non-zero when packages are outdated.NodePackageManager::checkOutdatedPackages()and the private copy inMagentoStandard\Buildertreated the'{}'string as truthy and warned about outdated packages when there were none, and a non-zero exit (the real outdated case) was swallowed as an error. The standard builder also ran the check in the current working directory.Fix
checkOutdatedPackages()now usesgetOutdatedPackages(), which neutralises the exit code and parses the JSON: silent when up to date, a readable list (name: current -> latest) otherwise, and a verbose-only message when the check itself fails.MagentoStandard\Builderdrops its private copy and delegates toNodePackageManagerwith the Magento root.{}stays silent, failure only reported in verbose mode).Checks
phpunit (NodePackageManager, ThemeBuilder), phpcs, phpstan, mago lint/fmt: no new findings. The 7 failures in the full unit suite are already present on
main.