Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during setup-wordpress task #5

Open
Taimurian opened this issue Oct 8, 2024 · 12 comments
Open

Error during setup-wordpress task #5

Taimurian opened this issue Oct 8, 2024 · 12 comments

Comments

@Taimurian
Copy link

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

  • During the composer create-project command, I expected to be prompted for additional plugin metadata (title, description, author, etc.) as described in the documentation.
  • The setup-wordpress task should complete successfully and copy the necessary plugin files from the build folder to the plugin root folder.

Screenshots
X20241008124433

Environment:

  • Yootheme Starter Plugin version: 1.0.3
  • Composer version: 2.7.9
  • PHP version: 8.2.12
  • Operating System: Windows 11 (XAMPP)
@hendrikbehncke
Copy link
Contributor

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
Copy link

esedic commented Nov 7, 2024

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

@hendrikbehncke
Copy link
Contributor

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.

@GenoPeppino
Copy link

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
Copy link
Contributor

hendrikbehncke commented Nov 15, 2024

@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
Copy link

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
Copy link
Contributor

@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
Copy link

@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
Copy link
Contributor

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
Copy link

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.

@GenoPeppino
Copy link

Hey there, any progress?

@hendrikbehncke
Copy link
Contributor

hendrikbehncke commented Jan 7, 2025

I can not replicate the issue?

The files in the build folder are always renamed with the actual plugin name for me when I run composer create:plugin.
Have you tried to start the whole process from scratch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants