From b2704792494f80ef2296b9c85757cb3bca4bec10 Mon Sep 17 00:00:00 2001 From: npldevfr Date: Tue, 30 Jan 2024 15:34:33 +0100 Subject: [PATCH] fix: scripts --- composer.json | 114 ++++++++++++++++++++++++--------------------- scripts/release.sh | 12 +++-- 2 files changed, 68 insertions(+), 58 deletions(-) diff --git a/composer.json b/composer.json index 574ba23..518a6bc 100644 --- a/composer.json +++ b/composer.json @@ -1,57 +1,63 @@ { - "name": "npldevfr/liquipedia-client", - "description": "A PHP client for the Liquipedia v3 API", - "keywords": ["php", "liquipedia", "mediawiki", "api", "client"], - "license": "MIT", - "version": "0.0.5", - "authors": [ - { - "name": "npldev", - "email": "nplvdev@kcn.gg" - } - ], - "require": { - "php": "^8.2.0", - "guzzlehttp/guzzle": "^7.0" - }, - "require-dev": { - "laravel/pint": "^1.13.7", - "pestphp/pest": "^2.28.1", - "phpstan/phpstan": "^1.10.50", - "rector/rector": "^0.19.2", - "symfony/var-dumper": "^6.4.0|^7.0.0" - }, - "autoload": { - "psr-4": { - "Npldevfr\\Liquipedia\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/" - } - }, - "minimum-stability": "stable", - "prefer-stable": true, - "config": { - "sort-packages": true, - "preferred-install": "dist", - "allow-plugins": { - "pestphp/pest-plugin": true - } - }, - "scripts": { - "refacto": "rector", - "lint": "pint", - "test:refacto": "rector --dry-run", - "test:lint": "pint --test", - "test:types": "phpstan analyse --ansi", - "test:unit": "pest", - "test": [ - "@test:refacto", - "@test:lint", - "@test:types", - "@test:unit" - ] + "name": "npldevfr/liquipedia-client", + "description": "A PHP client for the Liquipedia v3 API", + "keywords": [ + "php", + "liquipedia", + "mediawiki", + "api", + "client" + ], + "license": "MIT", + "version": "1.2.0", + "authors": [ + { + "name": "npldev", + "email": "nplvdev@kcn.gg" } + ], + "require": { + "php": "^8.2.0", + "guzzlehttp/guzzle": "^7.0" + }, + "require-dev": { + "laravel/pint": "^1.13.7", + "pestphp/pest": "^2.28.1", + "phpstan/phpstan": "^1.10.50", + "rector/rector": "^0.19.2", + "symfony/var-dumper": "^6.4.0|^7.0.0" + }, + "autoload": { + "psr-4": { + "Npldevfr\\Liquipedia\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "minimum-stability": "stable", + "prefer-stable": true, + "config": { + "sort-packages": true, + "preferred-install": "dist", + "allow-plugins": { + "pestphp/pest-plugin": true + } + }, + "scripts": { + "refacto": "rector", + "lint": "pint", + "test:refacto": "rector --dry-run", + "test:lint": "pint --test", + "test:types": "phpstan analyse --ansi", + "test:unit": "pest", + "test": [ + "@test:refacto", + "@test:lint", + "@test:types", + "@test:unit" + ] + } } diff --git a/scripts/release.sh b/scripts/release.sh index 5d7c38b..8fd8dbf 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -7,7 +7,8 @@ if [ $# -eq 0 ]; then fi # Get the current version from your composer.json -currentVersion=$(jq -r .version composer.json) +composerJson="./composer.json" +currentVersion=$(jq -r .version "$composerJson") # Function to increment the version in the format 0.0.0 incrementVersion() { @@ -28,13 +29,16 @@ incrementVersion() { # Use the provided version or increment the current version if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - newVersion="v$1" + newVersion="$1" else - newVersion="v$(incrementVersion "$currentVersion")" + newVersion="$(incrementVersion "$currentVersion")" fi +# Update the version in composer.json +jq ".version = \"$newVersion\"" "$composerJson" > "$composerJson.tmp" && mv "$composerJson.tmp" "$composerJson" + # Display the new version -echo "Creating a new release for $(jq -r .name composer.json)..." +echo "Creating a new release for $(jq -r .name "$composerJson")..." echo "Current version: $currentVersion" echo "New version: $newVersion"