diff --git a/.github/workflows/tasks.yml b/.github/workflows/tasks.yml new file mode 100644 index 0000000..6b25d01 --- /dev/null +++ b/.github/workflows/tasks.yml @@ -0,0 +1,34 @@ +name: Tasks + +on: [push, pull_request] + +jobs: + lint-php: + name: "php: ${{ matrix.php }} TYPO3: ${{ matrix.typo3 }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [ '7.4', '8.0', '8.1' ] + typo3: [ '10', '11' ] + exclude: + - php: '8.0' + typo3: '10' + - php: '8.1' + typo3: '10' + steps: + - name: Setup PHP with PECL extension + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.php }}-composer- + - run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev + - run: composer install --no-interaction --no-progress + - run: ./vendor/bin/grumphp run --ansi + diff --git a/.gitignore b/.gitignore index 9f11b75..c34116b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .idea/ +vendor +public +composer.lock diff --git a/Classes/Middleware/MinifyMiddleware.php b/Classes/Middleware/MinifyMiddleware.php index be72e0f..947bc3f 100644 --- a/Classes/Middleware/MinifyMiddleware.php +++ b/Classes/Middleware/MinifyMiddleware.php @@ -31,6 +31,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface $html = $body->getContents(); $minifyService = GeneralUtility::makeInstance(MinifyService::class); + assert($minifyService instanceof MinifyService); $html = $minifyService->minify($html); $body = new Stream('php://temp', 'wb+'); $body->write($html); @@ -38,5 +39,4 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface } return $response; } - } diff --git a/composer.json b/composer.json index 876b313..c84cbbd 100644 --- a/composer.json +++ b/composer.json @@ -1,19 +1,42 @@ { - "name": "pluswerk/minify", - "type": "typo3-cms-extension", - "description": "Pluswerk: Minify - Minifies your html", - "homepage": "https://www.pluswerk.ag", - "license": "GPL-2.0-or-later", - "support": { - "source": "https://www.pluswerk.ag" + "name" : "pluswerk/minify", + "type" : "typo3-cms-extension", + "description" : "Pluswerk: Minify - Minifies your html", + "homepage" : "https://www.pluswerk.ag", + "license" : "GPL-2.0-or-later", + "support" : { + "source" : "https://github.com/pluswerk/minify" }, - "autoload": { - "psr-4": { - "Pluswerk\\PlusMinify\\": "Classes/" + "autoload" : { + "psr-4" : { + "Pluswerk\\PlusMinify\\" : "Classes/" } }, - "require": { - "typo3/cms-core": "^10.4", - "voku/html-min": "*" + "config": { + "allow-plugins": { + "typo3/cms-composer-installers": true, + "typo3/class-alias-loader": true, + "phpro/grumphp": true, + "pluswerk/grumphp-config": true + }, + "sort-packages": true + }, + "extra" : { + "typo3/cms" : { + "extension-key" : "minify" + }, + "pluswerk/grumphp-config": { + "auto-setting": true + }, + "grumphp": { + "config-default-path": "vendor/pluswerk/grumphp-config/grumphp.yml" + } + }, + "require" : { + "php": "~7.4 || ~8.0 || ~8.1", + "composer-runtime-api": "^2", + "pluswerk/grumphp-config": "^5.0", + "typo3/cms-core": "^10.4 || ^11.5", + "voku/html-min": "^4" } } diff --git a/ext_emconf.php b/ext_emconf.php index 601044e..bbedd1a 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,11 +11,11 @@ 'internal' => '', 'uploadfolder' => '0', 'createDirs' => '', - 'clearCacheOnLoad' => 0, - 'version' => '1.1.2', - 'constraints' =>[ + 'clearCacheOnLoad' => false, + 'version' => \Composer\InstalledVersions::getPrettyVersion('pluswerk/minify'), + 'constraints' => [ 'depends' => [ - 'typo3' => '10.99.99', + 'typo3' => '10.4.0 - 11.99.99', ], 'conflicts' => [], 'suggests' => [],