Skip to content

Commit

Permalink
Merge pull request #89 from localheinz/feature/scripts-descriptions
Browse files Browse the repository at this point in the history
Enhancement: Sort scripts-descriptions
  • Loading branch information
localheinz committed Oct 10, 2018
2 parents 3c81b21 + bc79f71 commit cd7c78c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/Normalizer/ConfigHashNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ final class ConfigHashNormalizer implements Normalizer\NormalizerInterface
private static $properties = [
'config',
'extra',
'scripts-descriptions',
];

public function normalize(string $json): string
Expand Down
12 changes: 12 additions & 0 deletions test/Unit/Normalizer/ComposerJsonNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/Unit/Normalizer/ConfigHashNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private function properties(): array
return [
'config',
'extra',
'scripts-descriptions',
];
}
}

0 comments on commit cd7c78c

Please sign in to comment.