diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 756a961..7ff5fe9 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -22,6 +22,6 @@ jobs: uses: aglipanci/laravel-pint-action@2.4 - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v5 + uses: stefanzweifel/git-auto-commit-action@v6 with: commit_message: Fix styling diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 3855a08..c1a2fa8 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 99b6755..1f75815 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,4 @@ -name: run-tests +name: "Run Tests" on: push: @@ -13,19 +13,18 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.3, 8.2, 8.1] - laravel: [11.*, 10.*] + php: [8.4, 8.3, 8.2] + laravel: [12.*, 11.*] stability: [prefer-lowest, prefer-stable] include: - - laravel: 10.* - testbench: 8.* - carbon: 2.* + - laravel: 12.* + testbench: 10.* + carbon: 3.* + collision: 8.* - laravel: 11.* testbench: 9.* carbon: 3.* - exclude: - - laravel: 11.* - php: 8.1 + collision: 8.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 8271e65..12d978a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ -.DS_Store +**/.DS_Store .idea .phpunit.result.cache +.phpunit.cache .vscode build composer.lock diff --git a/README.md b/README.md index 98f321d..bafc29c 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,15 @@ You can install the package via composer: composer require :vendor_slug/:package_slug ``` +> [!IMPORTANT] +> If you have not set up a custom theme and are using Filament Panels follow the instructions in the [Filament Docs](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) first. + +After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages. + +```css +@source '../../../../vendor/:vendor_slug/:package_slug/resources/**/*.blade.php'; +``` + You can publish and run the migrations with: ```bash diff --git a/bin/build.js b/bin/build.js index 913baf4..14acdaa 100644 --- a/bin/build.js +++ b/bin/build.js @@ -47,4 +47,6 @@ compile({ ...defaultOptions, entryPoints: ['./resources/js/index.js'], outfile: './resources/dist/skeleton.js', +}).then(() => { + console.log(`Build completed for skeleton.js`) }) diff --git a/composer.json b/composer.json index be2300a..1cf448a 100644 --- a/composer.json +++ b/composer.json @@ -21,23 +21,25 @@ } ], "require": { - "php": "^8.1", - "filament/filament": "^3.0", - "filament/forms": "^3.0", - "filament/tables": "^3.0", + "php": "^8.2", + "filament/filament": "^4.0", + "filament/forms": "^4.0", + "filament/tables": "^4.0", "spatie/laravel-package-tools": "^1.15.0" }, "require-dev": { - "larastan/larastan": "^2.0", + "larastan/larastan": "^3.0", "laravel/pint": "^1.0", - "nunomaduro/collision": "^7.9|^8.0", - "orchestra/testbench": "^8.0|^9.0", - "pestphp/pest": "^2.1", - "pestphp/pest-plugin-arch": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", + "nunomaduro/collision": "^8.0", + "orchestra/testbench": "^9.0|^10.0", + "pestphp/pest": "^3.0", + "pestphp/pest-plugin-arch": "^3.0", + "pestphp/pest-plugin-laravel": "^3.0", + "pestphp/pest-plugin-livewire": "^3.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "rector/rector": "^2.0", "spatie/laravel-ray": "^1.26" }, "autoload": { @@ -53,17 +55,12 @@ }, "scripts": { "post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi", - "analyse": "vendor/bin/phpstan analyse", - "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest --coverage", - "format": "vendor/bin/pint" - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "pestphp/pest-plugin": true, - "phpstan/extension-installer": true - } + "analyse": "phpstan analyse", + "lint": "pint", + "refactor": "rector", + "test": "pest", + "test:lint": "pint --test", + "test:refactor": "rector --dry-run" }, "extra": { "laravel": { @@ -75,6 +72,14 @@ } } }, + "config": { + "sort-packages": true, + "allow-plugins": { + "composer/package-versions-deprecated": true, + "pestphp/pest-plugin": true, + "phpstan/extension-installer": true + } + }, "minimum-stability": "dev", "prefer-stable": true } diff --git a/configure.php b/configure.php index 26104fb..43c8cf1 100644 --- a/configure.php +++ b/configure.php @@ -35,6 +35,7 @@ $usePhpStan = confirm('Enable PhpStan?', true); $usePint = confirm('Enable Pint?', true); $useDependabot = confirm('Enable Dependabot?', true); $useLaravelRay = confirm('Enable Ray?', true); +$useRector = confirm('Enable Rector?', true); $useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true); $isTheme = confirm('Is this a custom theme?'); @@ -54,6 +55,7 @@ writeln('Larastan/PhpStan : ' . ($usePhpStan ? "\e[0;32mYes" : "\e[0;31mNo") . writeln('Pint : ' . ($usePint ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m"); writeln('Use Dependabot : ' . ($useDependabot ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m"); writeln('Use Ray : ' . ($useLaravelRay ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m"); +writeln('Use Rector : ' . ($useRector ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m"); writeln('Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m"); if ($formsOnly) { writeln("Filament/Forms : \e[0;32mYes\e[0m"); @@ -169,7 +171,7 @@ if (! $usePhpStan) { 'phpstan/extension-installer', 'phpstan/phpstan-deprecation-rules', 'phpstan/phpstan-phpunit', - 'nunomaduro/larastan', + 'larastan/larastan', ], 'require-dev'); removeComposerDeps(['analyse'], 'scripts'); @@ -186,8 +188,19 @@ if (! $usePint) { removeComposerDeps(['format'], 'scripts'); } +if (! $useRector) { + safeUnlink(__DIR__ . '/rector.php'); + + removeComposerDeps([ + 'rector/rector', + ], 'require-dev'); + + removeComposerDeps(['refactor', 'test:refactor', ], 'scripts'); +} + if (! $useUpdateChangelogWorkflow) { safeUnlink(__DIR__ . '/.github/workflows/update-changelog.yml'); + safeUnlink(__DIR__ . '/CHANGELOG.md'); } confirm('Execute `composer install`?') && run('composer install'); diff --git a/database/migrations/create_skeleton_table.php.stub b/database/migrations/create_skeleton_table.php.stub index 2efdce9..1a067d7 100644 --- a/database/migrations/create_skeleton_table.php.stub +++ b/database/migrations/create_skeleton_table.php.stub @@ -6,7 +6,7 @@ use Illuminate\Support\Facades\Schema; return new class extends Migration { - public function up() + public function up(): void { Schema::create('migration_table_name_table', function (Blueprint $table) { $table->id(); diff --git a/package.json b/package.json index afec3c0..1f70fe1 100644 --- a/package.json +++ b/package.json @@ -2,25 +2,11 @@ "private": true, "type": "module", "scripts": { - "dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/skeleton.css --postcss --watch", - "dev:scripts": "node bin/build.js --dev", - "build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/skeleton.css --postcss --minify && npm run purge", - "build:scripts": "node bin/build.js", - "purge": "filament-purge -i resources/dist/skeleton.css -o resources/dist/skeleton.css -v 3.x", - "dev": "npm-run-all --parallel dev:*", - "build": "npm-run-all build:*" + "dev": "node bin/build.js --dev", + "build": "node bin/build.js" }, "devDependencies": { - "@awcodes/filament-plugin-purge": "^1.1.1", - "@tailwindcss/forms": "^0.5.4", - "@tailwindcss/typography": "^0.5.9", - "autoprefixer": "^10.4.14", - "esbuild": "^0.19.2", - "npm-run-all": "^4.1.5", - "postcss": "^8.4.26", - "postcss-import": "^15.1.0", - "prettier": "^2.7.1", - "prettier-plugin-tailwindcss": "^0.1.13", - "tailwindcss": "^3.3.3" + "esbuild": "^0.25.5", + "prettier": "^3.5.3" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a91953b..a940793 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,4 +1,6 @@ includes: + - vendor/larastan/larastan/extension.neon + - vendor/nesbot/carbon/extension.neon - phpstan-baseline.neon parameters: @@ -10,5 +12,4 @@ parameters: tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false diff --git a/postcss.config.cjs b/postcss.config.cjs deleted file mode 100644 index 2855394..0000000 --- a/postcss.config.cjs +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - plugins: { - "postcss-import": {}, - "tailwindcss/nesting": {}, - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..d79c6e0 --- /dev/null +++ b/rector.php @@ -0,0 +1,17 @@ +withPaths([ + __DIR__.'/src', + ]) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + typeDeclarations: true, + privatization: true, + earlyReturn: true, + strictBooleans: true, + ) + ->withPhpSets(); diff --git a/src/Facades/Skeleton.php b/src/Facades/Skeleton.php index 1fa9076..571a498 100644 --- a/src/Facades/Skeleton.php +++ b/src/Facades/Skeleton.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Facade; */ class Skeleton extends Facade { - protected static function getFacadeAccessor() + protected static function getFacadeAccessor(): string { return \VendorName\Skeleton\Skeleton::class; } diff --git a/src/SkeletonServiceProvider.php b/src/SkeletonServiceProvider.php index 266d50d..0e00178 100644 --- a/src/SkeletonServiceProvider.php +++ b/src/SkeletonServiceProvider.php @@ -103,8 +103,8 @@ class SkeletonServiceProvider extends PackageServiceProvider { return [ // AlpineComponent::make('skeleton', __DIR__ . '/../resources/dist/components/skeleton.js'), - Css::make('skeleton-styles', __DIR__ . '/../resources/dist/skeleton.css'), - Js::make('skeleton-scripts', __DIR__ . '/../resources/dist/skeleton.js'), + // Css::make('skeleton-styles', __DIR__ . '/../resources/dist/skeleton.css'), + // Js::make('skeleton-scripts', __DIR__ . '/../resources/dist/skeleton.js'), ]; } diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 7ae2ac4..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const preset = require('./vendor/filament/filament/tailwind.config.preset') - -module.exports = { - presets: [preset], - content: [ - './app/Filament/**/*.php', - './resources/views/filament/**/*.blade.php', - './vendor/filament/**/*.blade.php', - ], -} diff --git a/tests/ArchTest.php b/tests/DebugTest.php similarity index 100% rename from tests/ArchTest.php rename to tests/DebugTest.php diff --git a/tests/TestCase.php b/tests/TestCase.php index 14a77a0..0acf816 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,17 +9,23 @@ use Filament\FilamentServiceProvider; use Filament\Forms\FormsServiceProvider; use Filament\Infolists\InfolistsServiceProvider; use Filament\Notifications\NotificationsServiceProvider; +use Filament\Schemas\SchemasServiceProvider; use Filament\Support\SupportServiceProvider; use Filament\Tables\TablesServiceProvider; use Filament\Widgets\WidgetsServiceProvider; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Livewire\LivewireServiceProvider; +use Orchestra\Testbench\Concerns\WithWorkbench; use Orchestra\Testbench\TestCase as Orchestra; use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider; use VendorName\Skeleton\SkeletonServiceProvider; class TestCase extends Orchestra { + use LazilyRefreshDatabase; + use WithWorkbench; + protected function setUp(): void { parent::setUp(); @@ -31,7 +37,7 @@ class TestCase extends Orchestra protected function getPackageProviders($app) { - return [ + $providers = [ ActionsServiceProvider::class, BladeCaptureDirectiveServiceProvider::class, BladeHeroiconsServiceProvider::class, @@ -41,20 +47,25 @@ class TestCase extends Orchestra InfolistsServiceProvider::class, LivewireServiceProvider::class, NotificationsServiceProvider::class, + SchemasServiceProvider::class, SupportServiceProvider::class, TablesServiceProvider::class, WidgetsServiceProvider::class, SkeletonServiceProvider::class, ]; + + sort($providers); + + return $providers; } - public function getEnvironmentSetUp($app) + public function getEnvironmentSetUp($app): void { - config()->set('database.default', 'testing'); + $app['config']->set('database.default', 'testing'); + } - /* - $migration = include __DIR__.'/../database/migrations/create_skeleton_table.php.stub'; - $migration->up(); - */ + protected function defineDatabaseMigrations(): void + { + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); } }