Skip to content

fix(node): report outdated npm packages correctly - #292

Merged
dermatz merged 1 commit into
mainfrom
fix/npm-outdated-check
Nov 12, 2026
Merged

dermatz merged 1 commit into
mainfrom
fix/npm-outdated-check

Conversation

@dermatz

@dermatz dermatz commented Nov 12, 2026

Copy link
Copy Markdown
Member

Problem

npm outdated --json prints {} when everything is up to date and exits non-zero when packages are outdated. NodePackageManager::checkOutdatedPackages() and the private copy in MagentoStandard\Builder treated 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 uses getOutdatedPackages(), 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\Builder drops its private copy and delegates to NodePackageManager with the Magento root.
  • Tests updated and extended ({} 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.

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>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:06
@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; no actionable issues were found.

Summary

Fixes outdated npm package reports by reusing getOutdatedPackages().

  • Theme builders now report outdated npm packages as version changes.

Reviews (1) · Last reviewed commit: "fix(node): report outdated npm packages ..." · 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.

🟢 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

@dermatz
dermatz merged commit 53d1815 into main Nov 12, 2026
23 checks passed
@dermatz
dermatz deleted the fix/npm-outdated-check branch November 12, 2026 23:18
@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