Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build improvements #720

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ composer.lock

# OS X
**/.DS_Store

resources/models/raw
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ This README is divided into several sections:
* [Naming conventions](#naming-conventions)
* [API versions](#api-versions)
* [Working with DTOs](#working-with-dtos)
* [Contributing](#contributing)

## Getting Started

Expand Down Expand Up @@ -532,3 +533,37 @@ $response = $ordersApi->confirmShipment(
confirmShipmentRequest: $confirmShipmentRequest,
)
```

## Contributing

To regenerate the library, you can run

# composer clean
# composer build

Composer has a number of pre-configured scripts in `composer.json`:

* `build`: Run all the stages to regenerate the PHP files
* `clean`: Delete all the generated PHP and JSON files
* `lint`: Run PHP-CS-Fixer
* `schema:download`: Download the schemas from Amazon
* `schema:generate`: Generate the PHP files from the schemas
* `schema:refactor`: Make local modifications to the schemas before generation

If you want to generate a specific schema, you can use the `--schema` option:

# composer schema:generate -- --schema=orders

You can also generate just the seller or vendor schemas:

# composer schema:refactor -- --category=seller
# composer schema:generate -- --category=vendor

You can also combine both options:

# composer schema:download -- --schema=orders --category=seller

The schema commands use the underlying `./bin/console` command. To get a list of
available commands, run:

# php ./bin/console list
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
"require": {
"php": ">=8.2",
"ext-curl": "*",
"ext-dom": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"guzzlehttp/guzzle": "^6.0|^7.0",
"saloonphp/saloon": "^3.4",
"openspout/openspout": "^4.23",
Expand Down Expand Up @@ -55,6 +57,13 @@
}
},
"scripts": {
"build": [
"@schema:download",
"@schema:refactor",
"@schema:generate",
"@lint"
],
"clean": "rm -rf src/Vendor src/Seller resources/models/seller resources/models/vendor resources/models/raw",
"lint": [
"@pint",
"@php-compatibility-check"
Expand All @@ -63,6 +72,9 @@
"php-compatibility-check": "./vendor/bin/phpcs -p ./src ./bin --standard=PHPCompatibility --runtime-set testVersion 8.2-",
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"schema:download": "@php bin/console schema:download",
"schema:generate": "@php bin/console schema:generate",
"schema:refactor": "@php bin/console schema:refactor",
"test": "vendor/bin/phpunit"
},
"config": {
Expand Down
2 changes: 0 additions & 2 deletions resources/models/raw/.gitignore

This file was deleted.

Loading