From 77a75f5e42b338e7dd93ea510406e77771681609 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 8 Oct 2024 13:01:26 +0200 Subject: [PATCH 1/3] This adds the plugin check action to the plugin --- .distignore | 1 + .github/workflows/plugin-check.yml | 22 ++++++++++++++++++++++ .gitignore | 2 ++ bin/git-release.sh | 12 ++++++++++++ composer.json | 6 +++++- 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/plugin-check.yml create mode 100755 bin/git-release.sh diff --git a/.distignore b/.distignore index 620388a..fa26681 100644 --- a/.distignore +++ b/.distignore @@ -1,6 +1,7 @@ /.wordpress-org /.git /.github +/bin /reports /tests .distignore diff --git a/.github/workflows/plugin-check.yml b/.github/workflows/plugin-check.yml new file mode 100644 index 0000000..7bbe7cc --- /dev/null +++ b/.github/workflows/plugin-check.yml @@ -0,0 +1,22 @@ +name: Plugin Check +on: # rebuild any PRs and main branch changes + pull_request: + push: + branches: + - master + - 'releases/*' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Composer dependencies + run: composer install --no-dev --no-interaction --optimize-autoloader + - name: Build + run: composer run-script build + - name: Run plugin check + uses: wordpress/plugin-check-action@v1 + with: + build-dir: './mslsselect' \ No newline at end of file diff --git a/.gitignore b/.gitignore index a6c6901..5f61134 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ phpunit.xml.bak .idea/ vendor/ coverage/ +mslsselect/ +mslsselect.zip diff --git a/bin/git-release.sh b/bin/git-release.sh new file mode 100755 index 0000000..6628db1 --- /dev/null +++ b/bin/git-release.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +PLUGIN_NAME="mslsselect" +BUILD_PATH="$PROJECT_ROOT/$PLUGIN_NAME" +ZIP_ARCHIVE="$PROJECT_ROOT/$PLUGIN_NAME.zip" + +rm -f $ZIP_ARCHIVE +rm -rf $BUILD_PATH && mkdir $BUILD_PATH + +rsync -arvp --exclude-from=$PROJECT_ROOT/.distignore $PROJECT_ROOT/ $BUILD_PATH/ +cd $PROJECT_ROOT && zip -r $ZIP_ARCHIVE $PLUGIN_NAME diff --git a/composer.json b/composer.json index ac109c2..5c6b539 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,11 @@ "scripts": { "test": "vendor/bin/phpunit", "coverage": "php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-html coverage", - "analyze": "vendor/bin/phpstan analyze" + "analyze": "vendor/bin/phpstan analyze", + "git-release": "bin/git-release.sh", + "build": [ + "@git-release" + ] }, "config": { "allow-plugins": { From cd5e8425f4af0020b5e9ea56674f7100239115b6 Mon Sep 17 00:00:00 2001 From: Dennis Ploetner Date: Tue, 8 Oct 2024 14:14:53 +0200 Subject: [PATCH 2/3] License applied --- MslsSelect.php | 58 ++++++++++++++++++++++++++------------------------ readme.txt | 10 ++++++--- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/MslsSelect.php b/MslsSelect.php index 8b4abda..0445c5f 100644 --- a/MslsSelect.php +++ b/MslsSelect.php @@ -1,31 +1,33 @@ Date: Tue, 8 Oct 2024 14:56:24 +0200 Subject: [PATCH 3/3] Script defer --- MslsSelect.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MslsSelect.php b/MslsSelect.php index 0445c5f..cabb6b4 100644 --- a/MslsSelect.php +++ b/MslsSelect.php @@ -74,7 +74,16 @@ public static function init(): self { * @return void */ public static function enqueue_scripts(): void { - wp_enqueue_script( 'mslsselect', plugins_url( '/js/mslsselect.min.js', __FILE__ ), [], self::VERSION, true ); + wp_enqueue_script( + 'mslsselect', + plugins_url( '/js/mslsselect.min.js', __FILE__ ), + array(), + self::VERSION, + array( + 'in_footer' => true, + 'strategy' => 'defer', + ) + ); } /**