yootheme / starter-plugin

🚀 YOOtheme Pro - Starter Plugin for Wordpress and Joomla
MIT License
10 stars 3 forks source link

Error during setup-wordpress task #5

Open Taimurian opened 1 month ago

Taimurian commented 1 month ago

I encountered two issues while trying to use the Yootheme Starter Plugin:

  1. The script fails during the setup-wordpress task due to a missing directory.
  2. The expected prompts for plugin metadata (title, description, author name, etc.) were not presented during the create-project step, as stated in the documentation.

Steps to reproduce

  1. Run the following command in the plugins folder of WordPressto to create a new plugin:
    composer create-project yootheme/starter-plugin myplugin
  2. Issue 1: The creation process completes without asking for any plugin metadata (title, description, author, etc.), even though the documentation states that these fields should be prompted.
  3. Navigate to the plugin directory:
    cd myplugin
  4. Run the setup task:
    task setup-wordpress
  5. Issue 2: The following error occurs:

    Script YOOtheme\Starter\TaskHelper::run handling the run:task event terminated with an exception
    
    In Finder.php line 592:
    The "C:/xampp/htdocs/yootheme/wp-content/plugins/myplugin/dist/wordpress/myplugin" directory does not exist.
    
    task: Failed to run task "setup-wordpress": exit status 1

Expected behavior

Screenshots X20241008124433

Environment:

hendrikbehncke commented 1 month ago

Hi, thanks for reporting the issue. Unfortunately I don't have access to a Windows system to debug on currently. We will look into it asap

esedic commented 2 weeks ago

I can confirm this, Windows 10 is my OS, Composer version 2.7.2

hendrikbehncke commented 2 weeks ago

We had a look into the issue and unfortunately the way we wanted to run the composer command after creating the project does not work in Windows. There's an open issue in the composer project and from what I read it's not solvable because of a limitation how Symfony/Process executes processes on windows https://github.com/composer/composer/issues/11709

We will remove the create:plugin command from the post-create-project-cmd hook. The step composer create:plugin then needs to be executed manually after the project has been created.

GenoPeppino commented 2 weeks ago

We had a look into the issue and unfortunately the way we wanted to run the composer command after creating the project does not work in Windows. There's an open issue in the composer project and from what I read it's not solvable because of a limitation how Symfony/Process executes processes on windows composer/composer#11709

We will remove the create:plugin command from the post-create-project-cmd hook. The step composer create:plugin then needs to be executed manually after the project has been created.

Hey Hendrik, I hope I'm understanding right. Basically the post-create-project-cmd isn't running, so post project creation I run create:plugin and that should do it... It's not working for me.

It asks all the questions, I filled everything in, it still isn't showing up in the plugin section of my admin panel on WP and I'm not seeing the files in the plg root that I would expect for a wordpress plugin. Actually, come to think of it, how does it know it's for Wordpress and not Joomla without me specifying that? With "task" there was differentiation.

hendrikbehncke commented 1 week ago

@GenoPeppino did you run the setup-wordpress task afterward? The create:plugin command creates the files in the build folder. To have them in the plugin root folder you need to run task setup-wordpress to make the plugin available in WordPress. https://github.com/yootheme/starter-plugin?tab=readme-ov-file#set-up-the-plugin

GenoPeppino commented 6 days ago

I get the following error when I run task setup-wordpress...

Script YOOtheme\Starter\TaskHelper::run handling the run:task event terminated with an exception

In Finder.php line 592:

The ".../test-three-ytp/wordpress/test_three_ytp" directory does not exist.

task: Failed to run task "setup-wordpress": exit status 1

hendrikbehncke commented 5 days ago

@GenoPeppino setup-wordpress has two copy steps. First it copies all *.php file from build/wordpress to dist/wordpressand replaces placeholders. Then all files in dist/wordpress are copied to the plugin root folder.

I'm not sure where the path ../test-three-ytp/wordpress/test_three_ytp is could be coming from? Are you on the latest version? Please also ensure you are also using the latest starter-utils. The dependencies can be update with the composer update command

