Skip to content

Commit

Permalink
Build improvements
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dpash committed Jun 6, 2024
1 parent b94e575 commit 067084b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ composer.lock

# OS X
**/.DS_Store

resources/models/raw
17 changes: 17 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 @@ -540,3 +541,19 @@ $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
14 changes: 13 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
"require": {
"php": ">=8.1",
"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 @@ -54,14 +56,24 @@
}
},
"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"
],
"pint": "php vendor/bin/pint",
"php-compatibility-check": "./vendor/bin/phpcs -p ./src ./bin --standard=PHPCompatibility --runtime-set testVersion 8.1-",
"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"
"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"
},
"config": {
"allow-plugins": {
Expand Down
2 changes: 0 additions & 2 deletions resources/models/raw/.gitignore

This file was deleted.

0 comments on commit 067084b

Please sign in to comment.