Skip to content

Commit

Permalink
Merge pull request #9 from innocenzi/refactor/remove-default-scaffold
Browse files Browse the repository at this point in the history
refactor: remove default front-end scaffolding
  • Loading branch information
brendt authored Dec 12, 2024
2 parents 83519c5 + 67a7024 commit 588d2d5
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 48 deletions.
100 changes: 95 additions & 5 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
declare(strict_types=1);

use PhpCsFixer\Config;
use Symfony\Component\Finder\Finder;

$finder = Finder::create()
->in([
__DIR__ . '/app',
__DIR__ . '/tests',
Expand All @@ -9,14 +14,67 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config())
return (new Config())
->setRules([
'@PSR12' => true,
'@PHP84Migration' => true,
'ordered_attributes' => true,
'ordered_traits' => true,
'attribute_empty_parentheses' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
'get_class_to_class_keyword' => true,
'cast_spaces' => true,
'single_space_around_construct' => true,
'heredoc_indentation' => true,
'types_spaces' => true,
'single_quote' => true,
'no_short_bool_cast' => true,
'explicit_string_variable' => true,
'no_extra_blank_lines' => [
'tokens' => [
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'square_brace_block',
'switch',
'throw',
'use',
],
],
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => [
'class',
'function',
'const',
],
],
'no_unused_imports' => true,
'no_unneeded_import_alias' => true,
'blank_line_between_import_groups' => false,
'single_import_per_statement' => true,
'no_leading_import_slash' => true,
'fully_qualified_strict_types' => [
'import_symbols' => true,
'phpdoc_tags' => [],
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline' => true,
'trailing_comma_in_multiline' => [
'elements' => ['arrays', 'arguments', 'parameters', 'match'],
],
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
Expand All @@ -36,5 +94,37 @@
],
'single_trait_insert_per_statement' => true,
'declare_strict_types' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,

// Test styling
'php_unit_data_provider_name' => [
'prefix' => 'provide_',
'suffix' => '_cases',
],
'php_unit_data_provider_return_type' => true,
'php_unit_data_provider_static' => [
'force' => true,
],
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_internal_class' => true,
'php_unit_method_casing' => [
'case' => 'snake_case',
],
'php_unit_expectation' => [
'target' => 'newest',
],
'php_unit_mock' => [
'target' => 'newest',
],
'php_unit_mock_short_will_return' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_size_class' => false,
'php_unit_test_annotation' => [
'style' => 'prefix',
],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
],
])
->setFinder($finder);
->setFinder($finder);
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```php
composer create-project tempest/app <project-name>
cd <project-name>
npm run dev
php tempest serve
```

Read all about Tempest in [the docs](https://github.com/tempestphp/tempest-docs/blob/master/01-getting-started.md).
Read all about Tempest in [the docs](https://github.com/tempestphp/tempest-docs/blob/master/01-getting-started.md).
6 changes: 2 additions & 4 deletions app/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

namespace App;

use Tempest\Http\Get;

use function Tempest\view;

use Tempest\Router\Get;
use Tempest\View\View;
use function Tempest\view;

final readonly class HomeController
{
Expand Down
43 changes: 34 additions & 9 deletions app/home.view.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
<html lang="en">
<head>
<title>Tempest</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/main.css" rel="stylesheet">
<title>Tempest</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="flex justify-center items-center">
<h1 class="text-5xl font-bold text-[#4f95d1]">Tempest</h1>
<body>
<main class="w-screen h-screen overflow-hidden bg-sky-100/20">
<div class="relative isolate px-6 lg:px-8 flex flex-col items-center justify-center h-full">
<!-- Background gradient -->
<div class="pointer-events-none absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80" aria-hidden="true">
<div
class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-[#7fbdea] to-[#9980fc] opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
></div>
</div>
<!-- Bottom gradient -->
<div class="pointer-events-none absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]" aria-hidden="true">
<div class="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-[#7fbdea] to-[#9980fc] opacity-20 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]" style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"></div>
</div>
<!-- Hero section -->
<div class="mx-auto max-w-2xl py-32 sm:py-48 lg:py-56">
<div class="text-center">
<!-- Text -->
<h1 class="text-balance text-5xl font-semibold tracking-tight text-gray-800 sm:text-7xl">Tempest</h1>
<p class="mt-8 text-pretty text-lg font-medium text-gray-500 sm:text-xl/8">The modern PHP framework that gets out of your way. Focus on your application code, not on framework quirks.</p>
<!-- CTAs -->
<div class="mt-10 flex flex-col sm:flex-row gap-y-4 items-center justify-center gap-x-6">
<a href="https://tempestphp.com/docs/framework/getting-started" target="_blank" class="rounded-md bg-sky-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600">Documentation</a>
<a href="https://tempestphp.com/discord" class="text-sm/6 font-semibold text-gray-900 focus-visible:outline-none focus-visible:underline focus-visible:underline-offset-4 focus-visible:decoration-gray-300">Join our Discord <span aria-hidden="true">→</span></a>
</div>
</div>
</div>
</div>
</main>
</body>
</html>
</html>
3 changes: 0 additions & 3 deletions app/main.css

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"./tempest discovery:generate"
],
"phpunit": "vendor/bin/phpunit --display-warnings --display-skipped --display-deprecations --display-errors --display-notices",
"csfixer": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
"csfixer": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --allow-risky=yes",
"phpstan": "vendor/bin/phpstan analyse tests app",
"qa": [
"composer csfixer",
Expand Down
9 changes: 0 additions & 9 deletions package.json

This file was deleted.

6 changes: 4 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

use Tempest\Http\HttpApplication;
declare(strict_types=1);

use Tempest\Router\HttpApplication;

require_once __DIR__ . '/../vendor/autoload.php';

HttpApplication::boot(__DIR__ . '/../')->run();

exit;
exit;
12 changes: 0 additions & 12 deletions tailwind.config.js

This file was deleted.

5 changes: 4 additions & 1 deletion tests/HomeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

namespace Tests;

class HomeControllerTest extends IntegrationTestCase
/**
* @internal
*/
final class HomeControllerTest extends IntegrationTestCase
{
public function test_index(): void
{
Expand Down

0 comments on commit 588d2d5

Please sign in to comment.