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

Tools extracted from composer.json into vendor-bin #122

Merged
merged 8 commits into from
Jan 16, 2024
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
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
uses: ./.github/actions/php
- name: Check package versions
run: |
./vendor/bin/monorepo-builder validate
composer run-script monorepo-builder
- name: Check unused packages
run: |
./vendor/bin/composer-unused
composer run-script composer-unused

dependencies-package:
name: Dependencies checks
Expand Down Expand Up @@ -64,9 +64,8 @@ jobs:
with:
working-directory: ${{ needs.settings.outputs.packages-directory }}/${{ matrix.package }}
- name: Check unused packages
working-directory: ${{ needs.settings.outputs.packages-directory }}/${{ matrix.package }}
run: |
../../vendor/bin/composer-unused
composer run-script composer-unused -- "${{ needs.settings.outputs.packages-directory }}/${{ matrix.package }}/composer.json"

phpcs:
name: PHP CodeSniffer
Expand All @@ -78,7 +77,7 @@ jobs:
uses: ./.github/actions/php
- name: Execute
run: |
./vendor/bin/phpcs --report=checkstyle | cs2pr
composer run-script phpcs -- --report=checkstyle | cs2pr

phpstan:
name: PHPStan
Expand All @@ -90,7 +89,7 @@ jobs:
uses: ./.github/actions/php
- name: Execute
run: |
./vendor/bin/phpstan analyse
composer run-script phpstan -- --error-format=checkstyle | cs2pr

