Skip to content

feat: add NodeSetupValidator for validating Magento default setup files#142

Merged
dermatz merged 3 commits intomainfrom
feature-NodeSetupValidator
Feb 17, 2026
Merged

feat: add NodeSetupValidator for validating Magento default setup files#142
dermatz merged 3 commits intomainfrom
feature-NodeSetupValidator

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Feb 17, 2026

This pull request introduces a new service, NodeSetupValidator, to streamline the validation and restoration of Node.js setup files required for Magento Standard theme development. The service is integrated into the Magento Standard theme builder workflow, ensuring that missing or corrupted Node.js setup files are automatically detected and optionally restored from the Magento base installation, improving reliability and developer experience.

The most important changes are:

Node.js Setup Validation and Restoration:

  • Added a new service, NodeSetupValidator, which checks for the presence of required Node.js setup files and directories (such as package.json, Gruntfile.js, and node_modules/) in the project root, and offers to restore them from the Magento base installation if missing. It also handles generated files like package-lock.json and can run npm install as needed. (src/Service/NodeSetupValidator.php)

Integration with Theme Builder Workflow:

  • Injected the NodeSetupValidator service into the Magento Standard theme builder and updated the node setup process to invoke validation and restoration before proceeding with further build steps. (src/Service/ThemeBuilder/MagentoStandard/Builder.php) [1] [2] [3]

Dependency Injection Configuration:

  • Registered the new NodeSetupValidator service and its dependencies in the DI configuration file to ensure proper instantiation by the framework. (src/etc/di.xml)

Thanks therouv for reporting

@dermatz dermatz marked this pull request as ready for review February 17, 2026 12:20
Copilot AI review requested due to automatic review settings February 17, 2026 12:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a new NodeSetupValidator service to automatically detect and restore missing Node.js setup files required for Magento Standard theme development. The service integrates into the Magento Standard theme builder workflow, checking for required files (package.json, Gruntfile.js, grunt-config.json) and offering to restore them from the Magento base installation when missing.

Changes:

  • Added NodeSetupValidator service to validate and restore Node.js setup files from vendor/magento/magento2-base
  • Integrated validation into the Magento Standard theme builder's processNodeSetup() method to run before other Node/Grunt operations
  • Configured dependency injection for the new service with required dependencies (FileDriver and NodePackageManager)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Service/NodeSetupValidator.php New service that validates required Node.js files, prompts user for restoration, copies files from Magento base, and runs npm install as needed
src/Service/ThemeBuilder/MagentoStandard/Builder.php Injected NodeSetupValidator dependency and added validation call in processNodeSetup() before autoRepair()
src/etc/di.xml Registered NodeSetupValidator service with FileDriver and NodePackageManager dependencies

Comment on lines +187 to +191
return confirm(
label: 'Would you like to restore missing files from Magento base?',
default: true,
hint: 'This will copy the standard Magento files to your project root.'
);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The Laravel Prompts confirm() function should be replaced with $io->confirm() to be consistent with how other service classes handle user prompts. Additionally, the second parameter should be set to true to match the default behavior shown in the Laravel Prompts call (default: true), or adjust as needed for the desired default behavior. See src/Service/DependencyChecker.php lines 52, 71, and 111 for examples of the correct pattern.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 17, 2026 12:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@dermatz dermatz merged commit 3f36d43 into main Feb 17, 2026
11 checks passed
@dermatz dermatz deleted the feature-NodeSetupValidator branch February 17, 2026 12:41
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.

1 participant

Comments