mirror of
https://github.com/filamentphp/plugin-skeleton.git
synced 2025-12-06 13:38:53 +08:00
updates for Filament v4
This commit is contained in:
@@ -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
|
||||
|
||||
2
.github/workflows/phpstan.yml
vendored
2
.github/workflows/phpstan.yml
vendored
@@ -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
|
||||
|
||||
17
.github/workflows/run-tests.yml
vendored
17
.github/workflows/run-tests.yml
vendored
@@ -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 }}
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
.idea
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
.vscode
|
||||
build
|
||||
composer.lock
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,4 +47,6 @@ compile({
|
||||
...defaultOptions,
|
||||
entryPoints: ['./resources/js/index.js'],
|
||||
outfile: './resources/dist/skeleton.js',
|
||||
}).then(() => {
|
||||
console.log(`Build completed for skeleton.js`)
|
||||
})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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();
|
||||
|
||||
22
package.json
22
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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
"postcss-import": {},
|
||||
"tailwindcss/nesting": {},
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
17
rector.php
Normal file
17
rector.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
|
||||
return RectorConfig::configure()
|
||||
->withPaths([
|
||||
__DIR__.'/src',
|
||||
])
|
||||
->withPreparedSets(
|
||||
deadCode: true,
|
||||
codeQuality: true,
|
||||
typeDeclarations: true,
|
||||
privatization: true,
|
||||
earlyReturn: true,
|
||||
strictBooleans: true,
|
||||
)
|
||||
->withPhpSets();
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user