Skip to content

Commit 588d2d5

Browse files
authored
Merge pull request #9 from innocenzi/refactor/remove-default-scaffold
refactor: remove default front-end scaffolding
2 parents 83519c5 + 67a7024 commit 588d2d5

File tree

10 files changed

+142
-48
lines changed

10 files changed

+142
-48
lines changed

.php-cs-fixer.dist.php

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22

3-
$finder = Symfony\Component\Finder\Finder::create()
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use Symfony\Component\Finder\Finder;
7+
8+
$finder = Finder::create()
49
->in([
510
__DIR__ . '/app',
611
__DIR__ . '/tests',
@@ -9,14 +14,67 @@
914
->ignoreDotFiles(true)
1015
->ignoreVCS(true);
1116

12-
return (new PhpCsFixer\Config())
17+
return (new Config())
1318
->setRules([
1419
'@PSR12' => true,
20+
'@PHP84Migration' => true,
21+
'ordered_attributes' => true,
22+
'ordered_traits' => true,
23+
'attribute_empty_parentheses' => true,
24+
'yoda_style' => [
25+
'equal' => false,
26+
'identical' => false,
27+
'less_and_greater' => false,
28+
],
29+
'get_class_to_class_keyword' => true,
30+
'cast_spaces' => true,
31+
'single_space_around_construct' => true,
32+
'heredoc_indentation' => true,
33+
'types_spaces' => true,
34+
'single_quote' => true,
35+
'no_short_bool_cast' => true,
36+
'explicit_string_variable' => true,
37+
'no_extra_blank_lines' => [
38+
'tokens' => [
39+
'case',
40+
'continue',
41+
'curly_brace_block',
42+
'default',
43+
'extra',
44+
'parenthesis_brace_block',
45+
'square_brace_block',
46+
'switch',
47+
'throw',
48+
'use',
49+
],
50+
],
1551
'array_syntax' => ['syntax' => 'short'],
16-
'ordered_imports' => ['sort_algorithm' => 'alpha'],
52+
'ordered_imports' => [
53+
'sort_algorithm' => 'alpha',
54+
'imports_order' => [
55+
'class',
56+
'function',
57+
'const',
58+
],
59+
],
1760
'no_unused_imports' => true,
61+
'no_unneeded_import_alias' => true,
62+
'blank_line_between_import_groups' => false,
63+
'single_import_per_statement' => true,
64+
'no_leading_import_slash' => true,
65+
'fully_qualified_strict_types' => [
66+
'import_symbols' => true,
67+
'phpdoc_tags' => [],
68+
],
69+
'global_namespace_import' => [
70+
'import_classes' => true,
71+
'import_constants' => true,
72+
'import_functions' => true,
73+
],
1874
'not_operator_with_successor_space' => true,
19-
'trailing_comma_in_multiline' => true,
75+
'trailing_comma_in_multiline' => [
76+
'elements' => ['arrays', 'arguments', 'parameters', 'match'],
77+
],
2078
'phpdoc_scalar' => true,
2179
'unary_operator_spaces' => true,
2280
'binary_operator_spaces' => true,
@@ -36,5 +94,37 @@
3694
],
3795
'single_trait_insert_per_statement' => true,
3896
'declare_strict_types' => true,
97+
'no_empty_comment' => true,
98+
'no_empty_phpdoc' => true,
99+
100+
// Test styling
101+
'php_unit_data_provider_name' => [
102+
'prefix' => 'provide_',
103+
'suffix' => '_cases',
104+
],
105+
'php_unit_data_provider_return_type' => true,
106+
'php_unit_data_provider_static' => [
107+
'force' => true,
108+
],
109+
'php_unit_dedicate_assert_internal_type' => true,
110+
'php_unit_internal_class' => true,
111+
'php_unit_method_casing' => [
112+
'case' => 'snake_case',
113+
],
114+
'php_unit_expectation' => [
115+
'target' => 'newest',
116+
],
117+
'php_unit_mock' => [
118+
'target' => 'newest',
119+
],
120+
'php_unit_mock_short_will_return' => true,
121+
'php_unit_set_up_tear_down_visibility' => true,
122+
'php_unit_size_class' => false,
123+
'php_unit_test_annotation' => [
124+
'style' => 'prefix',
125+
],
126+
'php_unit_test_case_static_method_calls' => [
127+
'call_type' => 'this',
128+
],
39129
])
40-
->setFinder($finder);
130+
->setFinder($finder);

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
```php
44
composer create-project tempest/app <project-name>
55
cd <project-name>
6-
npm run dev
6+
php tempest serve
77
```
88

9-
Read all about Tempest in [the docs](https://github.com/tempestphp/tempest-docs/blob/master/01-getting-started.md).
9+
Read all about Tempest in [the docs](https://github.com/tempestphp/tempest-docs/blob/master/01-getting-started.md).

app/HomeController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
namespace App;
66

7-
use Tempest\Http\Get;
8-
9-
use function Tempest\view;
10-
7+
use Tempest\Router\Get;
118
use Tempest\View\View;
9+
use function Tempest\view;
1210

1311
final readonly class HomeController
1412
{

app/home.view.php

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
<html lang="en">
22
<head>
3-
<title>Tempest</title>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<link href="/main.css" rel="stylesheet">
3+
<title>Tempest</title>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="https://cdn.tailwindcss.com"></script>
77
</head>
8-
<body class="flex justify-center items-center">
9-
10-
<h1 class="text-5xl font-bold text-[#4f95d1]">Tempest</h1>
11-
8+
<body>
9+
<main class="w-screen h-screen overflow-hidden bg-sky-100/20">
10+
<div class="relative isolate px-6 lg:px-8 flex flex-col items-center justify-center h-full">
11+
<!-- Background gradient -->
12+
<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">
13+
<div
14+
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]"
15+
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%)"
16+
></div>
17+
</div>
18+
<!-- Bottom gradient -->
19+
<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">
20+
<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>
21+
</div>
22+
<!-- Hero section -->
23+
<div class="mx-auto max-w-2xl py-32 sm:py-48 lg:py-56">
24+
<div class="text-center">
25+
<!-- Text -->
26+
<h1 class="text-balance text-5xl font-semibold tracking-tight text-gray-800 sm:text-7xl">Tempest</h1>
27+
<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>
28+
<!-- CTAs -->
29+
<div class="mt-10 flex flex-col sm:flex-row gap-y-4 items-center justify-center gap-x-6">
30+
<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>
31+
<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>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</main>
1237
</body>
13-
</html>
38+
</html>

app/main.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"./tempest discovery:generate"
3737
],
3838
"phpunit": "vendor/bin/phpunit --display-warnings --display-skipped --display-deprecations --display-errors --display-notices",
39-
"csfixer": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
39+
"csfixer": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --allow-risky=yes",
4040
"phpstan": "vendor/bin/phpstan analyse tests app",
4141
"qa": [
4242
"composer csfixer",

package.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

public/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22

3-
use Tempest\Http\HttpApplication;
3+
declare(strict_types=1);
4+
5+
use Tempest\Router\HttpApplication;
46

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

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

9-
exit;
11+
exit;

tailwind.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/HomeControllerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace Tests;
66

7-
class HomeControllerTest extends IntegrationTestCase
7+
/**
8+
* @internal
9+
*/
10+
final class HomeControllerTest extends IntegrationTestCase
811
{
912
public function test_index(): void
1013
{

0 commit comments

Comments
 (0)