diff --git a/README.md b/README.md index dc78adb2..19a0037c 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ If `composer.json` contains any configuration in the * `config` * `extra` +* `scripts-descriptions` sections, the `ConfigHashNormalizer` will sort the content of these sections by key in ascending order. diff --git a/src/Normalizer/ConfigHashNormalizer.php b/src/Normalizer/ConfigHashNormalizer.php index fe328eda..59bcc506 100644 --- a/src/Normalizer/ConfigHashNormalizer.php +++ b/src/Normalizer/ConfigHashNormalizer.php @@ -23,6 +23,7 @@ final class ConfigHashNormalizer implements Normalizer\NormalizerInterface private static $properties = [ 'config', 'extra', + 'scripts-descriptions', ]; public function normalize(string $json): string diff --git a/test/Unit/Normalizer/ComposerJsonNormalizerTest.php b/test/Unit/Normalizer/ComposerJsonNormalizerTest.php index e7873ada..e12ba7c8 100644 --- a/test/Unit/Normalizer/ComposerJsonNormalizerTest.php +++ b/test/Unit/Normalizer/ComposerJsonNormalizerTest.php @@ -105,6 +105,12 @@ public function testNormalizeNormalizes(): void "@bar" ] }, + "scripts-descriptions": { + "foo": "Executes foo.sh", + "bar": "Executes bar.sh", + "post-install-cmd": "Runs foo", + "pre-install-cmd": "Runs foo and bar" + }, "autoload-dev": { "psr-4": { "Helmut\\Foo\\Bar\\Test\\": "test/" @@ -177,6 +183,12 @@ public function testNormalizeNormalizes(): void "post-install-cmd": "@foo", "bar": "bar.sh", "foo": "foo.sh" + }, + "scripts-descriptions": { + "bar": "Executes bar.sh", + "foo": "Executes foo.sh", + "post-install-cmd": "Runs foo", + "pre-install-cmd": "Runs foo and bar" } } JSON; diff --git a/test/Unit/Normalizer/ConfigHashNormalizerTest.php b/test/Unit/Normalizer/ConfigHashNormalizerTest.php index d697fcfa..0e3cbed7 100644 --- a/test/Unit/Normalizer/ConfigHashNormalizerTest.php +++ b/test/Unit/Normalizer/ConfigHashNormalizerTest.php @@ -106,6 +106,7 @@ private function properties(): array return [ 'config', 'extra', + 'scripts-descriptions', ]; } }