Skip to content

Commit ad413b5

Browse files
committed
Merge branch 'release/6.3.4'
2 parents a2c8035 + 0da1931 commit ad413b5

File tree

15 files changed

+124
-71
lines changed

15 files changed

+124
-71
lines changed

.github/workflows/tests.yml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,45 @@ on:
1212

1313
jobs:
1414
phpcs:
15-
name: PHPCS
16-
runs-on: ubuntu-latest
15+
name: phpcs
16+
runs-on: macos-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php-versions: ['8.1', '8.2', '8.3', '8.4']
1721
steps:
1822
- uses: actions/checkout@v4
1923

20-
- name: Cache Composer dependencies
21-
uses: actions/cache@v2
24+
- name: Setup PHP, with composer and xdebug
25+
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
26+
with:
27+
php-version: ${{ matrix.php-versions }}
28+
coverage: xdebug
29+
30+
- name: Get composer cache directory
31+
id: composer-cache
32+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
33+
34+
- name: Cache composer dependencies
35+
uses: actions/cache@v4
2236
with:
23-
path: /tmp/composer-cache
24-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39+
restore-keys: ${{ runner.os }}-composer-
2540

26-
- uses: php-actions/composer@v5
41+
- name: Install Composer dependencies
42+
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs
2743

2844
- name: PHPCS
29-
run: ./vendor/bin/phpcs
45+
run: composer run lint:style
3046

3147
phpstan:
32-
name: PHPStan
33-
runs-on: ubuntu-latest
48+
name: phpstan
49+
runs-on: macos-latest
3450
strategy:
3551
fail-fast: false
3652
matrix:
37-
php-versions:
38-
- '7.3'
39-
- '7.4'
40-
- '8.0'
41-
- '8.1'
53+
php-versions: ['8.1', '8.2', '8.3', '8.4']
4254
steps:
4355
- uses: actions/checkout@v4
4456

@@ -53,32 +65,36 @@ jobs:
5365
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5466

5567
- name: Cache composer dependencies
56-
uses: actions/cache@v2
68+
uses: actions/cache@v4
5769
with:
5870
path: ${{ steps.composer-cache.outputs.dir }}
5971
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
6072
restore-keys: ${{ runner.os }}-composer-
6173

6274
- name: Install Composer dependencies
63-
run: composer install --no-progress --prefer-dist --optimize-autoloader
75+
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs
6476

6577
- name: PHPStan
66-
run: ./vendor/bin/phpstan
78+
run: composer run lint:static
6779

6880
test:
69-
name: Unit test
7081
runs-on: ubuntu-latest
7182
strategy:
7283
fail-fast: false
7384
matrix:
74-
php-versions:
75-
- '7.3'
76-
- '7.4'
77-
- '8.0'
78-
- '8.1'
85+
php-versions: ['8.1', '8.2', '8.3', '8.4']
86+
env:
87+
PHP_VERSION: ${{ matrix.php-versions }}
7988
steps:
8089
- uses: actions/checkout@v4
8190

91+
- uses: actions/setup-node@v4
92+
with:
93+
node-version: 22
94+
cache: 'npm'
95+
96+
- run: npx bun install
97+
8298
- name: Setup PHP, with composer and xdebug
8399
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
84100
with:
@@ -90,14 +106,18 @@ jobs:
90106
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
91107

92108
- name: Cache composer dependencies
93-
uses: actions/cache@v2
109+
uses: actions/cache@v4
94110
with:
95111
path: ${{ steps.composer-cache.outputs.dir }}
96112
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
97113
restore-keys: ${{ runner.os }}-composer-
98114

99115
- name: Install Composer dependencies
100-
run: composer install --no-progress --prefer-dist --optimize-autoloader
116+
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs
117+
118+
- name: Install Pest v3
119+
run: composer require pest/pest:^3.0
120+
if: ${{ matrix.php-version == '8.4' }}
101121

