Skip to content

Commit c549d23

Browse files
committed
Initial commit
0 parents  commit c549d23

13 files changed

+454
-0
lines changed

.gitattributes

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Auto-detect text files, ensure they use LF.
2+
* text=auto eol=lf
3+
4+
# These files are always considered text and should use LF.
5+
# See core.whitespace @ http://git-scm.com/docs/git-config for whitespace flags.
6+
*.php text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php
7+
*.json text eol=lf whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
8+
9+
# Ignore these files in GitHub dists and `git archive` actions.
10+
/.gitattributes export-ignore
11+
/.gitignore export-ignore
12+
/.travis.yml export-ignore
13+
/.php_cs export-ignore
14+
/phpunit.xml.dist export-ignore
15+
/tests export-ignore
16+
/.github export-ignore

.github/CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Contributing to composer/metadata-minifier
2+
==========================================
3+
4+
Please note that this project is released with a
5+
[Contributor Code of Conduct](http://contributor-covenant.org/version/1/4/).
6+
By participating in this project and its community you agree to abide by those terms.
7+
8+
Reporting Issues
9+
----------------
10+
11+
When reporting issues, please try to be as descriptive as possible, and include
12+
as much relevant information as you can. A step by step guide on how to
13+
reproduce the issue will greatly increase the chances of your issue being
14+
resolved in a timely manner.
15+
16+
Contributing Policy
17+
-------------------
18+
19+
Fork the project, create a feature branch, and send us a pull request.
20+
21+
To ensure a consistent code base, you should make sure the code follows
22+
the [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/).
23+
24+
If you would like to help, take a look at the [list of issues](https://github.com/composer/metadata-minifier/issues).
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
env:
8+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
9+
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
10+
11+
jobs:
12+
tests:
13+
name: "CI"
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
php-version:
20+
- "5.3"
21+
- "5.4"
22+
- "5.5"
23+
- "5.6"
24+
- "7.0"
25+
- "7.1"
26+
- "7.2"
27+
- "7.3"
28+
- "7.4"
29+
- "8.0"
30+
- "8.1"
31+
32+
steps:
33+
- name: "Checkout"
34+
uses: "actions/checkout@v2"
35+
36+
- name: "Install PHP"
37+
uses: "shivammathur/setup-php@v2"
38+
with:
39+
coverage: "none"
40+
php-version: "${{ matrix.php-version }}"
41+
42+
- name: Get composer cache directory
43+
id: composercache
44+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
45+
46+
- name: Cache dependencies
47+
uses: actions/cache@v2
48+
with:
49+
path: ${{ steps.composercache.outputs.dir }}
50+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
51+
restore-keys: ${{ runner.os }}-composer-
52+
53+
- name: "Install latest dependencies"
54+
run: |
55+
# Remove PHPStan as it requires a newer PHP
56+
composer remove phpstan/phpstan --dev --no-update
57+
composer update ${{ env.COMPOSER_FLAGS }}
58+
59+
- name: "Run tests"
60+
run: "vendor/bin/simple-phpunit --verbose"

.github/workflows/lint.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "PHP Lint"
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
tests:
9+
name: "Lint"
10+
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php-version:
16+
- "5.3"
17+
- "8.0"
18+
19+
steps:
20+
- name: "Checkout"
21+
uses: "actions/checkout@v2"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
29+
- name: "Lint PHP files"
30+
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"

.github/workflows/phpstan.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "PHPStan"
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
env:
8+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
9+
SYMFONY_PHPUNIT_VERSION: ""
10+
11+
jobs:
12+
tests:
13+
name: "PHPStan"
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
php-version:
20+
# pinned to 7.4 because we need PHPUnit 7.5 which does not support PHP 8
21+
- "7.4"
22+
23+
steps:
24+
- name: "Checkout"
25+
uses: "actions/checkout@v2"
26+
27+
- name: "Install PHP"
28+
uses: "shivammathur/setup-php@v2"
29+
with:
30+
coverage: "none"
31+
php-version: "${{ matrix.php-version }}"
32+
33+
- name: Get composer cache directory
34+
id: composercache
35+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- name: Cache dependencies
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.composercache.outputs.dir }}
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
42+
restore-keys: ${{ runner.os }}-composer-
43+
44+
- name: "Install latest dependencies"
45+
run: "composer update ${{ env.COMPOSER_FLAGS }}"
46+
47+
- name: Run PHPStan
48+
# Locked to phpunit 7.5 here as newer ones have void return types which break inheritance
49+
run: |
50+
composer require --dev phpunit/phpunit:^7.5.20 --with-all-dependencies ${{ env.COMPOSER_FLAGS }}
51+
vendor/bin/phpstan analyse

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vendor/
2+
composer.lock
3+
.php_cs.cache
4+
build/
5+
.phpunit.result.cache

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (C) 2021 Composer
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
composer/metadata-minifier
2+
==========================
3+
4+
Small utility library that handles metadata minification and expansion.
5+
6+
This is used by [Composer](https://github.com/composer/composer)'s 2.x repository metadata protocol.
7+
8+
9+
Installation
10+
------------
11+
12+
Install the latest version with:
13+
14+
```bash
15+
$ composer require composer/metadata-minifier
16+
```
17+
18+
19+
Requirements
20+
------------
21+
22+
* PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
23+
24+
25+
Basic usage
26+
-----------
27+
28+
### `Composer\MetadataMinifier\MetadataMinifier`
29+
30+
- `MetadataMinifier::expand()`: Expands an array of minified versions back to their original format
31+
- `MetadataMinifier::minify()`: Minifies an array of versions into a set of version diffs
32+
33+
34+
License
35+
-------
36+
37+
composer/metadata-minifier is licensed under the MIT License, see the LICENSE file for details.

composer.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "composer/metadata-minifier",
3+
"description": "Small utility library that handles metadata minification and expansion.",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": [
7+
"compression",
8+
"composer"
9+
],
10+
"authors": [
11+
{
12+
"name": "Jordi Boggiano",
13+
"email": "j.boggiano@seld.be",
14+
"homepage": "http://seld.be"
15+
}
16+
],
17+
"support": {
18+
"issues": "https://github.com/composer/metadata-minifier/issues"
19+
},
20+
"require": {
21+
"php": "^5.3.2 || ^7.0 || ^8.0"
22+
},
23+
"require-dev": {
24+
"symfony/phpunit-bridge": "^4.2 || ^5",
25+
"phpstan/phpstan": "^0.12.55",
26+
"composer/composer": "^2"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"Composer\\MetadataMinifier\\": "src"
31+
}
32+
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"Composer\\Test\\MetadataMinifier\\": "tests"
36+
}
37+
},
38+
"extra": {
39+
"branch-alias": {
40+
"dev-main": "1.x-dev"
41+
}
42+
},
43+
"scripts": {
44+
"test": "SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 vendor/bin/simple-phpunit",
45+
"phpstan": "vendor/bin/phpstan analyse"
46+
}
47+
}

phpstan.neon.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
parameters:
2+
level: 8
3+
paths:
4+
- src
5+
- tests

0 commit comments

Comments
 (0)