Fix plugin directory structure inconsistency in PluginCreateCommand#86
Open
wilsonatb wants to merge 1 commit intoNativePHP:mainfrom
Open
Fix plugin directory structure inconsistency in PluginCreateCommand#86wilsonatb wants to merge 1 commit intoNativePHP:mainfrom
wilsonatb wants to merge 1 commit intoNativePHP:mainfrom
Conversation
Updates PluginCreateCommand to generate nested directories (resources/android/src and resources/ios/Sources). Updates corresponding tests to reflect the new paths. This aligns the creation command with the expectations of PluginValidateCommand.
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 Description
There is an inconsistency between the
native:plugin:createcommand and thenative:plugin:validatecommand in NativePHP Mobile:PluginCreateCommandcreates plugins with a flat directory structure (resources/android/{Namespace}Functions.kt,resources/ios/{Namespace}Functions.swift).PluginValidateCommandexpects third-party plugins to use a nested directory structure (resources/android/src/,resources/ios/Sources/).This causes validation warnings for newly created plugins, even though they are functionally correct. The system's
Pluginclass actually supports both structures, but the validator only checks the nested structure for third-party plugins.Root Cause
The
PluginCreateCommand.phpfile creates directories and files using the flat structure, while the documented plugin structure shows nested directories. Third-party plugins fail validation with warnings about missing native code.Solution
Updated
PluginCreateCommand.phpto create the nested directory structure by default, aligning it with the validator's expectations and best practices.Required Changes:
src/andSources/.PluginCommandsTest.phpto ensure the test suite passes.Testing
native:plugin:validate(passed with 0 warnings).PluginCommandsTest.Visual Proof (Before & After)
Before (Current Main):
Generating a plugin and validating it results in false warnings due to the flat structure.
After (This PR):
Generating a new plugin creates the nested directories, and validation passes cleanly.