From 8f247698788821e7763ac72973dacfc33a354477 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Wed, 4 Mar 2026 21:48:17 +0100 Subject: [PATCH] style: format codebase --- CHANGELOG.md | 92 +++---- CONTRIBUTING.md | 4 +- composer.json | 225 +++++++++------- package.json | 50 ++-- pint.json | 400 ++++++++++++++-------------- resources/css/app.css | 6 +- resources/js/app.ts | 35 +-- resources/js/global.d.ts | 18 +- resources/js/pages/dashboard.svelte | 11 +- svelte.config.ts | 12 +- tsconfig.json | 82 +++--- vite.config.ts | 54 ++-- 12 files changed, 504 insertions(+), 485 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfb599f7b..f58381500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,31 +17,31 @@ All notable changes to this project will be documented in this file. ### Added - **v4 to v5 upgrade migration** - - Coolify v4 database as `old_pgsql` connection - - + - Coolify v4 database as `old_pgsql` connection + - - Worker Servers that replace build servers with servers that can also run jobs (Horizon workers) in addition to building Docker images ### Changed - Upgrade PHP from 8.2 to 8.5, TailwindCSS from v3 to v4.0, Laravel from v10 to v12 and all other Composer and Node dependencies to their latest versions and syntax - **Docker** - - Upgrade Postgres from v15 to v18, Redis from v7 to v8 and all other Docker dependencies to latest - - + - Upgrade Postgres from v15 to v18, Redis from v7 to v8 and all other Docker dependencies to latest + - - **Laravel Configurations** - - Hashing algorithm from `bcrypt` to `argon2id` for enhanced security - - Session driver to Redis with inactive sessions expiring after 24h (previously 14 days) - - Encrypted user session data - - Password reset token expiration from 60 minutes to 10 minutes - - Jobs dispatch only after all DB transactions complete, preventing race conditions - - Normal jobs (backups, emails, etc.) and deployment jobs to separate supervisor configurations and defaults - - Horizon worker restart threshold to 500 jobs (job workers) or 300 jobs (deployment workers) or 1 hour to clean up stale memory and CPU usage - - Default queue timeouts from 10h to 60s for jobs and 300s for deployments to prevent stale jobs - - `balanceCooldown` from 1s to 2s for jobs to reduce CPU spikes - - Laravel logs to `stderr` so they can be viewed in Docker logs - - Production logging to rotate automatically and keep only the last 10 days of logs to reduce disk usage - - Production log level from `debug` to `warning` to reduce disk usage and avoid logging sensitive information - - Redis connections to separate instances for cache, jobs and sessions for easier debugging and separation - - Upgrade all Laravel config files to the latest version and remove unused options + - Hashing algorithm from `bcrypt` to `argon2id` for enhanced security + - Session driver to Redis with inactive sessions expiring after 24h (previously 14 days) + - Encrypted user session data + - Password reset token expiration from 60 minutes to 10 minutes + - Jobs dispatch only after all DB transactions complete, preventing race conditions + - Normal jobs (backups, emails, etc.) and deployment jobs to separate supervisor configurations and defaults + - Horizon worker restart threshold to 500 jobs (job workers) or 300 jobs (deployment workers) or 1 hour to clean up stale memory and CPU usage + - Default queue timeouts from 10h to 60s for jobs and 300s for deployments to prevent stale jobs + - `balanceCooldown` from 1s to 2s for jobs to reduce CPU spikes + - Laravel logs to `stderr` so they can be viewed in Docker logs + - Production logging to rotate automatically and keep only the last 10 days of logs to reduce disk usage + - Production log level from `debug` to `warning` to reduce disk usage and avoid logging sensitive information + - Redis connections to separate instances for cache, jobs and sessions for easier debugging and separation + - Upgrade all Laravel config files to the latest version and remove unused options - License from `Apache-2.0` to `AGPL-3.0` ### Deprecated @@ -71,36 +71,36 @@ All notable changes to this project will be documented in this file. ### Maintenance - **Testing** - - Add custom Architecture test that enforces Laravel and PHP best practices to ensure security and consistency across the codebase + - Add custom Architecture test that enforces Laravel and PHP best practices to ensure security and consistency across the codebase - **Tooling** - - Add Rector & Rector Laravel with a strict configuration for automatic refactoring of the codebase - - Add a strict custom Laravel Pint preset for consistent PHP formatting across the codebase - - Add Larastan (PHPStan) level `max` for code analysis and type checking - - Add custom Composer scripts to run refactors, formatting, linting, tests and type-coverage - - Add strict `AppServiceProvider.php` - - Optionally enforce HTTPS for the Coolify dashboard - - Enforce strong password validation rules in production - - Disable destructive Artisan commands in production - - Automatically eager load all relationships to prevent N+1 queries - - Configure models and enforce morph map for polymorphic relationships - - Enforce immutable dates globally - - Disable queue interruption polling to improve performance - - Fake sleeps and prevent stray HTTP requests in testing - - Prevent exception truncation in development - - Use aggressive Vite prefetching for better performance - - Only install Ray in development and remove all `ray()` calls from production code via Rector - - Switch Node package manager from `NPM` to `Bun` for improved security and performance - - Add `$schema` to `composer.json` and `package.json` + - Add Rector & Rector Laravel with a strict configuration for automatic refactoring of the codebase + - Add a strict custom Laravel Pint preset for consistent PHP formatting across the codebase + - Add Larastan (PHPStan) level `max` for code analysis and type checking + - Add custom Composer scripts to run refactors, formatting, linting, tests and type-coverage + - Add strict `AppServiceProvider.php` + - Optionally enforce HTTPS for the Coolify dashboard + - Enforce strong password validation rules in production + - Disable destructive Artisan commands in production + - Automatically eager load all relationships to prevent N+1 queries + - Configure models and enforce morph map for polymorphic relationships + - Enforce immutable dates globally + - Disable queue interruption polling to improve performance + - Fake sleeps and prevent stray HTTP requests in testing + - Prevent exception truncation in development + - Use aggressive Vite prefetching for better performance + - Only install Ray in development and remove all `ray()` calls from production code via Rector + - Switch Node package manager from `NPM` to `Bun` for improved security and performance + - Add `$schema` to `composer.json` and `package.json` - **Coolify GitHub Repository** - - Pin all GitHub Actions to full-length git SHAs to minimize the risk of supply chain attacks - - Set permissions explicitly on each GitHub workflow to only give the minimum required permissions - - Rename all GitHub Action workflows for improved clarity - - Cancel in-progress action runs when a new run is triggered - - Improve `SECURITY.md` formatting and wording and add the support policy for `v5.x` - - Add 3 PR templates: `version.md` for release PRs, `default.md` for non-version PRs and a contributor template as the default for external PRs - - Improve the GitHub issue templates to use issue types and improve formatting and wording - - Move `README.md` assets into `.github/assets/` to more easily exclude them from the core repository code - - Remove the `chore-remove-labels-and-assignees-on-close.yml` workflow as labels and assignees are now kept when closing issues and PRs + - Pin all GitHub Actions to full-length git SHAs to minimize the risk of supply chain attacks + - Set permissions explicitly on each GitHub workflow to only give the minimum required permissions + - Rename all GitHub Action workflows for improved clarity + - Cancel in-progress action runs when a new run is triggered + - Improve `SECURITY.md` formatting and wording and add the support policy for `v5.x` + - Add 3 PR templates: `version.md` for release PRs, `default.md` for non-version PRs and a contributor template as the default for external PRs + - Improve the GitHub issue templates to use issue types and improve formatting and wording + - Move `README.md` assets into `.github/assets/` to more easily exclude them from the core repository code + - Remove the `chore-remove-labels-and-assignees-on-close.yml` workflow as labels and assignees are now kept when closing issues and PRs ### Issues diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfdb18fef..61ab1e98f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,8 +10,8 @@ 4. Clone and checkout the code locally 5. Copy `.env.example` to a new `.env` file (no changes should be needed) 6. As the v5 docker architecture is not ready yet, you need to install PHP, composer and bun locally - 6.1. Install PHP, composer and the laravel installer [https://laravel.com/docs/12.x/installation#installing-php](https://laravel.com/docs/12.x/installation#installing-php) - 6.2. Install bun [https://bun.com/docs/installation](https://bun.com/docs/installation) + 6.1. Install PHP, composer and the laravel installer [https://laravel.com/docs/12.x/installation#installing-php](https://laravel.com/docs/12.x/installation#installing-php) + 6.2. Install bun [https://bun.com/docs/installation](https://bun.com/docs/installation) 7. Run `composer install` to install PHP dependencies 8. Run `bun install` to install JS dependencies 9. Run `composer run dev` to create an sqlite database, generate an APP_KEY, migrate the database and run the development server diff --git a/composer.json b/composer.json index 67a86e015..5306e7d24 100644 --- a/composer.json +++ b/composer.json @@ -1,104 +1,125 @@ { - "$schema": "https://getcomposer.org/schema.json", - "name": "coollabsio/coolify", - "type": "project", - "description": "An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 280+ one-click services on your own servers.", - "keywords": ["coolify", "php", "laravel", "inertiajs", "svelte", "svelte5", "self-hosted", "self-hosting", "docker", "docker-compose", "server", "deployment", "databases", "static-site", "nodejs", "nextjs", "mysql", "mariadb", "postgres", "redis"], - "homepage": "https://coolify.io", - "license": "AGPL-3.0", - "require": { - "php": "^8.5", - "inertiajs/inertia-laravel": "^2.0.20", - "laravel/framework": "^12.53.0", - "laravel/horizon": "^5.45", - "laravel/tinker": "^2.11.1" - }, - "require-dev": { - "driftingly/rector-laravel": "^2.1.9", - "fakerphp/faker": "^1.24.1", - "larastan/larastan": "^3.9.2", - "laravel/pail": "^1.2.6", - "laravel/pint": "^1.27.1", - "mockery/mockery": "^1.6.12", - "nunomaduro/collision": "^8.9.1", - "pestphp/pest": "^4.4.1", - "pestphp/pest-plugin-laravel": "^4.1.0", - "pestphp/pest-plugin-type-coverage": "^4.0.3", - "phpstan/phpstan-deprecation-rules": "^2.0.4", - "phpstan/phpstan-strict-rules": "^2.0.10", - "rector/rector": "^2.3.8", - "spatie/laravel-ray": "^1.43.6" - }, - "autoload": { - "psr-4": { - "App\\": "app/", - "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" - } - }, - "autoload-dev": { - "psr-4": { - "Tests\\": "tests/" - } - }, - "scripts": { - "setup": [ - "composer install", - "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", - "@php artisan key:generate", - "@php artisan migrate --force", - "bun install", - "bun run build" - ], - "dev": [ - "Composer\\Config::disableProcessTimeout", - "bunx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"bun run dev\" --names=server,queue,logs,vite --kill-others" - ], - "post-autoload-dump": [ - "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover --ansi" - ], - "post-update-cmd": [ - "@php artisan vendor:publish --tag=laravel-assets --ansi --force" - ], - "post-install-cmd": [ - "@php artisan vendor:publish --tag=laravel-assets --ansi --force" - ], - "pre-package-uninstall": [ - "Illuminate\\Foundation\\ComposerScripts::prePackageUninstall" - ], - "refactor": "rector", - "format": "pint --parallel", - "lint": "phpstan --memory-limit=2G --ansi", - "test": [ - "@php artisan config:clear --ansi", - "XDEBUG_MODE=coverage pest --parallel --coverage --exactly=100" - ], - "test:refactor": "rector --dry-run", - "test:format": "pint --parallel --test", - "test:type-coverage": "pest --parallel --type-coverage --memory-limit=2G --min=100", - "test:all": [ - "@test:refactor", - "@test:format", - "@lint", - "@test", - "@test:type-coverage" - ] - }, - "extra": { - "laravel": { - "dont-discover": [] - } - }, - "config": { - "optimize-autoloader": true, - "preferred-install": "dist", - "sort-packages": true, - "allow-plugins": { - "pestphp/pest-plugin": true, - "php-http/discovery": true - } - }, - "minimum-stability": "stable", - "prefer-stable": true + "$schema": "https://getcomposer.org/schema.json", + "name": "coollabsio/coolify", + "type": "project", + "description": "An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 280+ one-click services on your own servers.", + "keywords": [ + "coolify", + "php", + "laravel", + "inertiajs", + "svelte", + "svelte5", + "self-hosted", + "self-hosting", + "docker", + "docker-compose", + "server", + "deployment", + "databases", + "static-site", + "nodejs", + "nextjs", + "mysql", + "mariadb", + "postgres", + "redis" + ], + "homepage": "https://coolify.io", + "license": "AGPL-3.0", + "require": { + "php": "^8.5", + "inertiajs/inertia-laravel": "^2.0.20", + "laravel/framework": "^12.53.0", + "laravel/horizon": "^5.45", + "laravel/tinker": "^2.11.1" + }, + "require-dev": { + "driftingly/rector-laravel": "^2.1.9", + "fakerphp/faker": "^1.24.1", + "larastan/larastan": "^3.9.2", + "laravel/pail": "^1.2.6", + "laravel/pint": "^1.27.1", + "mockery/mockery": "^1.6.12", + "nunomaduro/collision": "^8.9.1", + "pestphp/pest": "^4.4.1", + "pestphp/pest-plugin-laravel": "^4.1.0", + "pestphp/pest-plugin-type-coverage": "^4.0.3", + "phpstan/phpstan-deprecation-rules": "^2.0.4", + "phpstan/phpstan-strict-rules": "^2.0.10", + "rector/rector": "^2.3.8", + "spatie/laravel-ray": "^1.43.6" + }, + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Factories\\": "database/factories/", + "Database\\Seeders\\": "database/seeders/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "scripts": { + "setup": [ + "composer install", + "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", + "@php artisan key:generate", + "@php artisan migrate --force", + "bun install", + "bun run build" + ], + "dev": [ + "Composer\\Config::disableProcessTimeout", + "bunx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"bun run dev\" --names=server,queue,logs,vite --kill-others" + ], + "post-autoload-dump": [ + "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", + "@php artisan package:discover --ansi" + ], + "post-update-cmd": [ + "@php artisan vendor:publish --tag=laravel-assets --ansi --force" + ], + "post-install-cmd": [ + "@php artisan vendor:publish --tag=laravel-assets --ansi --force" + ], + "pre-package-uninstall": [ + "Illuminate\\Foundation\\ComposerScripts::prePackageUninstall" + ], + "refactor": "rector", + "format": "pint --parallel", + "lint": "phpstan --memory-limit=2G --ansi", + "test": [ + "@php artisan config:clear --ansi", + "XDEBUG_MODE=coverage pest --parallel --coverage --exactly=100" + ], + "test:refactor": "rector --dry-run", + "test:format": "pint --parallel --test", + "test:type-coverage": "pest --parallel --type-coverage --memory-limit=2G --min=100", + "test:all": [ + "@test:refactor", + "@test:format", + "@lint", + "@test", + "@test:type-coverage" + ] + }, + "extra": { + "laravel": { + "dont-discover": [] + } + }, + "config": { + "optimize-autoloader": true, + "preferred-install": "dist", + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "php-http/discovery": true + } + }, + "minimum-stability": "stable", + "prefer-stable": true } diff --git a/package.json b/package.json index e50e8e401..8bc5ef5a8 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,28 @@ { - "$schema": "https://www.schemastore.org/package.json", - "private": true, - "type": "module", - "devDependencies": { - "@inertiajs/svelte": "^2.3.17", - "@sveltejs/vite-plugin-svelte": "^7.0.0", - "@tailwindcss/vite": "^4.2.1", - "concurrently": "^9.2.1", - "laravel-vite-plugin": "^2.1.0", - "prettier": "3.8.1", - "prettier-plugin-svelte": "3.5.1", - "prettier-plugin-tailwindcss": "0.7.2", - "svelte": "^5.53.7", - "tailwindcss": "^4.2.1", - "vite": "^8.0.0-beta.16" - }, - "overrides": { - "vite": "8.0.0-beta.16" - }, - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - } + "$schema": "https://www.schemastore.org/package.json", + "private": true, + "type": "module", + "devDependencies": { + "@inertiajs/svelte": "^2.3.17", + "@sveltejs/vite-plugin-svelte": "^7.0.0", + "@tailwindcss/vite": "^4.2.1", + "concurrently": "^9.2.1", + "laravel-vite-plugin": "^2.1.0", + "prettier": "3.8.1", + "prettier-plugin-svelte": "3.5.1", + "prettier-plugin-tailwindcss": "0.7.2", + "svelte": "^5.53.7", + "tailwindcss": "^4.2.1", + "vite": "^8.0.0-beta.16" + }, + "overrides": { + "vite": "8.0.0-beta.16" + }, + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "format": "prettier --write .", + "test:format": "prettier --check ." + } } diff --git a/pint.json b/pint.json index 44a98dda2..690aabc1d 100644 --- a/pint.json +++ b/pint.json @@ -1,205 +1,199 @@ { - "preset": "laravel", - "rules": { - "align_multiline_comment": { - "comment_type": "phpdocs_like" - }, - "array_push": true, - "assign_null_coalescing_to_coalesce_equal": true, - "attribute_block_no_spaces": true, - "attribute_empty_parentheses": { - "use_parentheses": false - }, - "backtick_to_shell_exec": true, - "blank_line_before_statement": { - "statements": [ - "break", - "case", - "continue", - "declare", - "default", - "do", - "exit", - "for", - "foreach", - "goto", - "if", - "include", - "include_once", - "phpdoc", - "require", - "require_once", - "return", - "switch", - "throw", - "try", - "while", - "yield", - "yield_from" - ] - }, - "class_reference_name_casing": true, - "date_time_immutable": true, - "declare_strict_types": true, - "doctrine_annotation_array_assignment": true, - "doctrine_annotation_braces": true, - "doctrine_annotation_indentation": true, - "doctrine_annotation_spaces": true, - "echo_tag_syntax": true, - "empty_loop_body": true, - "empty_loop_condition": true, - "final_class": true, - "final_internal_class": true, - "final_public_method_for_abstract_class": true, - "fully_qualified_strict_types": true, - "global_namespace_import": { - "import_classes": true, - "import_constants": true, - "import_functions": true - }, - "heredoc_closing_marker": true, - "heredoc_indentation": { - "indentation": "same_as_start" - }, - "indentation_type": false, - "logical_operators": true, - "long_to_shorthand_operator": true, - "mb_str_functions": true, - "modern_serialization_methods": true, - "modernize_strpos": { - "modernize_stripos": true - }, - "modernize_types_casting": true, - "modifier_keywords": true, - "multiline_comment_opening_closing": true, - "multiline_promoted_properties": { - "minimum_number_of_parameters": 3 - }, - "multiline_string_to_heredoc": true, - "new_expression_parentheses": true, - "no_empty_comment": true, - "no_extra_blank_lines": { - "tokens": [ - "attribute", - "break", - "case", - "continue", - "curly_brace_block", - "default", - "extra", - "parenthesis_brace_block", - "return", - "square_brace_block", - "switch", - "throw", - "use", - "use_trait" - ] - }, - "no_homoglyph_names": true, - "no_php4_constructor": true, - "no_redundant_readonly_property": true, - "no_superfluous_elseif": true, - "no_unneeded_braces": { - "namespaces": true - }, - "no_unneeded_control_parentheses": { - "statements": [ - "break", - "clone", - "continue", - "echo_print", - "negative_instanceof", - "others", - "return", - "switch_case", - "yield", - "yield_from" - ] - }, - "no_useless_concat_operator": { - "juggle_simple_strings": true - }, - "no_useless_else": true, - "no_useless_nullsafe_operator": true, - "no_useless_printf": true, - "no_useless_sprintf": true, - "no_whitespace_before_comma_in_array": { - "after_heredoc": true - }, - "operator_linebreak": true, - "ordered_class_elements": { - "order": [ - "use_trait", - "case", - "constant", - "constant_public", - "constant_protected", - "constant_private", - "property_public", - "property_protected", - "property_private", - "construct", - "destruct", - "magic", - "phpunit", - "method_abstract", - "method_public_static", - "method_public", - "method_protected_static", - "method_protected", - "method_private_static", - "method_private" - ], - "sort_algorithm": "none" - }, - "phpdoc_annotation_without_dot": true, - "phpdoc_line_span": true, - "phpdoc_no_alias_tag": { - "replacements": { - "type": "var", - "link": "see" - } - }, - "phpdoc_no_empty_return": true, - "phpdoc_return_self_reference": true, - "phpdoc_scalar": true, - "phpdoc_tag_casing": true, - "phpdoc_trim_consecutive_blank_line_separation": true, - "phpdoc_types_no_duplicates": true, - "phpdoc_types_order": { - "null_adjustment": "always_last" - }, - "phpdoc_var_annotation_correct_order": true, - "protected_to_private": true, - "random_api_migration": true, - "regular_callable_call": true, - "return_assignment": true, - "self_accessor": true, - "set_type_to_cast": true, - "single_line_throw": true, - "single_space_around_construct": true, - "single_trait_insert_per_statement": false, - "strict_comparison": true, - "strict_param": true, - "string_length_to_empty": true, - "string_line_ending": true, - "stringable_for_to_string": true, - "ternary_to_null_coalescing": true, - "trailing_comma_in_multiline": { - "elements": [ - "arguments", - "array_destructuring", - "arrays", - "match", - "parameters" - ] - }, - "type_declaration_spaces": { - "elements": ["constant", "function", "property"] - }, - "whitespace_after_comma_in_array": { - "ensure_single_space": true - } - } + "preset": "laravel", + "rules": { + "align_multiline_comment": { + "comment_type": "phpdocs_like" + }, + "array_push": true, + "assign_null_coalescing_to_coalesce_equal": true, + "attribute_block_no_spaces": true, + "attribute_empty_parentheses": { + "use_parentheses": false + }, + "backtick_to_shell_exec": true, + "blank_line_before_statement": { + "statements": [ + "break", + "case", + "continue", + "declare", + "default", + "do", + "exit", + "for", + "foreach", + "goto", + "if", + "include", + "include_once", + "phpdoc", + "require", + "require_once", + "return", + "switch", + "throw", + "try", + "while", + "yield", + "yield_from" + ] + }, + "class_reference_name_casing": true, + "date_time_immutable": true, + "declare_strict_types": true, + "doctrine_annotation_array_assignment": true, + "doctrine_annotation_braces": true, + "doctrine_annotation_indentation": true, + "doctrine_annotation_spaces": true, + "echo_tag_syntax": true, + "empty_loop_body": true, + "empty_loop_condition": true, + "final_class": true, + "final_internal_class": true, + "final_public_method_for_abstract_class": true, + "fully_qualified_strict_types": true, + "global_namespace_import": { + "import_classes": true, + "import_constants": true, + "import_functions": true + }, + "heredoc_closing_marker": true, + "heredoc_indentation": { + "indentation": "same_as_start" + }, + "indentation_type": false, + "logical_operators": true, + "long_to_shorthand_operator": true, + "mb_str_functions": true, + "modern_serialization_methods": true, + "modernize_strpos": { + "modernize_stripos": true + }, + "modernize_types_casting": true, + "modifier_keywords": true, + "multiline_comment_opening_closing": true, + "multiline_promoted_properties": { + "minimum_number_of_parameters": 3 + }, + "multiline_string_to_heredoc": true, + "new_expression_parentheses": true, + "no_empty_comment": true, + "no_extra_blank_lines": { + "tokens": [ + "attribute", + "break", + "case", + "continue", + "curly_brace_block", + "default", + "extra", + "parenthesis_brace_block", + "return", + "square_brace_block", + "switch", + "throw", + "use", + "use_trait" + ] + }, + "no_homoglyph_names": true, + "no_php4_constructor": true, + "no_redundant_readonly_property": true, + "no_superfluous_elseif": true, + "no_unneeded_braces": { + "namespaces": true + }, + "no_unneeded_control_parentheses": { + "statements": [ + "break", + "clone", + "continue", + "echo_print", + "negative_instanceof", + "others", + "return", + "switch_case", + "yield", + "yield_from" + ] + }, + "no_useless_concat_operator": { + "juggle_simple_strings": true + }, + "no_useless_else": true, + "no_useless_nullsafe_operator": true, + "no_useless_printf": true, + "no_useless_sprintf": true, + "no_whitespace_before_comma_in_array": { + "after_heredoc": true + }, + "operator_linebreak": true, + "ordered_class_elements": { + "order": [ + "use_trait", + "case", + "constant", + "constant_public", + "constant_protected", + "constant_private", + "property_public", + "property_protected", + "property_private", + "construct", + "destruct", + "magic", + "phpunit", + "method_abstract", + "method_public_static", + "method_public", + "method_protected_static", + "method_protected", + "method_private_static", + "method_private" + ], + "sort_algorithm": "none" + }, + "phpdoc_annotation_without_dot": true, + "phpdoc_line_span": true, + "phpdoc_no_alias_tag": { + "replacements": { + "type": "var", + "link": "see" + } + }, + "phpdoc_no_empty_return": true, + "phpdoc_return_self_reference": true, + "phpdoc_scalar": true, + "phpdoc_tag_casing": true, + "phpdoc_trim_consecutive_blank_line_separation": true, + "phpdoc_types_no_duplicates": true, + "phpdoc_types_order": { + "null_adjustment": "always_last" + }, + "phpdoc_var_annotation_correct_order": true, + "protected_to_private": true, + "random_api_migration": true, + "regular_callable_call": true, + "return_assignment": true, + "self_accessor": true, + "set_type_to_cast": true, + "single_line_throw": true, + "single_space_around_construct": true, + "single_trait_insert_per_statement": false, + "strict_comparison": true, + "strict_param": true, + "string_length_to_empty": true, + "string_line_ending": true, + "stringable_for_to_string": true, + "ternary_to_null_coalescing": true, + "trailing_comma_in_multiline": { + "elements": ["arguments", "array_destructuring", "arrays", "match", "parameters"] + }, + "type_declaration_spaces": { + "elements": ["constant", "function", "property"] + }, + "whitespace_after_comma_in_array": { + "ensure_single_space": true + } + } } diff --git a/resources/css/app.css b/resources/css/app.css index 7395af212..db924d00c 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,4 +1,4 @@ -@import 'tailwindcss'; +@import "tailwindcss"; -@source '../../storage/framework/views/*.php'; -@source '../**/*.blade.php'; +@source "../../storage/framework/views/*.php"; +@source "../**/*.blade.php"; diff --git a/resources/js/app.ts b/resources/js/app.ts index 31fe90fb8..c6c4202a6 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -1,20 +1,21 @@ -import '../css/app.css' +import "../css/app.css"; -import { createInertiaApp } from '@inertiajs/svelte' -import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers' -import { mount, type Component } from 'svelte' +import { createInertiaApp } from "@inertiajs/svelte"; +import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers"; +import { mount, type Component } from "svelte"; createInertiaApp({ - resolve: (name: string) => resolvePageComponent(`./pages/${name}.svelte`, import.meta.glob('./pages/**/*.svelte')), - setup({ el, App, props }: { el: HTMLElement; App: Component; props: Record }) { - mount(App, { target: el, props }) - }, - defaults: { - future: { - preserveEqualProps: true, - useDataInertiaHeadAttribute: true, - useDialogForErrorModal: true, - useScriptElementForInitialPage: true, - }, - }, -}) + resolve: (name: string) => + resolvePageComponent(`./pages/${name}.svelte`, import.meta.glob("./pages/**/*.svelte")), + setup({ el, App, props }: { el: HTMLElement; App: Component; props: Record }) { + mount(App, { target: el, props }); + }, + defaults: { + future: { + preserveEqualProps: true, + useDataInertiaHeadAttribute: true, + useDialogForErrorModal: true, + useScriptElementForInitialPage: true, + }, + }, +}); diff --git a/resources/js/global.d.ts b/resources/js/global.d.ts index a0c22ab20..1232fc72e 100644 --- a/resources/js/global.d.ts +++ b/resources/js/global.d.ts @@ -1,11 +1,11 @@ declare module "@inertiajs/core" { - export interface InertiaConfig { - sharedPageProps: { - appName: string - } - // flashDataType: { - // toast?: { type: "success" | "error"; message: string }; - // }; - errorValueType: string[]; - } + export interface InertiaConfig { + sharedPageProps: { + appName: string; + }; + // flashDataType: { + // toast?: { type: "success" | "error"; message: string }; + // }; + errorValueType: string[]; + } } diff --git a/resources/js/pages/dashboard.svelte b/resources/js/pages/dashboard.svelte index 1f94450fd..b96238504 100644 --- a/resources/js/pages/dashboard.svelte +++ b/resources/js/pages/dashboard.svelte @@ -1,12 +1,13 @@ - Dashboard - {$page.props.appName} - + Dashboard - {$page.props.appName} + + -
-

