diff --git a/.editorconfig b/.editorconfig index dd9a2b5..a7c44dd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,9 +2,9 @@ root = true [*] charset = utf-8 -end_of_line = lf indent_size = 4 indent_style = space +end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes index c09f81e..9e9519b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,6 @@ /art export-ignore /docs export-ignore /tests export-ignore -/workbench export-ignore /.editorconfig export-ignore /.php_cs.dist.php export-ignore /psalm.xml export-ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 83b7546..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -# These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [StanBarrows] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7546b77..bc5e177 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,18 +1,18 @@ name: Bug Report description: Report an Issue or Bug with the Package title: "[Bug]: " -labels: ["bug"] +labels: [ "bug" ] body: - type: markdown attributes: - value: | - We're sorry to hear you have a problem. Can you help us solve it by providing the following details. + value: "| +We're sorry to hear you have a problem. Can you help us solve it by providing the following details." - type: textarea id: what-happened attributes: label: What happened? description: What did you expect to happen? - placeholder: I cannot currently do X thing because when I do, it breaks X thing. + placeholder: "I cannot currently do X thing because when I do, it breaks X thing." validations: required: true - type: input @@ -20,7 +20,8 @@ body: attributes: label: Package Version description: What version of our Package are you running? Please be as specific as possible - placeholder: 1.0.0 + placeholder: "12.0" + value: "12.0" validations: required: true - type: input @@ -28,7 +29,8 @@ body: attributes: label: PHP Version description: What version of PHP are you running? Please be as specific as possible - placeholder: 8.3.0 + placeholder: "8.4.0" + value: "8.4.0" validations: required: true - type: input @@ -36,7 +38,8 @@ body: attributes: label: Laravel Version description: What version of Laravel are you running? Please be as specific as possible - placeholder: 11.0.0 + placeholder: "12.0.0" + value: "12.0.0" validations: required: true - type: dropdown diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0bc378d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 14da349..2df1631 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -10,20 +10,20 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - + - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.3.3 + uses: dependabot/fetch-metadata@v2.3.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - + - name: Auto-merge Dependabot PRs for semver-minor updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Auto-merge Dependabot PRs for semver-patch updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..0d4a013 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,20 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml new file mode 100644 index 0000000..ef2fadf --- /dev/null +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -0,0 +1,21 @@ +name: Fix PHP code style issues + +on: [push] + +jobs: + php-code-styling: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.5 + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Fix styling diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml deleted file mode 100644 index 3517cf1..0000000 --- a/.github/workflows/php-cs-fixer.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check & fix styling - -on: - push: - branches: - - styling - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php-cs-fixer.dist.php --allow-risky=yes - - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Fix styling diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 090fd83..b0cde6a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,25 +2,25 @@ name: PHPStan on: push: - branches: [ main ] - pull_request: - branches: [ main ] + paths: + - '**.php' + - 'phpstan.neon.dist' jobs: phpstan: name: phpstan runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.4' coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHPStan - run: ./vendor/bin/phpstan analyse src --error-format=github + run: ./vendor/bin/phpstan --error-format=github diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c26d8ea..c4d9e45 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,16 +13,16 @@ jobs: fail-fast: true max-parallel: 1 matrix: - os: [ ubuntu-latest, windows-latest ] - php: [ 8.2, 8.3 ] - laravel: [ 11.* ] + os: [ ubuntu-latest ] + php: [ 8.2, 8.3, 8.4 ] + laravel: [ 12.* ] stability: [ prefer-lowest, prefer-stable ] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -41,16 +41,15 @@ jobs: composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - - name: Set phpunit.xml + - name: Execute tests run: cp phpunit.xml.dist phpunit.xml - name: Execute tests run: vendor/bin/pest - - name: Store test reports - uses: actions/upload-artifact@v2 + - name: Store Log Artifacts + if: failure() + uses: actions/upload-artifact@v4 with: - name: Store report - retention-days: 1 - path: | - ./reports + name: Store report artifacts + path: ./vendor/orchestra/testbench-core/laravel/storage/logs diff --git a/.gitignore b/.gitignore index a7f372d..91b23b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ .idea +.phpunit.result.cache .phpunit.cache -build composer.lock coverage -docs phpunit.xml phpstan.neon testbench.yaml vendor node_modules +.phpactor.json +build diff --git a/README.md b/README.md index 0df0a33..9dc9bc9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ - + + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/laravel-filament-json-field.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-filament-json-field) +[![GitHub-Tests](https://github.com/codebar-ag/laravel-filament-json-field/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-filament-json-field/actions/workflows/run-tests.yml) +[![GitHub Code Style](https://github.com/codebar-ag/laravel-filament-json-field/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-filament-json-field/actions/workflows/fix-php-code-style-issues.yml) +[![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/laravel-filament-json-field.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-filament-json-field) -[![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/filament-json-field.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-json-field) -[![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/filament-json-field.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/filament-json-field) -[![run-tests](https://github.com/codebar-ag/filament-json-field/actions/workflows/run-tests.yml/badge.svg)](https://github.com/codebar-ag/filament-json-field/actions/workflows/run-tests.yml) -[![PHPStan](https://github.com/codebar-ag/filament-json-field/actions/workflows/phpstan.yml/badge.svg)](https://github.com/codebar-ag/filament-json-field/actions/workflows/phpstan.yml) ## 💡 What is Filament Json Field? @@ -11,9 +12,11 @@ Filament Json Field is a Filament wrapper for Codemirror. ## 🛠 Requirements -| Package | PHP | Laravel | Filament Infolists | Filament Support | Filament Tables | -|-----------|-------|---------------|--------------------|------------------|-----------------| -| v1.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | +| Package | PHP | Laravel | Filament Infolists | Filament Support | Filament Tables | +|-----------|------------------|---------------|--------------------|------------------|-----------------| +| v12.0 | ^8.2, ^8.3, ^8.4 | ^12.0 | ^3.3 | ^3.3 | ^3.3 | +| v11.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | +| v1.0 | ^8.1 | ^10.45, ^11.0 | ^3.2 | ^3.2 | ^3.2 | ## ⚙️ Installation diff --git a/composer.json b/composer.json index e5fb669..d1a48b5 100644 --- a/composer.json +++ b/composer.json @@ -10,37 +10,34 @@ "license": "MIT", "authors": [ { - "name": "Sebastian Bürgin", - "email": "sebastian.fix@buergin.ch", + "name": "Sebastian Bürgin-Fix", + "email": "sebastian.buergin@buergin.ch", "homepage": "https://www.codebar.ch", "role": "Sofware-Engineer" }, { "name": "Rhys Lees", - "role": "Software-Developer" + "role": "Software-Engineer" } ], "require": { - "php": "^8.2", - "filament/infolists": "^3.2", - "filament/support": "^3.2", - "filament/tables": "^3.2", - "illuminate/contracts": "^10.0||^11.0", - "livewire/livewire": "^3.4", - "spatie/laravel-package-tools": "^1.16" + "php": "8.2.*|8.3.*|8.4.*", + "filament/infolists": "^3.3", + "filament/support": "^3.3", + "filament/tables": "^3.3", + "illuminate/contracts": "^12.0", + "livewire/livewire": "^3.6", + "spatie/laravel-package-tools": "^1.19" }, "require-dev": { - "laravel/pint": "^1.14", - "nunomaduro/collision": "^8.1.1||^7.10.0", - "larastan/larastan": "^2.9", - "orchestra/testbench": "^9.0.0||^8.22.0", - "pestphp/pest": "^2.34", - "pestphp/pest-plugin-arch": "^2.7", - "pestphp/pest-plugin-laravel": "^2.3", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "spatie/laravel-ray": "^1.35" + "laravel/pint": "^1.21", + "larastan/larastan": "^v3.1", + "orchestra/testbench": "^10.0", + "pestphp/pest": "^3.7", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "spatie/laravel-ray": "^1.39" }, "autoload": { "psr-4": { @@ -50,27 +47,17 @@ }, "autoload-dev": { "psr-4": { - "CodebarAg\\FilamentJsonField\\Tests\\": "tests/", - "Workbench\\App\\": "workbench/app/" + "CodebarAg\\FilamentJsonField\\Tests\\": "tests/" } }, "scripts": { "post-autoload-dump": "@composer run prepare", - "clear": "@php vendor/bin/testbench package:purge-laravel-filament-json-field --ansi", "prepare": "@php vendor/bin/testbench package:discover --ansi", - "build": [ - "@composer run prepare", - "@php vendor/bin/testbench workbench:build --ansi" - ], - "start": [ - "Composer\\Config::disableProcessTimeout", - "@composer run build", - "@php vendor/bin/testbench serve" - ], "analyse": "vendor/bin/phpstan analyse", "test": "vendor/bin/pest", "test-coverage": "vendor/bin/pest --coverage", - "format": "vendor/bin/pint" + "format": "vendor/bin/pint", + "clear": "@php vendor/bin/testbench package:purge-laravel-filament-revealable-field --ansi" }, "config": { "sort-packages": true, diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 489fa4e..d16eb54 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,10 +5,7 @@ parameters: level: 5 paths: - src - - config - - database tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false - + noEnvCallsOutsideOfConfig: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 785088a..d41aea3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,11 @@ - + - + tests @@ -30,6 +19,9 @@ + + + ./src diff --git a/src/Forms/Components/JsonInput.php b/src/Forms/Components/JsonInput.php index 950288c..b23b9f8 100644 --- a/src/Forms/Components/JsonInput.php +++ b/src/Forms/Components/JsonInput.php @@ -19,6 +19,7 @@ class JsonInput extends Field use HasLineNumbers; use HasLineWrapping; + // @phpstan-ignore-next-line protected string $view = 'laravel-filament-json-field::forms.components.json-input'; public function setUp(): void diff --git a/src/Infolists/Components/JsonEntry.php b/src/Infolists/Components/JsonEntry.php index af54869..4e081b0 100644 --- a/src/Infolists/Components/JsonEntry.php +++ b/src/Infolists/Components/JsonEntry.php @@ -17,5 +17,6 @@ class JsonEntry extends Entry use HasLineNumbers; use HasLineWrapping; + // @phpstan-ignore-next-line protected string $view = 'laravel-filament-json-field::infolists.components.json-entry'; } diff --git a/workbench/app/Providers/WorkbenchServiceProvider.php b/workbench/app/Providers/WorkbenchServiceProvider.php deleted file mode 100644 index 001d06d..0000000 --- a/workbench/app/Providers/WorkbenchServiceProvider.php +++ /dev/null @@ -1,25 +0,0 @@ -