diff --git a/.github/workflows/publish-website.yml b/.github/workflows/publish-website.yml index 75fd67f71..a6a28f4bc 100644 --- a/.github/workflows/publish-website.yml +++ b/.github/workflows/publish-website.yml @@ -50,6 +50,9 @@ jobs: - name: "Build" run: "composer build" + env: + DOMAIN: flow-php.com + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} working-directory: "web/landing" - name: Pushes build to website repository diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index decbdb6a5..f4a85883d 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -7,7 +7,6 @@ on: - 'src/adapter/**' - 'src/core/**' - 'src/lib/**' - - 'web/**' - 'tools/**' - 'composer.lock' push: @@ -215,51 +214,4 @@ jobs: FLOW_LOCAL_FILESYSTEM_CACHE_DIR: "./var/cache/${{ matrix.php-version }}-${{ matrix.dependencies }}" - name: "Run Examples" - run: "php examples/run.php" - - website-tests: - name: "Website Tests" - - runs-on: ${{ matrix.operating-system }} - - strategy: - fail-fast: false - matrix: - php-version: - - "8.1" - operating-system: - - "ubuntu-latest" - - steps: - - name: "Checkout" - uses: "actions/checkout@v4" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: pcov - tools: composer:v2 - php-version: "${{ matrix.php-version }}" - ini-values: memory_limit=-1 - extensions: :psr - - - name: "Get Composer Cache Directory" - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: "Cache Composer dependencies" - uses: "actions/cache@v3" - with: - path: "${{ steps.composer-cache.outputs.dir }}" - key: "php-${{ matrix.php-version }}-composer-website-${{ hashFiles('web/landing/composer.lock') }}" - restore-keys: | - php-${{ matrix.php-version }}-composer-website- - - - name: "Install dependencies" - run: "composer install --no-interaction --no-progress --no-suggest" - working-directory: "web/landing" - - - name: "Test" - run: "composer test" - working-directory: "web/landing" \ No newline at end of file + run: "php examples/run.php" \ No newline at end of file diff --git a/.github/workflows/test-website.yml b/.github/workflows/test-website.yml new file mode 100644 index 000000000..015ef12c1 --- /dev/null +++ b/.github/workflows/test-website.yml @@ -0,0 +1,63 @@ +name: Test Website + +on: + pull_request: + paths: + - '.github/workflows/**' + - 'web/**' + + push: + branches: [ 1.x ] + +# See https://stackoverflow.com/a/72408109 +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + website-tests: + name: "Website Tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + fail-fast: false + matrix: + php-version: + - "8.1" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: pcov + tools: composer:v2 + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + extensions: :psr + + - name: "Get Composer Cache Directory" + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: "Cache Composer dependencies" + uses: "actions/cache@v3" + with: + path: "${{ steps.composer-cache.outputs.dir }}" + key: "php-${{ matrix.php-version }}-composer-website-${{ hashFiles('web/landing/composer.lock') }}" + restore-keys: | + php-${{ matrix.php-version }}-composer-website- + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress --no-suggest" + working-directory: "web/landing" + + - name: "Test" + run: "composer test" + working-directory: "web/landing" \ No newline at end of file diff --git a/web/landing/.env b/web/landing/.env index b4686c06c..c359a78ac 100644 --- a/web/landing/.env +++ b/web/landing/.env @@ -1,3 +1,4 @@ APP_ENV=dev APP_SECRET=04f48bdb7d5426b4c5ba6aaf3d00a1fa +DOMAIN='flow-php.wip' GITHUB_TOKEN=changeme diff --git a/web/landing/.gitignore b/web/landing/.gitignore index 2f0cb2fdf..03de6899e 100644 --- a/web/landing/.gitignore +++ b/web/landing/.gitignore @@ -1,4 +1,5 @@ .env.local +/.env.*.local build/ vendor/ var/ diff --git a/web/landing/assets/images/icons/github.svg b/web/landing/assets/images/icons/github.svg new file mode 100644 index 000000000..e3825e159 --- /dev/null +++ b/web/landing/assets/images/icons/github.svg @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/web/landing/composer.json b/web/landing/composer.json index 4f12278e7..1f68e588a 100644 --- a/web/landing/composer.json +++ b/web/landing/composer.json @@ -21,7 +21,8 @@ "symfony/dotenv": "^6.4", "symfony/stimulus-bundle": "^2.14", "monolog/monolog": "^3.5", - "symfony/monolog-bundle": "^3.10" + "symfony/monolog-bundle": "^3.10", + "coduo/php-humanizer": "^4.0" }, "require-dev": { "symfony/web-profiler-bundle": "^6.4", @@ -73,9 +74,14 @@ "bin/console tailwind:build" ], "build": [ - "@build:assets", - "bin/console static-content-generator:generate:routes --clean", - "bin/console static-content-generator:copy:assets -d public" + "rm -rf public/assets", + "rm -rf build", + "APP_ENV=prod bin/console cache:clear", + "APP_ENV=prod bin/console importmap:install", + "APP_ENV=prod bin/console asset-map:compile", + "APP_ENV=prod bin/console tailwind:build --minify", + "APP_ENV=prod bin/console static-content-generator:generate:routes --clean", + "APP_ENV=prod bin/console static-content-generator:copy:assets -d public" ] } } diff --git a/web/landing/composer.lock b/web/landing/composer.lock index 78f6d7efc..3e0408763 100644 --- a/web/landing/composer.lock +++ b/web/landing/composer.lock @@ -4,8 +4,58 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0da2f5f78e64a47175b7d381d5428399", + "content-hash": "6b034259398212dc0fbc262813686f37", "packages": [ + { + "name": "aeon-php/calendar", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/aeon-php/calendar.git", + "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aeon-php/calendar/zipball/2cfc45a2cd28b78f1450d8155a1c62df2efe45de", + "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de", + "shasum": "" + }, + "require": { + "php": "~8.1.10 || ~8.2" + }, + "require-dev": { + "ext-bcmath": "*", + "ext-pcov": "*" + }, + "suggest": { + "ext-bcmath": "Compare time units with high precision" + }, + "type": "library", + "autoload": { + "psr-4": { + "Aeon\\": [ + "src/Aeon" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHP type safe, immutable calendar library", + "keywords": [ + "calendar", + "date", + "datetime", + "immutable", + "time" + ], + "support": { + "issues": "https://github.com/aeon-php/calendar/issues", + "source": "https://github.com/aeon-php/calendar/tree/1.0.9" + }, + "time": "2023-08-29T09:47:37+00:00" + }, { "name": "clue/stream-filter", "version": "v1.7.0", @@ -72,6 +122,65 @@ ], "time": "2023-12-20T15:40:13+00:00" }, + { + "name": "coduo/php-humanizer", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/coduo/php-humanizer.git", + "reference": "1158b443ef197a0bc84bf4aff46743fb2767b4a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/coduo/php-humanizer/zipball/1158b443ef197a0bc84bf4aff46743fb2767b4a4", + "reference": "1158b443ef197a0bc84bf4aff46743fb2767b4a4", + "shasum": "" + }, + "require": { + "aeon-php/calendar": "^0.16.1 || ^1.0", + "php": "~7.4 || ~8.0 || ~8.1", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.4", + "thunderer/shortcode": "^0.7" + }, + "suggest": { + "ext-intl": "Required if you are going to use humanizer with locales different than en_EN" + }, + "type": "library", + "autoload": { + "psr-4": { + "": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michał Dąbrowski", + "email": "dabrowski@brillante.pl" + }, + { + "name": "Norbert Orzechowicz", + "email": "norbert@orzechowicz.pl" + } + ], + "description": "Humanize values that are readable only for developers", + "keywords": [ + "humanize", + "humanizer", + "php" + ], + "support": { + "issues": "https://github.com/coduo/php-humanizer/issues", + "source": "https://github.com/coduo/php-humanizer/tree/4.0.3" + }, + "time": "2022-06-07T18:50:44+00:00" + }, { "name": "composer/semver", "version": "3.4.0", @@ -3929,6 +4038,101 @@ ], "time": "2024-01-25T09:26:29+00:00" }, + { + "name": "symfony/translation", + "version": "v6.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "637c51191b6b184184bbf98937702bcf554f7d04" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", + "reference": "637c51191b6b184184bbf98937702bcf554f7d04", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation-contracts": "^2.5|^3.0" + }, + "conflict": { + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", + "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" + }, + "provide": { + "symfony/translation-implementation": "2.3|3.0" + }, + "require-dev": { + "nikic/php-parser": "^4.18|^5.0", + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v6.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T13:11:52+00:00" + }, { "name": "symfony/translation-contracts", "version": "v3.4.1", @@ -4555,56 +4759,6 @@ } ], "packages-dev": [ - { - "name": "aeon-php/calendar", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/aeon-php/calendar.git", - "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aeon-php/calendar/zipball/2cfc45a2cd28b78f1450d8155a1c62df2efe45de", - "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de", - "shasum": "" - }, - "require": { - "php": "~8.1.10 || ~8.2" - }, - "require-dev": { - "ext-bcmath": "*", - "ext-pcov": "*" - }, - "suggest": { - "ext-bcmath": "Compare time units with high precision" - }, - "type": "library", - "autoload": { - "psr-4": { - "Aeon\\": [ - "src/Aeon" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHP type safe, immutable calendar library", - "keywords": [ - "calendar", - "date", - "datetime", - "immutable", - "time" - ], - "support": { - "issues": "https://github.com/aeon-php/calendar/issues", - "source": "https://github.com/aeon-php/calendar/tree/1.0.9" - }, - "time": "2023-08-29T09:47:37+00:00" - }, { "name": "aeon-php/sleep", "version": "1.0.9", diff --git a/web/landing/config/bundles.php b/web/landing/config/bundles.php index c7d5e6a5d..9242ce93f 100644 --- a/web/landing/config/bundles.php +++ b/web/landing/config/bundles.php @@ -4,8 +4,8 @@ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['dev' => true, 'test' => true], - NorbertTech\StaticContentGeneratorBundle\StaticContentGeneratorBundle::class => ['dev' => true, 'test' => true], + Symfonycasts\TailwindBundle\SymfonycastsTailwindBundle::class => ['all' => true], + NorbertTech\StaticContentGeneratorBundle\StaticContentGeneratorBundle::class => ['all' => true], Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], ]; diff --git a/web/landing/config/packages/framework.yaml b/web/landing/config/packages/framework.yaml index 0d1fad79d..74f256afe 100644 --- a/web/landing/config/packages/framework.yaml +++ b/web/landing/config/packages/framework.yaml @@ -6,6 +6,8 @@ framework: handle_all_throwables: true php_errors: log: true + router: + default_uri: 'https://%domain%/' when@test: framework: diff --git a/web/landing/config/services.yaml b/web/landing/config/services.yaml index cee4a7476..a366498ad 100644 --- a/web/landing/config/services.yaml +++ b/web/landing/config/services.yaml @@ -1,6 +1,7 @@ # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: - examples_path: '../../examples' + examples_path: '%kernel.project_dir%/../../examples' + domain: '%env(DOMAIN)%' services: _defaults: @@ -25,4 +26,8 @@ services: Flow\Website\Service\Examples: arguments: - $examplesPath: '%examples_path%' \ No newline at end of file + $examplesPath: '%examples_path%' + + Flow\Website\Twig\: + resource: '../src/Flow/Website/Twig/**/*Extension.php' + tags: [twig.extension] \ No newline at end of file diff --git a/web/landing/src/Flow/Website/Twig/HumanizerExtension.php b/web/landing/src/Flow/Website/Twig/HumanizerExtension.php new file mode 100644 index 000000000..20102f539 --- /dev/null +++ b/web/landing/src/Flow/Website/Twig/HumanizerExtension.php @@ -0,0 +1,24 @@ + -