phpunit:
name: Tests
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# General
/node_modules
/vendor
/vendor-bin/**/vendor
/tmp
/.phpunit
/.vagrant
Expand All @@ -26,5 +27,5 @@ Thumbs.db
.history/*

# Project
composer.lock
Vagrant.yml
/composer.lock
/Vagrant.yml
43 changes: 20 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,14 @@
},
"require-dev": {
"ext-pdo_sqlite": "*",
"bamarni/composer-bin-plugin": "^1.8",
"composer/class-map-generator": "^1.0",
"icanhazstring/composer-unused": "^0.8.10",
"laravel/scout": "^9.8.0|^10.0.0",
"mockery/mockery": "^1.6.2",
"nikic/php-parser": "^4.18|^5.0",
"larastan/larastan": "2.8.0",
"orchestra/testbench": "^8.0.0",
"phpstan/phpstan": "1.10.55",
"phpstan/phpstan-mockery": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.1.0",
"phpunit/phpunit": "^10.1.0",
"slevomat/coding-standard": "^8.12.0",
"spaze/phpstan-disallowed-calls": "^3.0.0",
"squizlabs/php_codesniffer": "^3.7.1",
"symfony/var-dumper": "^6.3.0",
"symplify/monorepo-builder": "^11.0.0"
"symfony/var-dumper": "^6.3.0"
},
"suggest": {
"ext-fileinfo": "Required for league/flysystem",
Expand Down Expand Up @@ -127,11 +118,7 @@
"LastDragon_ru\\LaraASP\\Dev\\App\\": "dev/App",
"LastDragon_ru\\LaraASP\\Dev\\PhpStan\\": "dev/PhpStan",
"Larastan\\Larastan\\": "dev/Larastan"
},
"exclude-from-classmap": [
"vendor/larastan/larastan/src/ReturnTypes/ContainerArrayAccessDynamicMethodReturnTypeExtension.php",
"vendor/larastan/larastan/src/ReturnTypes/ContainerMakeDynamicReturnTypeExtension.php"
]
}
},
"extra": {
"laravel": {
Expand All @@ -143,6 +130,10 @@
"LastDragon_ru\\LaraASP\\Serializer\\Provider",
"LastDragon_ru\\LaraASP\\Documentator\\Provider"
]
},
"bamarni-bin": {
"bin-links": false,
"forward-command": true
}
},
"scripts": {
Expand All @@ -154,21 +145,27 @@
"@markdownlint"
],
"validate:dependencies": [
"./vendor/bin/monorepo-builder validate",
"./vendor/bin/composer-unused"
"@monorepo-builder",
"@composer-unused"
],
"phpstan": [
"@php ./vendor/bin/phpstan analyse"
"./vendor-bin/phpstan/vendor/bin/phpstan analyse"
],
"phpunit": [
"@php ./vendor/bin/phpunit"
"./vendor/bin/phpunit"
],
"phpcs": [
"@php ./vendor/bin/phpcs"
"./vendor-bin/phpcs/vendor/bin/phpcs"
],
"markdownlint": [
"npm run markdownlint"
],
"composer-unused": [
"./vendor-bin/composer-unused/vendor/bin/composer-unused unused"
],
"monorepo-builder": [
"./vendor-bin/monorepo-builder/vendor/bin/monorepo-builder validate"
],
"coverage": [
"@php -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-html=.phpunit/coverage.html"
],
Expand All @@ -183,8 +180,8 @@
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"composer/package-versions-deprecated": true
"composer/package-versions-deprecated": true,
"bamarni/composer-bin-plugin": true
}
},
"replace": {
Expand Down
9 changes: 6 additions & 3 deletions packages/documentator/src/Commands/Requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use function count;
use function end;
use function explode;
use function file_get_contents;
use function getcwd;
use function is_array;
use function json_decode;
Expand All @@ -45,7 +46,7 @@
description: 'Generates a table with the required versions of PHP/Laravel in Markdown format.',
)]
class Requirements extends Command {
public const Name = Package::Name.':requirements';
public const Name = Package::Name.':requirements';
private const HEAD = 'HEAD';

/**
Expand Down Expand Up @@ -175,10 +176,12 @@ protected function getPackageInfo(Git $git, string $tag, string $cwd): ?array {
try {
$root = Path::normalize($git->getRoot($cwd));
$path = Path::join($cwd, 'composer.json');
$path = str_starts_with($path, $root)
$gitPath = str_starts_with($path, $root)
? mb_substr($path, mb_strlen($root) + 1)
: $path;
$package = $git->getFile($path, $tag, $cwd);
$package = $tag !== self::HEAD
? $git->getFile($gitPath, $tag, $cwd)
: (string) file_get_contents($path);
$package = json_decode($package, true, flags: JSON_THROW_ON_ERROR);

assert(is_array($package));
Expand Down
22 changes: 11 additions & 11 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ parameters:

includes:
# Vendor
- ./vendor/phpstan/phpstan/conf/bleedingEdge.neon
- ./vendor/phpstan/phpstan-mockery/extension.neon
- ./vendor/phpstan/phpstan-phpunit/extension.neon
- ./vendor/phpstan/phpstan-phpunit/rules.neon
- ./vendor/phpstan/phpstan-strict-rules/rules.neon
- ./vendor/larastan/larastan/extension.neon
- ./vendor/spaze/phpstan-disallowed-calls/extension.neon
- ./vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- ./vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
- ./vendor/spaze/phpstan-disallowed-calls/disallowed-insecure-calls.neon
- ./vendor/spaze/phpstan-disallowed-calls/disallowed-loose-calls.neon
- ./vendor-bin/phpstan/vendor/phpstan/phpstan/conf/bleedingEdge.neon
- ./vendor-bin/phpstan/vendor/phpstan/phpstan-mockery/extension.neon
- ./vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
- ./vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon
- ./vendor-bin/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
- ./vendor-bin/phpstan/vendor/larastan/larastan/extension.neon
- ./vendor-bin/phpstan/vendor/spaze/phpstan-disallowed-calls/extension.neon
- ./vendor-bin/phpstan/vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- ./vendor-bin/phpstan/vendor/spaze/phpstan-disallowed-calls/disallowed-execution-calls.neon
- ./vendor-bin/phpstan/vendor/spaze/phpstan-disallowed-calls/disallowed-insecure-calls.neon
- ./vendor-bin/phpstan/vendor/spaze/phpstan-disallowed-calls/disallowed-loose-calls.neon

# Package
- ./dev/PhpStan/Container/extension.neon
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
colors="true">
<testsuites>
<testsuite name="dev">
<directory suffix="Test.php">./dev</directory>
<directory suffix="Test.php">./dev/App</directory>
</testsuite>
<testsuite name="core">
<directory suffix="Test.php">./packages/core/src</directory>
Expand Down
5 changes: 5 additions & 0 deletions vendor-bin/composer-unused/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"icanhazstring/composer-unused": "^0.8.11"
}
}
Loading
Loading