Skip to content

Commit

Permalink
Merge pull request #64 from koriym/vendor-bin
Browse files Browse the repository at this point in the history
Split composer.json
  • Loading branch information
koriym authored Jan 29, 2021
2 parents 92e88c4 + 26f8ea0 commit aea283e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 102 deletions.
68 changes: 0 additions & 68 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,4 @@ Once installed, the project will automatically be configured so you can run thos

## Setup continuous integration

* [Travis CI](https://docs.travis-ci.com/user/getting-started)
* [Scrutinizer](https://scrutinizer-ci.com/docs/)
53 changes: 20 additions & 33 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"name": "koriym/php-skeleton",
"description": "Generic PHP project skeleton package",
"keywords": [
"Skeleton",
"PSR"
],
"keywords": ["Skeleton", "PSR"],
"homepage": "https://github.com/koriym/Koriym.PhpSkeleton",
"license": "MIT",
"authors": [
Expand All @@ -17,14 +14,9 @@
"php": "^7.2 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.5",
"phpmd/phpmd": "^2.9",
"phpstan/phpstan" : "^0.12",
"vimeo/psalm": "^4.1",
"phpmetrics/phpmetrics": "^2.7",
"doctrine/coding-standard": "^8.1",
"composer/composer": "^2.0"
"bamarni/composer-bin-plugin": "^1.4",
"composer/composer": "^2.0",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
Expand All @@ -40,37 +32,32 @@
}
},
"scripts": {
"pre-install-cmd": [
"Koriym\\PhpSkeleton\\Installer::preInstall"
],
"post-install-cmd": [
"Koriym\\PhpSkeleton\\Installer::postInstall"
],
"pre-update-cmd": [
"Koriym\\PhpSkeleton\\Installer::preInstall"
],
"post-create-project-cmd": [
"Koriym\\PhpSkeleton\\Installer::postInstall"
],
"test": ["vendor/bin/phpunit"],
"pre-install-cmd": "Koriym\\PhpSkeleton\\Installer::preInstall",
"post-install-cmd": "Koriym\\PhpSkeleton\\Installer::postInstall",
"pre-update-cmd": "Koriym\\PhpSkeleton\\Installer::preInstall",
"post-create-project-cmd": "Koriym\\PhpSkeleton\\Installer::postInstall",
"setup": "php bin/setup.php",
"test": "./vendor/bin/phpunit",
"coverage": "php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage",
"pcov": "php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml",
"cs": "./vendor/bin/phpcs",
"cs-fix": "./vendor/bin/phpcbf src tests",
"metrics": "./vendor/bin/phpmetrics --report-html=build/metrics --exclude=Exception src",
"clean": ["./vendor/bin/phpstan clear-result-cache", "./vendor/bin/psalm --clear-cache"],
"sa": ["./vendor/bin/phpstan analyse -c phpstan.neon", "psalm --show-info=true"],
"tests": ["@cs", "@sa", "@test"],
"coverage": ["php -dzend_extension=xdebug.so -dxdebug.mode=coverage ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
"pcov": ["php -dextension=pcov.so -d pcov.enabled=1 ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage --coverage-clover=coverage.xml"],
"cs": ["./vendor/bin/phpcs --standard=phpcs.xml src tests"],
"cs-fix": ["./vendor/bin/phpcbf src tests"],
"sa": ["phpstan analyse -c phpstan.neon", "psalm --show-info=true"],
"metrics": ["phpmetrics --report-html=build/metrics --excluded-dirs=src/Exception src"],
"build": ["@cs", "@sa", "@pcov","@metrics"]
"build": ["@clean", "@cs", "@sa", "@pcov", "@metrics"]
},
"scripts-descriptions": {
"test": "Run unit tests",
"tests": "Run tests and quality checks",
"coverage": "Generate test coverage report",
"pcov": "Generate test coverage report (pcov)",
"cs": "Check the coding style",
"cs-fix": "Fix the coding style",
"clean": "Delete tmp files",
"sa": "Run static analysis",
"metrics": "Build metrics report",
"tests": "Run tests and quality checks",
"build": "Build project"
}
}
5 changes: 5 additions & 0 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use function is_callable;
use function is_writable;
use function lcfirst;
use function passthru;
use function preg_match;
use function preg_replace;
use function shell_exec;
Expand Down Expand Up @@ -91,6 +92,8 @@ public static function postInstall(Event $event): void
unlink($skeletonPhp);
unlink($skeletoTest);
unlink(__FILE__);
// install QA tools
passthru(dirname(__DIR__) . '/vendor/bin/composer install');
// run tools
shell_exec(dirname(__DIR__) . '/vendor/bin/phpcbf');
shell_exec(dirname(__DIR__) . '/vendor/bin/composer dump-autoload --quiet');
Expand Down Expand Up @@ -144,6 +147,8 @@ private static function getDefinition(string $vendor, string $package, string $p
];
$composerDefinition['description'] = '';
$composerDefinition['autoload']['psr-4'] = ["{$vendor}\\{$package}\\" => 'src/'];
$composerDefinition['scripts']['post-install-cmd'] = '@composer bin all install --ansi';
$composerDefinition['scripts']['post-update-cmd'] = '@composer bin all update --ansi';

return $composerDefinition;
}
Expand Down
11 changes: 11 additions & 0 deletions vendor-bin/tools/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"require": {
"doctrine/coding-standard": "^8.2",
"phpmd/phpmd": "^2.9",
"phpmetrics/phpmetrics": "^2.7",
"phpstan/phpstan": "^0.12",
"psalm/plugin-phpunit": "^0.13",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.2"
}
}

0 comments on commit aea283e

Please sign in to comment.