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: Laxify schema in place #424

Merged
merged 1 commit into from
May 1, 2020
Merged
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.dependabot/ export-ignore
/.github/ export-ignore
/bin/ export-ignore
/phar/ export-ignore
/test/ export-ignore
/tools/ export-ignore
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,30 @@ jobs:

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout"
uses: "actions/[email protected]"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Download schema"
run: "wget --output-document=resource/schema.json https://getcomposer.org/schema.json"

- name: "Show diff"
run: "git diff resource/schema.json"

- name: "Laxify schema"
run: "php bin/laxify-schema.php"

- name: "Open pull request updating schema"
uses: "gr2m/[email protected]"
with:
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

For a full diff see [`2.5.0...master`][2.5.0...master].
For a full diff see [`2.5.1...master`][2.5.1...master].

## [`2.5.1`][2.5.1]

For a full diff see [`2.5.0...2.5.1`][2.5.0...2.5.1].

### Fixed

* Started updating lock files with a new `Composer\Console\Application` instead of reusing the current instance ([#420]), by [@localheinz]
* Stopped using the deprecated `--no-suggest` option when updating the lock file ([#422]), by [@localheinz]
* Started relaxing schema in place to avoid issues resolving references and the like on Windows ([#424]), by [@localheinz]

## [`2.5.0`][2.5.0]

Expand Down Expand Up @@ -379,6 +384,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[2.3.2]: https://github.com/ergebnis/composer-normalize/releases/tag/2.3.2
[2.4.0]: https://github.com/ergebnis/composer-normalize/releases/tag/2.4.0
[2.5.0]: https://github.com/ergebnis/composer-normalize/releases/tag/2.5.0
[2.5.1]: https://github.com/ergebnis/composer-normalize/releases/tag/2.5.1

[81bc3a8...0.1.0]: https://github.com/ergebnis/composer-normalize/compare/81bc3a8...0.1.0
[0.1.0...0.2.0]: https://github.com/ergebnis/composer-normalize/compare/0.1.0...0.2.0
Expand Down Expand Up @@ -414,7 +420,8 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[2.3.1...2.3.2]: https://github.com/ergebnis/composer-normalize/compare/2.3.1...2.3.2
[2.3.2...2.4.0]: https://github.com/ergebnis/composer-normalize/compare/2.4.0...master
[2.4.0...2.5.0]: https://github.com/ergebnis/composer-normalize/compare/2.4.0...2.5.0
[2.5.0...master]: https://github.com/ergebnis/composer-normalize/compare/2.5.0...master
[2.5.0...2.5.1]: https://github.com/ergebnis/composer-normalize/compare/2.5.0...2.5.1
[2.5.1...master]: https://github.com/ergebnis/composer-normalize/compare/2.5.1...master

[#1]: https://github.com/ergebnis/composer-normalize/pull/1
[#2]: https://github.com/ergebnis/composer-normalize/pull/2
Expand Down Expand Up @@ -467,6 +474,7 @@ For a full diff see [`81bc3a8...0.1.0`][81bc3a8...0.1.0].
[#416]: https://github.com/ergebnis/composer-normalize/pull/416
[#420]: https://github.com/ergebnis/composer-normalize/pull/420
[#422]: https://github.com/ergebnis/composer-normalize/pull/422
[#424]: https://github.com/ergebnis/composer-normalize/pull/424

[@ergebnis]: https://github.com/ergebnis
[@ergebnis-bot]: https://github.com/ergebnis-bot
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ phar: vendor ## Builds a phar with humbug/box
.PHONY: schema
schema: vendor ## Updates the schema
wget --output-document=resource/schema.json https://getcomposer.org/schema.json
php bin/laxify-schema.php

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
Expand Down
27 changes: 27 additions & 0 deletions bin/laxify-schema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

/**
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/

$schemaFile = __DIR__ . '/../resource/schema.json';

$schema = \json_decode(
\file_get_contents($schemaFile),
false
);

$schema->additionalProperties = true;
$schema->required = [];

\file_put_contents($schemaFile, \json_encode(
$schema,
\JSON_PRETTY_PRINT | \JSON_PRESERVE_ZERO_FRACTION | \JSON_UNESCAPED_SLASHES
));
3 changes: 1 addition & 2 deletions box.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
],
"compression": "GZ",
"files": [
"resource/schema.json",
"resource/schema-lax.json"
"resource/schema.json"
],
"git": "git",
"main": "phar/composer-normalize.php",
Expand Down
2 changes: 1 addition & 1 deletion phar/composer-normalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$command = new Normalize\Command\NormalizeCommand(
new Factory(),
new Normalizer\Vendor\Composer\ComposerJsonNormalizer(__DIR__ . '/../resource/schema-lax.json'),
new Normalizer\Vendor\Composer\ComposerJsonNormalizer(__DIR__ . '/../resource/schema.json'),
new Normalizer\Format\Formatter(new Printer\Printer()),
new Diff\Differ(new Diff\Output\StrictUnifiedDiffOutputBuilder([
'fromFile' => 'original',
Expand Down
6 changes: 0 additions & 6 deletions resource/schema-lax.json

This file was deleted.

Loading