Dashboard

+
+

Dashboard

diff --git a/svelte.config.ts b/svelte.config.ts index 60bb7ef04..ebfabc6c7 100644 --- a/svelte.config.ts +++ b/svelte.config.ts @@ -1,4 +1,4 @@ -import { vitePreprocess, type SvelteConfig } from '@sveltejs/vite-plugin-svelte'; +import { vitePreprocess, type SvelteConfig } from "@sveltejs/vite-plugin-svelte"; const config: SvelteConfig = { preprocess: vitePreprocess(), @@ -10,14 +10,14 @@ const config: SvelteConfig = { dev: true, experimental: { async: true, - } + }, }, vitePlugin: { inspector: { - showToggleButton: 'always', - toggleButtonPos: 'top-right' - } - } + showToggleButton: "always", + toggleButtonPos: "top-right", + }, + }, }; export default config; diff --git a/tsconfig.json b/tsconfig.json index 11f80509a..dda6673cd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,50 +1,50 @@ { - "$schema": "https://www.schemastore.org/tsconfig.json", - "files": ["vite.config.ts", "svelte.config.ts", "prettier.config.ts"], - "include": ["resources/js/**/*.ts", "resources/js/**/*.svelte"], + "$schema": "https://www.schemastore.org/tsconfig.json", + "files": ["vite.config.ts", "svelte.config.ts", "prettier.config.ts"], + "include": ["resources/js/**/*.ts", "resources/js/**/*.svelte"], - "compilerOptions": { - // Type Checking - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "exactOptionalPropertyTypes": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": true, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "strict": true, + "compilerOptions": { + // Type Checking + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "exactOptionalPropertyTypes": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, - // Modules - "allowImportingTsExtensions": true, - "module": "esnext", - "moduleResolution": "bundler", - "noUncheckedSideEffectImports": true, - "resolveJsonModule": true, - "types": ["vite/client"], + // Modules + "allowImportingTsExtensions": true, + "module": "esnext", + "moduleResolution": "bundler", + "noUncheckedSideEffectImports": true, + "resolveJsonModule": true, + "types": ["vite/client"], - // Emit - "noEmit": true, - "sourceMap": true, // Needed to have warnings/errors of the Svelte compiler at the correct position. + // Emit + "noEmit": true, + "sourceMap": true, // Needed to have warnings/errors of the Svelte compiler at the correct position. - // Interop Constraints - "erasableSyntaxOnly": true, - "esModuleInterop": true, - "verbatimModuleSyntax": true, + // Interop Constraints + "erasableSyntaxOnly": true, + "esModuleInterop": true, + "verbatimModuleSyntax": true, - // Language - "lib": ["ES2024", "DOM"], - "libReplacement": false, - "moduleDetection": "force", - "target": "ES2024", + // Language + "lib": ["ES2024", "DOM"], + "libReplacement": false, + "moduleDetection": "force", + "target": "ES2024", - // Projects - "incremental": true, - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildInfo", + // Projects + "incremental": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.tsbuildInfo", - // Completeness - "skipLibCheck": true - } + // Completeness + "skipLibCheck": true + } } diff --git a/vite.config.ts b/vite.config.ts index b3c48fe05..8a0a14283 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,30 +1,30 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import tailwindcss from '@tailwindcss/vite'; +import { defineConfig } from "vite"; +import laravel from "laravel-vite-plugin"; +import { svelte } from "@sveltejs/vite-plugin-svelte"; +import tailwindcss from "@tailwindcss/vite"; export default defineConfig({ - plugins: [ - laravel({ - input: ['resources/js/app.ts'], - refresh: true, - }), - svelte({ - configFile: 'svelte.config.ts', - // TODO: Remove once Inertia v3 https://github.com/inertiajs/inertia/tree/3.x is released and runes=true is set in svelte.config.ts - dynamicCompileOptions({ filename, compileOptions }) { - // Enforce runes mode for all files not in node_modules - if (!/[\\/]node_modules[\\/]/.test(filename) && !compileOptions.runes) { - return { runes: true }; - } - return undefined; - } - }), - tailwindcss(), - ], - server: { - watch: { - ignored: ['**/storage/framework/views/**'], - }, - }, + plugins: [ + laravel({ + input: ["resources/js/app.ts"], + refresh: true, + }), + svelte({ + configFile: "svelte.config.ts", + // TODO: Remove once Inertia v3 https://github.com/inertiajs/inertia/tree/3.x is released and runes=true is set in svelte.config.ts + dynamicCompileOptions({ filename, compileOptions }) { + // Enforce runes mode for all files not in node_modules + if (!/[\\/]node_modules[\\/]/.test(filename) && !compileOptions.runes) { + return { runes: true }; + } + return undefined; + }, + }), + tailwindcss(), + ], + server: { + watch: { + ignored: ["**/storage/framework/views/**"], + }, + }, });