WebDevStudios / custom-post-type-ui

Admin UI settings for creating custom post types and taxonomies in WordPress
https://webdevstudios.com
GNU General Public License v2.0
627 stars 143 forks source link

Composer installation not working #798

Closed OzzyTheGiant closed 2 years ago

OzzyTheGiant commented 3 years ago

Been trying to get composer to install the plugin into a wordpress project managed by composer. When running composer update, it keeps telling me there is either a typo, not available in a stable enough version or did not add custom repository. Here's part of my composer.json file:

{
    "extra": {
        "installer-paths": {
            "wp-content/plugins/{$name}/": [
                "type:wordpress-plugin"
            ],
            "wp-content/themes/{$name}/": [
                "type:wordpress-theme"
            ]
        },
        "wordpress-install-dir": "wordpress",
        "repositories": [
            {
                "type": "composer",
                "url": "https://wpackagist.org"
            },
            {
                "type": "vcs",
                "url": "https://github.com/webdevstudios/custom-post-type-ui.git"
            }
        ]
    },
    "require": {
        "johnpbloch/wordpress": ">=5.6",
        "vlucas/phpdotenv": "^5.2",
        "elliotcondon/acf": "^4.4",
        "airesvsg/acf-to-rest-api": "^3.3",
        "webdevstudios/custom-post-type-ui": "1.8.2"
    }
}

Even tried using minimum-stability property as dev and nothing works.

tw2113 commented 3 years ago

Looks like your version is trying to pull from https://packagist.org which we don't have CPTUI on https://packagist.org/?query=webdevstudios

However, it would be available via https://wpackagist.org via: composer require wpackagist-plugin/custom-post-type-ui:1.8.2

Hope this helps.

OzzyTheGiant commented 3 years ago

Ahh, suddenly it all makes sense. I couldn't find the plugin because I typed it in with spaces so I assumed it didn't exist there, but I had to hyphenate it: custom-post-type-ui. Managed to find all the other plugins this way.

Either way, still doesn't work. Same error :/

Composer version: 2.0.8

Current composer.json:

{
    "require": {
        "johnpbloch/wordpress": ">=5.6",
        "vlucas/phpdotenv": "^5.2",
        "airesvsg/acf-to-rest-api": "^3.3",
        "wpackagist-plugin/advanced-custom-fields": "5.9.3",
        "wpackagist-plugin/custom-post-type-ui": "1.8.2",
        "wpackagist-plugin/wp-revisions-control": "1.3.0"
    },
    "extra": {
        "installer-paths": {
            "wp-content/plugins/{$name}/": [
                "type:wordpress-plugin"
            ],
            "wp-content/themes/{$name}/": [
                "type:wordpress-theme"
            ]
        },
        "wordpress-install-dir": "wordpress",
        "repositories": [
            {
                "type": "composer",
                "url": "https://wpackagist.org",
                "only": [
                    "wpackagist-plugin/*",
                    "wpackagist-theme/*"
                ]
            }
        ]
    }
}
tw2113 commented 3 years ago

Best I maybe have at the moment is the Composer 2.x detail. My test earlier worked just fine with 1.x and I haven't reviewed recently what's changing for process between 1.x and 2.x. I'd need to do some trial/error there as well as reviewing upgrade processes.

emilse-webdev commented 2 years ago

Hi, Here my findings:

1- webdevstudios/custom-post-type-ui package is added correctly with either composer 1 or composer 2, but when it clones the code, the folder is empty

image

My composer file for this test: { "name": "azulblanco/wp-content", "description": "Testing local site", "repositories": [ { "type": "composer", "url": "https://wpackagist.org" }, { "type": "vcs", "url": "https://github.com/WebDevStudios/custom-post-type-ui.git" } ], "require": { "perfopsone/decalog": "^3.0", "webdevstudios/custom-post-type-ui": "1.12.1" }, "require-dev": { "monolog/monolog": "2.x-dev" }, "license": "MTL", "authors": [], "minimum-stability": "dev", "config": { "allow-plugins": { "composer/installers": true } } }

2- CPTui is not listed in packagist,

image

3- The package needs to be added by composer with prior requisite of adding the repositories section in composer.json and specifying the git repository of CPTui.

"repositories": [ ... { "type": "vcs", "url": "https://github.com/WebDevStudios/custom-post-type-ui.git" } ],

tw2113 commented 2 years ago

I'm marking this as wontfix as we don't have CPTUI on packagist.org and wpackagist.org is just fine at the moment.