wplib / wplib-box

The Best Local Dev Server for WordPress Developers
https://wplib.github.io/box-docs/
MIT License
209 stars 24 forks source link

Use Composer Merge Plugin so composer.json can be split into separate files. #60

Open andreasnrb opened 8 years ago

andreasnrb commented 8 years ago

The composer merge plugin makes it possible to split a Composer.json file into separate files. In my setup I have moved all the core wordpress specific settings into a file called wordpress.json which I stored in composer-extensions. Having separate files also makes it possible to create a package for various composer based setups. For example a woocommerce default package which include woocommerce and some usefull plugins. Or a debug package that adds debug bar and a bunch of addons. composer.json

    "require": {
        "composer/installers": "1.*",
        "wikimedia/composer-merge-plugin": "dev-master"
    },
    "extra": {
        "merge-plugin": {
            "require": [
                "composer-extensions/wordpress.json"
// Since I use yeoman generator for this I have an option to use wplib or not. If yes following is added
//              "composer-extensions/wplib.json"
            ],
            "recurse": true,
            "replace": false,
            "merge-dev": true,
            "merge-extra": true
        }
    },

composer-extensions/wordpress.json

{
    "require": {
        "wpackagist-theme/twentysixteen": "1.*",
        "johnpbloch/wordpress": "4.*",
        "wpackagist-plugin/wp-redis": "0.2.2",
        "wpackagist-plugin/query-monitor": "2.10.0",
        "wpackagist-plugin/helpful-information": "1.0.2"
    },
    "extra": {
        "wordpress-install-dir": "www/wp",
        "installer-paths": {
            "www/content/mu-plugins/{$name}": [
                "type:wordpress-library",
                "type:wordpress-muplugin",
                "wpackagist-plugin/wp-redis"
            ],
            "www/content/plugins/{$name}": [
                "type:wordpress-plugin"
            ],
            "www/content/themes/{$name}": [
                "type:wordpress-theme"
            ]
        }
    }
}

composer-extension/wplib.json

{
    "repositories": [{
        "type": "git",
        "url": "http://github.org/wplib/wplib"
    }],
    "require": {
        "wplib/wplib": "0.12.2"
    }
}
mikeschinkel commented 8 years ago

@andreasnrb Does this solve this problem?

clubdeuce commented 8 years ago

@andreasnrb @mikeschinkel What is the status of this ticket? Are we moving forward this or can it be closed?

mikeschinkel commented 8 years ago

@clubdeuce I am thinking yes, but we need to verify with a solid use-case first. So we can leave the ticket here until we stumble across the use-case?