Skip to content

Commit 136bd29

Browse files
committed
Build improvements
This adds a `build` and `clean` commands to `composer.json` to enable easier discovery of the build process for new developers. Due to the `clean` deleting the raw directory. I've moved the gitignore into the top level `.gitignore`. The available commands are added to the README.md Add single schema generation commands to README We need to explain about the need for `--` in composer commands
1 parent f821b7b commit 136bd29

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ composer.lock
1818

1919
# OS X
2020
**/.DS_Store
21+
22+
resources/models/raw

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This README is divided into several sections:
6767
* [Naming conventions](#naming-conventions)
6868
* [API versions](#api-versions)
6969
* [Working with DTOs](#working-with-dtos)
70+
* [Contributing](#contributing)
7071

7172
## Getting Started
7273

@@ -532,3 +533,37 @@ $response = $ordersApi->confirmShipment(
532533
confirmShipmentRequest: $confirmShipmentRequest,
533534
)
534535
```
536+
537+
## Contributing
538+
539+
To regenerate the library, you can run
540+
541+
# composer clean
542+
# composer build
543+
544+
Composer has a number of pre-configured scripts in `composer.json`:
545+
546+
* `build`: Run all the stages to regenerate the PHP files
547+
* `clean`: Delete all the generated PHP and JSON files
548+
* `lint`: Run PHP-CS-Fixer
549+
* `schema:download`: Download the schemas from Amazon
550+
* `schema:generate`: Generate the PHP files from the schemas
551+
* `schema:refactor`: Make local modifications to the schemas before generation
552+
553+
If you want to generate a specific schema, you can use the `--schema` option:
554+
555+
# composer schema:generate -- --schema=orders
556+
557+
You can also generate just the seller or vendor schemas:
558+
559+
# composer schema:refactor -- --category=seller
560+
# composer schema:generate -- --category=vendor
561+
562+
You can also combine both options:
563+
564+
# composer schema:download -- --schema=orders --category=seller
565+
566+
The schema commands use the underlying `./bin/console` command. To get a list of
567+
available commands, run:
568+
569+
# php ./bin/console list

composer.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
"require": {
2323
"php": ">=8.2",
2424
"ext-curl": "*",
25+
"ext-dom": "*",
2526
"ext-json": "*",
2627
"ext-mbstring": "*",
28+
"ext-simplexml": "*",
2729
"guzzlehttp/guzzle": "^6.0|^7.0",
2830
"saloonphp/saloon": "^3.4",
2931
"openspout/openspout": "^4.23",
@@ -55,6 +57,13 @@
5557
}
5658
},
5759
"scripts": {
60+
"build": [
61+
"@schema:download",
62+
"@schema:refactor",
63+
"@schema:generate",
64+
"@lint"
65+
],
66+
"clean": "rm -rf src/Vendor src/Seller resources/models/seller resources/models/vendor resources/models/raw",
5867
"lint": [
5968
"@pint",
6069
"@php-compatibility-check"
@@ -63,6 +72,9 @@
6372
"php-compatibility-check": "./vendor/bin/phpcs -p ./src ./bin --standard=PHPCompatibility --runtime-set testVersion 8.2-",
6473
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
6574
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
75+
"schema:download": "@php bin/console schema:download",
76+
"schema:generate": "@php bin/console schema:generate",
77+
"schema:refactor": "@php bin/console schema:refactor",
6678
"test": "vendor/bin/phpunit"
6779
},
6880
"config": {

resources/models/raw/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)