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

Fix: Update README.md #859

Merged
merged 1 commit into from
Dec 29, 2021
Merged
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
68 changes: 1 addition & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The `NormalizeCommand` provided by the `NormalizePlugin` within this package wil

- determine whether a `composer.json` exists
- determine whether a `composer.lock` exists, and if so, whether it is up to date (unless the `--no-check-lock` option is used)
- use [normalizers](https://github.com/ergebnis/composer-normalize#normalizers) to normalize the content of `composer.json`
- use [`Ergebnis\Json\Normalizer\Vendor\Composer\ComposerJsonNormalizer`](https://github.com/ergebnis/json-normalizer#vendorcomposercomposerjsonnormalizer) to normalize the content of `composer.json`
- format the normalized content (either as sniffed, or as specified using the `--indent-size` and `--indent-style` options)
- write the normalized and formatted content of `composer.json` back to the file
- update the hash in `composer.lock` if it exists and if an update is necessary
Expand Down Expand Up @@ -159,72 +159,6 @@ composer normalize --dry-run
In case `composer.json` is not normalized (or `composer.lock` is not up-to-date), the command will
fail with an exit code of `1` and show a diff.

## Normalizers

The `ComposerJsonNormalizer` composes normalizers provided by [`ergebnis/json-normalizer`](https://github.com/ergebnis/json-normalizer):

- [`Ergebnis\Json\Normalizer\ChainNormalizer`](https://github.com/ergebnis/json-normalizer#chainnormalizer)
- [`Ergebnis\Json\Normalizer\SchemaNormalizer`](https://github.com/ergebnis/json-normalizer#schemanormalizer)

as well as the following normalizers provided by this package:

- [`Ergebnis\Composer\Json\Normalizer\BinNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#binnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\ConfigHashNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#confighashnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\PackageHashNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#packagehashnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\VersionConstraintNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#versionconstraintnormalizer)

### `BinNormalizer`

If `composer.json` contains an array of scripts in the `bin` section, the `BinNormalizer` will sort the elements of the `bin` section by value in ascending order.

:bulb: Find out more about the `bin` section at https://getcomposer.org/doc/04-schema.md#bin.

### `ConfigHashNormalizer`

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.

:bulb: Find out more about the `config` section at https://getcomposer.org/doc/06-config.md.

### `PackageHashNormalizer`

If `composer.json` contains any configuration in the

- `conflict`
- `provide`
- `replace`
- `require`
- `require-dev`
- `suggest`

sections, the `PackageHashNormalizer` will sort the content of these sections.

:bulb: This transfers the behaviour from using the `--sort-packages` or `sort-packages` configuration flag to other sections. Find out more about the `--sort-packages` flag and configuration at https://getcomposer.org/doc/06-config.md#sort-packages and https://getcomposer.org/doc/03-cli.md#require.

### `VersionConstraintNormalizer`

If `composer.json` contains version constraints in the

- `conflict`
- `provide`
- `replace`
- `require`
- `require-dev`

sections, the `VersionConstraintNormalizer` will ensure that

- all constraints are trimmed
- *and- constraints are separated by a single space (` `) or a comma (`,`)
- *or- constraints are separated by double-pipe with a single space before and after (` || `)
- *range- constraints are separated by a single space (` `)

:bulb: Find out more about version constraints at https://getcomposer.org/doc/articles/versions.md.

## Examples

### `pestphp/pest`
Expand Down