Skip to content

Commit 067084b

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
1 parent b94e575 commit 067084b

4 files changed

Lines changed: 32 additions & 3 deletions

File tree

.gitignore

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

2020
# OS X
2121
**/.DS_Store
22+
23+
resources/models/raw

README.md

Lines changed: 17 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

@@ -540,3 +541,19 @@ $response = $ordersApi->confirmShipment(
540541
confirmShipmentRequest: $confirmShipmentRequest,
541542
)
542543
```
544+
545+
## Contributing
546+
547+
To regenerate the library, you can run
548+
549+
# composer clean
550+
# composer build
551+
552+
Composer has a number of pre-configured scripts in `composer.json`:
553+
554+
* `build`: Run all the stages to regenerate the PHP files
555+
* `clean`: Delete all the generated PHP and JSON files
556+
* `lint`: Run PHP-CS-Fixer
557+
* `schema:download`: Download the schemas from Amazon
558+
* `schema:generate`: Generate the PHP files from the schemas
559+
* `schema:refactor`: Make local modifications to the schemas before generation

composer.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
"require": {
2424
"php": ">=8.1",
2525
"ext-curl": "*",
26+
"ext-dom": "*",
2627
"ext-json": "*",
2728
"ext-mbstring": "*",
29+
"ext-simplexml": "*",
2830
"guzzlehttp/guzzle": "^6.0|^7.0",
2931
"saloonphp/saloon": "^3.4",
3032
"openspout/openspout": "^4.23",
@@ -54,14 +56,24 @@
5456
}
5557
},
5658
"scripts": {
59+
"build": [
60+
"@schema:download",
61+
"@schema:refactor",
62+
"@schema:generate",
63+
"@lint"
64+
],
65+
"clean": "rm -rf src/Vendor src/Seller resources/models/seller resources/models/vendor resources/models/raw",
5766
"lint": [
5867
"@pint",
5968
"@php-compatibility-check"
6069
],
6170
"pint": "php vendor/bin/pint",
6271
"php-compatibility-check": "./vendor/bin/phpcs -p ./src ./bin --standard=PHPCompatibility --runtime-set testVersion 8.1-",
6372
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
64-
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
73+
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
74+
"schema:download": "@php bin/console schema:download",
75+
"schema:generate": "@php bin/console schema:generate",
76+
"schema:refactor": "@php bin/console schema:refactor"
6577
},
6678
"config": {
6779
"allow-plugins": {

resources/models/raw/.gitignore

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

0 commit comments

Comments
 (0)