GenoPeppino commented 5 days ago

@GenoPeppino setup-wordpress has two copy steps. First it copies all *.php file from build/wordpress to dist/wordpressand replaces placeholders. Then all files in dist/wordpress are copied to the plugin root folder.

I'm not sure where the path ../test-three-ytp/wordpress/test_three_ytp is could be coming from? Are you on the latest version? Please also ensure you are also using the latest starter-utils. The dependencies can be update with the composer update command

To the best of my understanding. composer update in the root didn't change anything.

Please note a mistake in the path I shared (accidentally removed dist). Mine is basically the same as the one in the initial question from @Taimurian

".../wp-content/plugins/my-plugin/dist/wordpress/my-plugin" directory does not exist.

Full error message:

task: [utils:copy] composer run:task -q -- copy '*.php' dist/wordpress/test_ninety_ytp Copied 0 files to 'dist/wordpress/test_ninety_ytp' task: [utils:placeholder] composer run:task -q -- placeholder dist/wordpress/test_ninety_ytp/test_ninety_ytp.php '{"AUTHOR":"None","AUTHOREMAIL":"none@poorup.com","AUTHORURL":"http://poorup.com","COPYRIGHT":"Copyright (C)","DATE":"2024-11-20","DESCRIPTION":"test ninety plugin description","LICENSE":"GNU General Public License","NAME":"test_ninety_ytp","PHPMINIMUM":"7.4","UPDATEHOST":"","UPDATEURI":"","VERSION":"0.0.1","WORDPRESSMINIMUM":"6.2"}' task: [utils:copy] composer run:task -q -- copy '**' ./ Script YOOtheme\Starter\TaskHelper::run handling the run:task event terminated with an exception

In Finder.php line 592:

The ".../wp-content/plugins/test-ninety-ytp/dist/wordpress/test_ninety_ytp" directory does not exist.

run:task [--dev] [--no-dev] [--] [...]

task: Failed to run task "setup-wordpress": exit status 1

hendrikbehncke commented 4 days ago

task: [utils:copy] composer run:task -q -- copy '*.php' dist/wordpress/test_ninety_ytp Copied 0 files to 'dist/wordpress/test_ninety_ytp'

It looks like the plugin files weren't created in the build folder? After you run composer create:plugin you should see the file structure like here: https://github.com/yootheme/starter-plugin?tab=readme-ov-file#create-a-new-plugin

GenoPeppino commented 4 days ago

task: [utils:copy] composer run:task -q -- copy '*.php' dist/wordpress/test_ninety_ytp Copied 0 files to 'dist/wordpress/test_ninety_ytp'

It looks like the plugin files weren't created in the build folder? After you run composer create:plugin you should see the file structure like here: https://github.com/yootheme/starter-plugin?tab=readme-ov-file#create-a-new-plugin

That's not what I'm seeing. Here are the differences:

├── build
│   ├── joomla
│       ├── plugin.stub
│       ├── plugin.xml
│   ├── wordpress
│       ├── plugin.stub
│   └── Taskfile.yml

In this order I ran the following: composer create-project yootheme/starter-plugin test-ninety-ytp (no errors) navigate to new plugin root directory composer create:plugin (questions asked, questions answered) task setup-wordpress (error shown above)

While my error matches the first one reported, NOTE the difference: '{"AUTHOR":"None","AUTHOREMAIL":"none@poorup.com","AUTHORURL":"http://poorup.com","COPYRIGHT":"Copyright (C)","DATE":"2024-11-20","DESCRIPTION":"test ninety plugin description","LICENSE":"GNU General Public License","NAME":"test_ninety_ytp","PHPMINIMUM":"7.4","UPDATEHOST":"","UPDATEURI":"","VERSION":"0.0.1","WORDPRESSMINIMUM":"6.2"}'

This shows that Author, author URL, description, etc were all filled in during the create:plugin process. So it did run, and I didn't see any errors.