Skip to content

Commit

Permalink
Support Nova 5, update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Dec 15, 2024
1 parent bd9f6ce commit 3353104
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [ 8.3, 8.2]
php: [ 8.3, 8.2 ]
laravel: [ 10.* ]
dependency-version: [ prefer-stable ]
include:
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Install dependencies
run: |
composer config "http-basic.nova.laravel.com" "${{ secrets.NOVA_USERNAME }}" "${{ secrets.NOVA_4_LICENSE_KEY }}"
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench-core:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
Expand All @@ -47,14 +47,14 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22

- name: Cache yarn dependencies
uses: actions/cache@v4
id: npm-node_modules-cache
with:
path: node_modules
key: npm-${{ hashFiles('package.json') }}-node-20
key: npm-${{ hashFiles('package.json') }}-node-22

- name: Compile assets
run: npm install && npm run nova:install && npm run prod
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"require": {
"php": "^8.1",
"ext-json": "*",
"laravel/nova": "^4.20"
"laravel/nova": "^4.20 || ^5.0"
},
"require-dev": {
"interaction-design-foundation/coding-standard": "^0.3.0",
"orchestra/testbench": "^9.0",
"orchestra/testbench-core": "^8.22 || ^v9.7",
"phpunit/phpunit": "^10.5 || ^11.0",
"vimeo/psalm": "^5.22"
},
Expand Down Expand Up @@ -59,6 +59,7 @@
"cs:check": "phpcs -p -s --colors --report-full --report-summary",
"cs:fix": "phpcbf -p --colors",
"psalm": "vendor/bin/psalm",
"sa": "@psalm",
"test": "phpunit --colors=always"
}
}
21 changes: 21 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ruleset name="IxDF Package Standard">
<!-- Include all rules from the IxDF Coding Standard -->
<rule ref="IxDFCodingStandard">
<exclude ref="IxDFCodingStandard.Files.BemCasedFilename.InvalidCharacters"/>
<exclude ref="SlevomatCodingStandard.Classes.RequireAbstractOrFinal.ClassNeitherAbstractNorFinal"/>
<exclude ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
</rule>

<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>./tests*</exclude-pattern>
</rule>

<rule ref="Generic.Files.LineLength.TooLong">
<severity>1</severity><!-- Temp hide the warn -->
</rule>

<!-- Paths to check -->
<file>src</file>
<file>tests</file>
</ruleset>
5 changes: 3 additions & 2 deletions src/Unlayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class Unlayer extends Field

Check failure on line 16 in src/Unlayer.php

View workflow job for this annotation

GitHub Actions / psalm

PropertyNotSetInConstructor

src/Unlayer.php:16:7: PropertyNotSetInConstructor: Property InteractionDesignFoundation\NovaUnlayerField\Unlayer::$dependentShouldEmitChangesEvent is not defined in constructor of InteractionDesignFoundation\NovaUnlayerField\Unlayer or in any methods called in the constructor (see https://psalm.dev/074)
{
use SupportsDependentFields;

public const MODE_EMAIL = 'email';
public const MODE_WEB = 'web';

Expand All @@ -33,7 +34,7 @@ class Unlayer extends Field

/**
* A function to call on filling Model attributes from Request
* @var null|callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string):void $callback
* @var (callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string): void)|null $callback
*/
public $savingCallback;

Expand All @@ -59,7 +60,7 @@ final public function config(array | callable $config): static
]);
}

/** @param null|callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string):void $callback */
/** @param (callable(\Laravel\Nova\Http\Requests\NovaRequest, string, \Illuminate\Database\Eloquent\Model, string): void)|null $callback */
final public function savingCallback(?callable $callback): static
{
$this->savingCallback = $callback;
Expand Down
2 changes: 1 addition & 1 deletion tests/UnlayerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function it_resolves_callback_to_html_code(): void
{
$field = new Unlayer('any_name');

$field->html(static fn (): string => '<p>Hello!</p>');
$field->html(static fn(): string => '<p>Hello!</p>');

$this->assertSame('<p>Hello!</p>', $field->meta()['html'] ?? null);
}
Expand Down

0 comments on commit 3353104

Please sign in to comment.