Skip to content

Commit

Permalink
Replaced the local repository with root autoload definitions
Browse files Browse the repository at this point in the history
Since Composer can't recursively use repositories, we can't actually use a local package to deal with this. We're going to keep the local package to separate the dependencies but we need to add autoload keys in the root package's `composer.json`
  • Loading branch information
ObliviousHarmony committed Nov 18, 2020
1 parent c9f413d commit e9dfe64
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 82 deletions.
12 changes: 6 additions & 6 deletions bin/composer/wp/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.1.6",
"woocommerce/woocommerce-admin": "1.7.0",
"woocommerce/woocommerce-blocks": "3.8.0",
"woocommerce/woocommerce-lib": "@dev"
"woocommerce/woocommerce-blocks": "3.8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4"
Expand Down Expand Up @@ -54,7 +53,11 @@
"autoload-dev": {
"psr-4": {
"Automattic\\WooCommerce\\Tests\\": "tests/php/src/",
"Automattic\\WooCommerce\\Testing\\Tools\\": "tests/Tools/"
"Automattic\\WooCommerce\\Testing\\Tools\\": "tests/Tools/",
"Automattic\\WooCommerce\\Vendor\\": "lib/packages/"
},
"psr-0": {
"Automattic\\WooCommerce\\Vendor\\": "lib/packages/"
},
"classmap": [
"tests/legacy/unit-tests/rest-api/Helpers"
Expand Down
60 changes: 2 additions & 58 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ Updating a package is as easy as changing the version in `composer.json` and the
If you would like to add a package which does not undergo conflict avoidance you must take steps to ensure it appears in
the root autoloader.

1. Add package to `require` instead of `require-dev` (This allows it to be pulled transitively)
1. Add package to the `require` section of both the `lib/composer.json` and root `composer.json` file instead of `require-dev`
2. Add package slug to `extra/mozart/excluded-packages` section of `composer.json`
3. Run `composer run-script build-lib` from the root directory (You **should not** see the package in `packages/VendorName/PackageName` or `classes`)
16 changes: 3 additions & 13 deletions lib/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,17 @@
"require-dev": {
"league/container": "3.3.3"
},
"autoload": {
"psr-4": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
},
"psr-0": {
"Automattic\\WooCommerce\\Vendor\\": "packages/"
}
},
"config": {
"platform": {
"php": "7.0"
}
},
"scripts": {
"post-install-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
"\"../vendor/bin/mozart\" compose"
],
"post-update-cmd": [
"\"../vendor/bin/mozart\" compose",
"composer dump-autoload"
"\"../vendor/bin/mozart\" compose"
]
},
"extra": {
Expand All @@ -45,7 +35,7 @@
],
"classmap_directory": "/classes/",
"classmap_prefix": "WC_Vendor_",
"delete_vendor_directories": false
"delete_vendor_directories": true
}
}
}
2 changes: 1 addition & 1 deletion lib/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9dfe64

Please sign in to comment.