OpenWebconcept / open-government-publications

Import and publish Government Publications through the WordPress REST API.
European Union Public License 1.2
3 stars 2 forks source link

Installeerbaar via composer #7

Closed richardkorthuis closed 1 year ago

richardkorthuis commented 1 year ago

Wij installeren binnen al onze projecten plugins (en thema's) via composer. Als er aan de composer.json van dit project de volgende regel zou worden toegevoegd is de plugin ook via composer te installeren: "type": "wordpress-plugin",

sanderdekroon commented 1 year ago

Added in release 2.7.0.1.

richardkorthuis commented 1 year ago

Even ter aanvulling op mijn comment hier (en uitleg voor mensen die dit issue wellicht zien): Ik bleek niet helemaal goed te hebben gekeken en standaard pakt composer NIET de release, maar doet hij toch een clone van de repo. Wil je dat hij wel echt de release zip pakt dan moet je de url naar die zip opnemen in de composer.json van je website. Dan krijg je dus dit:

{
    "name": "acato/openwebconcept",
    "description": "openwebconcept repository",
    "extra": {
        "wordpress-install-dir": "public_html/wp",
        "installer-paths": {
            "public_html/wp-content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "public_html/wp-content/themes/{$name}": [
                "type:wordpress-theme"
            ],
            "public_html/wp-content/mu-plugins/{$name}": [
                "type:wordpress-muplugin"
            ]
        }
    },
    "repositories": {
        "sudwestfryslan/open-government-publications": {
            "type": "package",
            "package": {
                "type": "wordpress-plugin",
                "name": "sudwestfryslan/open-government-publications",
                "version": "2.0.7.1",
                "dist": {
                    "type": "zip",
                    "url": "https://github.com/OpenWebconcept/open-government-publications/releases/download/2.0.7.1/open-government-publications.zip"
                }
            }
        }
    },
    "require": {
        "composer/installers": "^2.2",
        "johnpbloch/wordpress": "*",
        "sudwestfryslan/open-government-publications": "2.0.7.1"
    }
}

Het grootste nadeel hieraan vind ik dat je bij elke release de composer.json op meerdere plekken moet gaan aanpassen. Dus ik ben op zoek gegaan of dat ook anders kan. En dat blijkt te kunnen als je gebruik maakt van de package openeuropa/composer-artifacts. Daarmee wordt de composer.json van je website dus dit:

{
    "name": "acato/openwebconcept",
    "description": "openwebconcept repository",
    "extra": {
        "wordpress-install-dir": "public_html/wp",
        "installer-paths": {
            "public_html/wp-content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "public_html/wp-content/themes/{$name}": [
                "type:wordpress-theme"
            ],
            "public_html/wp-content/mu-plugins/{$name}": [
                "type:wordpress-muplugin"
            ]
        },
        "artifacts": {
            "sudwestfryslan/open-government-publications": {
                "dist": {
                    "url": "https://github.com/OpenWebconcept/open-government-publications/releases/download/{pretty-version}/open-government-publications.zip",
                    "type": "zip"
                }
            }
        }
    },
    "repositories": {
        "sudwestfryslan/open-government-publications": {
            "type": "github",
            "url": "git@github.com:OpenWebconcept/open-government-publications.git"
        }
    },
    "require": {
        "composer/installers": "^2.2",
        "johnpbloch/wordpress": "*",
        "openeuropa/composer-artifacts": "^0.1.3",
        "sudwestfryslan/open-government-publications": "*"
    }
}