102122
- name: Pest
103123
run: php -v && XDEBUG_MODE=coverage ./vendor/bin/pest --coverage --coverage-clover='coverage.xml'
@@ -106,7 +126,8 @@ jobs:
106126
uses: codecov/codecov-action@v4
107127
with:
108128
token: ${{ secrets.CODECOV_TOKEN }}
109-
directory: ./coverage.xml
129+
env_vars: PHP_VERSION
130+
file: ./coverage.xml
110131
flags: unittests
111132
fail_ci_if_error: false
112133
verbose: true

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [v6.3.4](https://github.com/studiometa/webpack-config/compare/6.3.3..6.3.4) (2025-05-06)
10+
11+
### Changed
12+
13+
- Replace exceptions by warnings ([#193](https://github.com/studiometa/webpack-config/pull/193), [fe283af](https://github.com/studiometa/webpack-config/commit/fe283af))
14+
915
## [v6.3.3](https://github.com/studiometa/webpack-config/compare/6.3.2..6.3.3) (2025-01-23)
1016

1117
### Changed

composer.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "studiometa/webpack-config",
3-
"version": "6.3.3",
3+
"version": "6.3.4",
44
"description": "PHP Helpers for @studiometa/webpack-config",
55
"type": "library",
66
"require": {
@@ -31,9 +31,16 @@
3131
}
3232
},
3333
"scripts": {
34-
"phpstan": "phpstan",
35-
"phpcs": "phpcs",
36-
"phpcbf": "phpcbf",
34+
"lint": [
35+
"@lint:style",
36+
"@lint:static"
37+
],
38+
"lint:static": "phpstan",
39+
"lint:style": "phpcs",
40+
"fix": [
41+
"@fix:style"
42+
],
43+
"fix:style": "phpcbf",
3744
"pest": "pest"
3845
}
3946
}

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-root",
3-
"version": "6.3.3",
3+
"version": "6.3.4",
44
"private": true,
55
"type": "module",
66
"workspaces": [

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-demo",
3-
"version": "6.3.3",
3+
"version": "6.3.4",
44
"private": true,
55
"type": "module",
66
"scripts": {

packages/php/src/Manifest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,22 @@ class Manifest
2828
public function __construct(string $path, string $publicPath)
2929
{
3030
if (!file_exists($path)) {
31-
throw new Exception(sprintf('Could not find a manifest in %s', $path));
31+
trigger_error(sprintf('Could not find a manifest in %s', $path), E_USER_WARNING);
32+
return;
3233
}
3334

34-
$content = null;
35-
36-
try {
37-
$content = file_get_contents($path);
38-
} catch (Exception $error) {
39-
throw new Exception(sprintf('Could not read the manifest in %s', $path));
40-
}
35+
$content = file_get_contents($path);
4136

4237
if (!$content) {
43-
throw new Exception(sprintf('Could not read the manifest in %s', $path));
38+
trigger_error(sprintf('Could not read the manifest in %s', $path), E_USER_WARNING);
39+
return;
4440
}
4541

4642
$json = json_decode($content, true);
4743

4844
if (!is_array($json) || !key_exists('entrypoints', $json)) {
49-
throw new Exception('Manifest schema is not valid.');
45+
trigger_error('Manifest schema is not valid.', E_USER_WARNING);
46+
return;
5047
}
5148

5249
$this->manifest = (new Collection($json))->except('entrypoints');

packages/php/tests/ManifestTest.php

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,43 @@
66
$this->manifest = new Manifest(__DIR__ . '/__stubs__/assets-manifest.json', '/public/');
77
});
88

9-
it('should fail if no manifest file is found', function() {
10-
expect(function() {
11-
return new Manifest('/path/to/manifest.json', '/');
12-
})->toThrow('Could not find a manifest in /path/to/manifest.json');
9+
it('should trigger warning if no manifest file is found', function() {
10+
$error = null;
11+
set_error_handler(function($errno, $errstr) use (&$error) {
12+
$error = $errstr;
13+
return true;
14+
});
15+
16+
new Manifest('/path/to/manifest.json', '/');
17+
18+
restore_error_handler();
19+
expect($error)->toBe('Could not find a manifest in /path/to/manifest.json');
1320
});
1421

15-
it('should fail if the manifest file can not be read', function() {
16-
expect(function() {
17-
return new Manifest(__DIR__ . '/__stubs__/', '/');
18-
})->toThrow(sprintf('Could not read the manifest in %s', __DIR__ . '/__stubs__/'));
22+
it('should trigger warning if the manifest file can not be read', function() {
23+
$error = null;
24+
set_error_handler(function($errno, $errstr) use (&$error) {
25+
$error = $errstr;
26+
return true;
27+
});
28+
29+
new Manifest(__DIR__ . '/__stubs__/', '/');
30+
31+
restore_error_handler();
32+
expect($error)->toBe(sprintf('Could not read the manifest in %s', __DIR__ . '/__stubs__/'));
1933
});
2034

21-
it('should fail if the manifest file does not follow the correct schema', function() {
22-
expect(function() {
23-
return new Manifest(__DIR__ . '/__stubs__/invalid-manifest.json', '/');
24-
})->toThrow('Manifest schema is not valid.');
35+
it('should trigger warning if the manifest file does not follow the correct schema', function() {
36+
$error = null;
37+
set_error_handler(function($errno, $errstr) use (&$error) {
38+
$error = $errstr;
39+
return true;
40+
});
41+
42+
new Manifest(__DIR__ . '/__stubs__/invalid-manifest.json', '/');
43+
44+
restore_error_handler();
45+
expect($error)->toBe('Manifest schema is not valid.');
2546
});
2647

2748
it('should return the real path of an asset or null', function() {

packages/preset-markdown/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-markdown",
3-
"version": "6.3.3",
3+
"version": "6.3.4",
44
"publishConfig": {
55
"access": "public"
66
},

packages/preset-prototyping/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@studiometa/webpack-config-preset-prototyping",
3-
"version": "6.3.3",
3+
"version": "6.3.4",
44
"publishConfig": {
55
"access": "public"
66
},

0 commit comments

Comments
 (0)