#1: Setup Config

This commit is contained in:
Snoweuph 2024-04-22 20:52:51 +02:00
parent f96c46ff99
commit a5f1725109
Signed by: Snoweuph
GPG key ID: A494330694B208EF
45 changed files with 1114 additions and 270 deletions

View file

@ -4,8 +4,5 @@ APP_SECRET=3a451032bf2c8c9a639dfb642ce825d0
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ### ###> doctrine/doctrine-bundle ###
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
DATABASE_URL="mysql://root:empty@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" DATABASE_URL="mysql://root:empty@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###

View file

@ -1,6 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel' KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st' APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999 SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
TEST_TOKEN="_test"

View file

@ -35,6 +35,13 @@
"strict": "error", "strict": "error",
"array-bracket-newline": "error", "array-bracket-newline": "error",
"yoda": "error", "yoda": "error",
"@typescript-eslint/ban-tslint-comment": "off" "@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"@typescript-eslint/ban-tslint-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off"
} }
} }

3
app/.stylelintignore Normal file
View file

@ -0,0 +1,3 @@
*.*
!*.css
!*.scss

13
app/.stylelintrc.json Normal file
View file

@ -0,0 +1,13 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"rules": {
"custom-property-empty-line-before": null,
"declaration-empty-line-before": null,
"media-feature-range-notation": null,
"import-notation": "string",
"scss/no-global-function-names": null
}
}

View file

@ -17,7 +17,7 @@ up: ## Starts the Local Instance
down: ## Stops the Local Instance down: ## Stops the Local Instance
ifneq (,$(wildcard ./npm-watch.pid)) ifneq (,$(wildcard ./npm-watch.pid))
@printf "${RED}Killing ${YELLOW}Encore${CLEAR}!\n" @printf "${RED}Killing ${YELLOW}Encore${CLEAR}!\n"
kill $$(cat ./npm-watch.pid) @- kill $$(cat ./npm-watch.pid)
@rm -rf ./npm-watch.pid @rm -rf ./npm-watch.pid
endif endif
@symfony local:server:stop @symfony local:server:stop
@ -33,6 +33,12 @@ fresh: ## Starts a Fresh Local Instance
##|——[ Code Quality ]————————————————————————————————————————————————————————————————————| ##|——[ Code Quality ]————————————————————————————————————————————————————————————————————|
test: ## Runs all Unittests test: ## Runs all Unittests
@docker compose up -d
@symfony console doctrine:database:drop --if-exists --force --env=test
@symfony console doctrine:database:create --env=test
@symfony console doctrine:migrations:migrate -n --env=test
@symfony console doctrine:fixtures:load -n --env=test
@symfony console cache:clear --env=test
vendor/bin/phpunit vendor/bin/phpunit
analyze: ## Runs Static Code Analysis analyze: ## Runs Static Code Analysis
@ -42,22 +48,39 @@ lint: ## Runs the Linters
@make lint-php -s @make lint-php -s
@make lint-ts -s @make lint-ts -s
@make lint-twig -s @make lint-twig -s
@make lint-scss -s
##|——[ Testing ]—————————————————————————————————————————————————————————————————————————|
test-unit: ## Runs the Unit tests
vendor/bin/phpunit --testsuite Unit
test-integration: ## Runs the Integration tests
@symfony console doctrine:fixtures:load -n --env=test
vendor/bin/phpunit --testsuite Integration
test-web: ## Runs the Web tests
@symfony console doctrine:fixtures:load -n --env=test
vendor/bin/phpunit --testsuite Web
##|——[ Linting ]—————————————————————————————————————————————————————————————————————————|
lint-php: ## Runs the PHP Linting lint-php: ## Runs the PHP Linting
vendor/bin/php-cs-fixer fix --allow-risky=yes vendor/bin/php-cs-fixer fix --allow-risky=yes
lint-ts: ## Runs the Typescript Linting lint-ts: ## Runs the Typescript Linting
npm run lint:fix npm run lint:ts:fix
lint-twig: ## Runs Twig Linting lint-twig: ## Runs Twig Linting
vendor/bin/twig-cs-fixer lint --fix vendor/bin/twig-cs-fixer lint --fix
php bin/console lint:twig php bin/console lint:twig
lint-scss: ## Runs Twig Linting
npm run lint:scss:fix
##|——[ Data ]————————————————————————————————————————————————————————————————————————————| ##|——[ Data ]————————————————————————————————————————————————————————————————————————————|
db-demo: ## Writes the Demo Data to the Local Instance db-demo: ## Writes the Demo Data to the Local Instance
symfony console doctrine:database:drop --if-exists --force symfony console doctrine:database:drop --if-exists --force
symfony console doctrine:database:create symfony console doctrine:database:create
symfony console doctrine:schema:update --force symfony console doctrine:migrations:migrate -n
symfony console doctrine:fixtures:load -n symfony console doctrine:fixtures:load -n
symfony console cache:clear symfony console cache:clear

View file

@ -1 +1,2 @@
import './styles/app.scss'; import '@styles/app.scss';
import '@packages/stimulus';

View file

@ -1,10 +0,0 @@
import { startStimulusApp } from '@symfony/stimulus-bridge';
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.[jt]sx?$/
));
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);

View file

@ -1,16 +0,0 @@
import { Controller } from '@hotwired/stimulus';
/*
* This is an example Stimulus controller!
*
* Any element with a data-controller="hello" attribute will cause
* this controller to be executed. The name "hello" comes from the filename:
* hello_controller.js -> "hello"
*
* Delete this file or adapt it for your use!
*/
export default class extends Controller {
connect() {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View file

@ -0,0 +1,7 @@
import {Controller} from '@hotwired/stimulus';
export default class extends Controller {
connect(): void {
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
}
}

View file

@ -0,0 +1,8 @@
import {startStimulusApp} from '@symfony/stimulus-bridge';
import {Application} from '@hotwired/stimulus';
export const app: Application = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!@controllers',
true,
/\.[jt]sx?$/
));

View file

@ -1,3 +1,3 @@
body { :root {
background-color: lightgray; $gitKeep: true;
} }

View file

@ -1 +0,0 @@
{}

View file

@ -7,7 +7,7 @@
"php": ">=8.1", "php": ">=8.1",
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.11", "doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.0", "doctrine/orm": "^3.0",
"symfony/asset": "6.3.*", "symfony/asset": "6.3.*",
@ -78,6 +78,7 @@
} }
}, },
"require-dev": { "require-dev": {
"dama/doctrine-test-bundle": "^8.0",
"doctrine/doctrine-fixtures-bundle": "^3.5", "doctrine/doctrine-fixtures-bundle": "^3.5",
"friendsofphp/php-cs-fixer": "^3.49", "friendsofphp/php-cs-fixer": "^3.49",
"phpstan/extension-installer": "^1.3", "phpstan/extension-installer": "^1.3",

95
app/composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "2570c00daac6d35734750c2b68354551", "content-hash": "649904898a2e335698ea9d74665dcdd2",
"packages": [ "packages": [
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@ -342,16 +342,16 @@
}, },
{ {
"name": "doctrine/doctrine-bundle", "name": "doctrine/doctrine-bundle",
"version": "2.11.1", "version": "2.12.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/DoctrineBundle.git", "url": "https://github.com/doctrine/DoctrineBundle.git",
"reference": "4089f1424b724786c062aea50aae5f773449b94b" "reference": "5418e811a14724068e95e0ba43353b903ada530f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/4089f1424b724786c062aea50aae5f773449b94b", "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/5418e811a14724068e95e0ba43353b903ada530f",
"reference": "4089f1424b724786c062aea50aae5f773449b94b", "reference": "5418e811a14724068e95e0ba43353b903ada530f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -372,23 +372,24 @@
}, },
"conflict": { "conflict": {
"doctrine/annotations": ">=3.0", "doctrine/annotations": ">=3.0",
"doctrine/orm": "<2.14 || >=4.0", "doctrine/orm": "<2.17 || >=4.0",
"twig/twig": "<1.34 || >=2.0 <2.4" "twig/twig": "<1.34 || >=2.0 <2.4"
}, },
"require-dev": { "require-dev": {
"doctrine/annotations": "^1 || ^2", "doctrine/annotations": "^1 || ^2",
"doctrine/coding-standard": "^12", "doctrine/coding-standard": "^12",
"doctrine/deprecations": "^1.0", "doctrine/deprecations": "^1.0",
"doctrine/orm": "^2.14 || ^3.0", "doctrine/orm": "^2.17 || ^3.0",
"friendsofphp/proxy-manager-lts": "^1.0", "friendsofphp/proxy-manager-lts": "^1.0",
"phpunit/phpunit": "^9.5.26 || ^10.0", "phpunit/phpunit": "^9.5.26",
"psalm/plugin-phpunit": "^0.18.4", "psalm/plugin-phpunit": "^0.18.4",
"psalm/plugin-symfony": "^4", "psalm/plugin-symfony": "^5",
"psr/log": "^1.1.4 || ^2.0 || ^3.0", "psr/log": "^1.1.4 || ^2.0 || ^3.0",
"symfony/phpunit-bridge": "^6.1 || ^7.0", "symfony/phpunit-bridge": "^6.1 || ^7.0",
"symfony/property-info": "^5.4 || ^6.0 || ^7.0", "symfony/property-info": "^5.4 || ^6.0 || ^7.0",
"symfony/proxy-manager-bridge": "^5.4 || ^6.0 || ^7.0", "symfony/proxy-manager-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/security-bundle": "^5.4 || ^6.0 || ^7.0", "symfony/security-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0",
"symfony/string": "^5.4 || ^6.0 || ^7.0", "symfony/string": "^5.4 || ^6.0 || ^7.0",
"symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0", "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/validator": "^5.4 || ^6.0 || ^7.0", "symfony/validator": "^5.4 || ^6.0 || ^7.0",
@ -396,7 +397,7 @@
"symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"twig/twig": "^1.34 || ^2.12 || ^3.0", "twig/twig": "^1.34 || ^2.12 || ^3.0",
"vimeo/psalm": "^4.30" "vimeo/psalm": "^5.15"
}, },
"suggest": { "suggest": {
"doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.",
@ -406,7 +407,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Doctrine\\Bundle\\DoctrineBundle\\": "" "Doctrine\\Bundle\\DoctrineBundle\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -441,7 +442,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/DoctrineBundle/issues", "issues": "https://github.com/doctrine/DoctrineBundle/issues",
"source": "https://github.com/doctrine/DoctrineBundle/tree/2.11.1" "source": "https://github.com/doctrine/DoctrineBundle/tree/2.12.0"
}, },
"funding": [ "funding": [
{ {
@ -457,7 +458,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-15T20:01:50+00:00" "time": "2024-03-19T07:20:37+00:00"
}, },
{ {
"name": "doctrine/doctrine-migrations-bundle", "name": "doctrine/doctrine-migrations-bundle",
@ -5565,6 +5566,74 @@
], ],
"time": "2022-02-25T21:32:43+00:00" "time": "2022-02-25T21:32:43+00:00"
}, },
{
"name": "dama/doctrine-test-bundle",
"version": "v8.0.2",
"source": {
"type": "git",
"url": "https://github.com/dmaicher/doctrine-test-bundle.git",
"reference": "f10de294e41570d027a301554a609c394d40e669"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dmaicher/doctrine-test-bundle/zipball/f10de294e41570d027a301554a609c394d40e669",
"reference": "f10de294e41570d027a301554a609c394d40e669",
"shasum": ""
},
"require": {
"doctrine/dbal": "^3.3 || ^4.0",
"doctrine/doctrine-bundle": "^2.2.2",
"ext-json": "*",
"php": "^7.3 || ^8.0",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/cache": "^5.4 || ^6.3 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.3 || ^7.0"
},
"require-dev": {
"behat/behat": "^3.0",
"friendsofphp/php-cs-fixer": "^3.27",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0",
"symfony/phpunit-bridge": "^6.3",
"symfony/process": "^5.4 || ^6.3 || ^7.0",
"symfony/yaml": "^5.4 || ^6.3 || ^7.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "8.x-dev"
}
},
"autoload": {
"psr-4": {
"DAMA\\DoctrineTestBundle\\": "src/DAMA/DoctrineTestBundle"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "David Maicher",
"email": "mail@dmaicher.de"
}
],
"description": "Symfony bundle to isolate doctrine database tests and improve test performance",
"keywords": [
"doctrine",
"isolation",
"performance",
"symfony",
"testing",
"tests"
],
"support": {
"issues": "https://github.com/dmaicher/doctrine-test-bundle/issues",
"source": "https://github.com/dmaicher/doctrine-test-bundle/tree/v8.0.2"
},
"time": "2024-02-15T08:28:14+00:00"
},
{ {
"name": "doctrine/data-fixtures", "name": "doctrine/data-fixtures",
"version": "1.7.0", "version": "1.7.0",

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
return [ return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
@ -12,4 +14,5 @@ return [
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
]; ];

View file

@ -1,19 +1,2 @@
framework: framework:
cache: cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null

View file

@ -0,0 +1,5 @@
when@test:
dama_doctrine_test:
enable_static_connection: true
enable_static_meta_data_cache: true
enable_static_query_cache: true

View file

@ -1,5 +1,3 @@
when@dev: when@dev:
debug: debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View file

@ -13,15 +13,17 @@ doctrine:
App: App:
type: attribute type: attribute
is_bundle: false is_bundle: false
dir: '%kernel.project_dir%/src/Entity' dir: '%kernel.project_dir%/src'
prefix: 'App\Entity' prefix: 'App'
alias: App alias: App
when@test: when@test:
doctrine: doctrine:
dbal: dbal:
# "TEST_TOKEN" is typically set by ParaTest connections:
dbname_suffix: '_test%env(default::TEST_TOKEN)%' default:
dbname_suffix: '%env(TEST_TOKEN)%'
use_savepoints: true
when@prod: when@prod:
doctrine: doctrine:

View file

@ -1,6 +1,4 @@
doctrine_migrations: doctrine_migrations:
migrations_paths: migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations' 'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: false enable_profiler: false

View file

@ -1,20 +1,14 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework: framework:
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false http_method_override: false
handle_all_throwables: true handle_all_throwables: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session: session:
handler_id: null handler_id: null
cookie_secure: auto cookie_secure: auto
cookie_samesite: lax cookie_samesite: lax
storage_factory_id: session.storage.factory.native storage_factory_id: session.storage.factory.native
#esi: true
#fragments: true
php_errors: php_errors:
log: true log: true
@ -23,3 +17,8 @@ when@test:
test: true test: true
session: session:
storage_factory_id: session.storage.factory.mock_file storage_factory_id: session.storage.factory.mock_file
when@prod:
framework:
session:
handler_id: 'file://%kernel_project_dir%/var/sessions'

View file

@ -10,14 +10,6 @@ when@dev:
path: "%kernel.logs_dir%/%kernel.environment%.log" path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug level: debug
channels: ["!event"] channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console: console:
type: console type: console
process_psr_3_messages: false process_psr_3_messages: false
@ -48,7 +40,7 @@ when@prod:
buffer_size: 50 # How many messages should be saved? Prevent memory leaks buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested: nested:
type: stream type: stream
path: php://stderr path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug level: debug
formatter: monolog.formatter.json formatter: monolog.formatter.json
console: console:
@ -58,5 +50,4 @@ when@prod:
deprecation: deprecation:
type: stream type: stream
channels: [deprecation] channels: [deprecation]
path: php://stderr path: "%kernel.logs_dir%/%kernel.environment%.log"
formatter: monolog.formatter.json

View file

@ -2,10 +2,6 @@ framework:
router: router:
utf8: true utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost
when@prod: when@prod:
framework: framework:
router: router:

View file

@ -2,11 +2,6 @@ framework:
validation: validation:
email_validation_mode: html5 email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
when@test: when@test:
framework: framework:
validation: validation:

View file

@ -1,45 +1,8 @@
webpack_encore: webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build' output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# Set attributes that will be rendered on all script and link tags
script_attributes: script_attributes:
defer: true defer: true
# Uncomment (also under link_attributes) if using Turbo Drive
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
# 'data-turbo-track': reload
# link_attributes:
# Uncomment if using Turbo Drive
# 'data-turbo-track': reload
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# If you have multiple builds:
# builds:
# frontend: '%kernel.project_dir%/public/frontend/build'
# pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
framework: framework:
assets: assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
#when@prod:
# webpack_encore:
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# # Available in version 1.2
# cache: true
#when@test:
# webpack_encore:
# strict_mode: false

View file

@ -1,5 +1,7 @@
<?php <?php
declare(strict_types=1);
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) { if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php'; require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
} }

7
app/config/routes.php Normal file
View file

@ -0,0 +1,7 @@
<?php
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return function (RoutingConfigurator $routes) {
$routes->import('../src/*', 'attribute');
};

View file

@ -1,5 +0,0 @@
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute

18
app/config/services.php Normal file
View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function (ContainerConfigurator $container): void {
$services = $container->services()
->defaults()
->autowire()
->autoconfigure()
;
$services
->load('App\\', '../src/')
->exclude('../src/{DependencyInjection,Entity,Kernel.php}')
;
};

View file

@ -1,24 +0,0 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

View file

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function (ContainerConfigurator $container): void {
$services = $container->services()
->defaults()
->autowire()
->autoconfigure();
$services->load('DoctrineFixtures\\', '../fixtures');
};

View file

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return function (ContainerConfigurator $container): void {
$services = $container->services()
->defaults()
->autowire()
->autoconfigure();
$services->load('DoctrineFixtures\\', '../fixtures');
};

0
app/fixtures/.gitkeep Normal file
View file

835
app/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,8 @@
"regenerator-runtime": "^0.13.9", "regenerator-runtime": "^0.13.9",
"sass": "^1.69.5", "sass": "^1.69.5",
"sass-loader": "^13.3.2", "sass-loader": "^13.3.2",
"stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.1.0",
"ts-loader": "^9.5.0", "ts-loader": "^9.5.0",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"webpack": "^5.74.0", "webpack": "^5.74.0",
@ -24,14 +26,20 @@
"license": "UNLICENSED", "license": "UNLICENSED",
"private": true, "private": true,
"scripts": { "scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev", "dev": "encore dev",
"h": "encore --help",
"dev:server": "encore dev-server",
"watch": "encore dev --watch", "watch": "encore dev --watch",
"build": "encore production --progress", "build": "encore production --progress",
"lint": "eslint assets", "lint:ts": "eslint assets",
"lint:fix": "eslint assets --fix" "lint:ts:fix": "eslint assets --fix",
"lint:scss": "stylelint assets",
"lint:scss:fix": "stylelint assets --fix"
}, },
"volta": { "volta": {
"node": "20.9.0" "node": "20.9.0"
},
"dependencies": {
"tsconfig-paths-webpack-plugin": "^4.1.0"
} }
} }

2
app/php.ini Normal file
View file

@ -0,0 +1,2 @@
xdebug.mode = debug
xdebug.start_with_request = trigger

View file

@ -18,15 +18,25 @@
</php> </php>
<testsuites> <testsuites>
<testsuite name="Project Test Suite"> <testsuite name="Unit">
<directory>tests</directory> <directory>tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
<testsuite name="Web">
<directory>tests/Web</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
tests
<coverage processUncoveredFiles="true"> <coverage processUncoveredFiles="true">
<include> <include>
<directory suffix=".php">src</directory> <directory suffix=".php">src</directory>
</include> </include>
<exclude>
<directory suffix="Entity.php">src</directory>
<directory suffix="Fixtures.php">fixtures</directory>
</exclude>
</coverage> </coverage>
<listeners> <listeners>
@ -34,5 +44,6 @@ tests
</listeners> </listeners>
<extensions> <extensions>
<extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>
</extensions> </extensions>
</phpunit> </phpunit>

View file

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class AppFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
// $product = new Product();
// $manager->persist($product);
$manager->flush();
}
}

View file

@ -1,4 +1,16 @@
{ {
"dama/doctrine-test-bundle": {
"version": "8.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "main",
"version": "7.2",
"ref": "896306d79d4ee143af9eadf9b09fd34a8c391b70"
},
"files": [
"config/packages/dama_doctrine_test_bundle.yaml"
]
},
"doctrine/doctrine-bundle": { "doctrine/doctrine-bundle": {
"version": "2.11", "version": "2.11",
"recipe": { "recipe": {
@ -182,7 +194,7 @@
"files": [ "files": [
"assets/bootstrap.js", "assets/bootstrap.js",
"assets/controllers.json", "assets/controllers.json",
"assets/controllers/hello_controller.js" "assets/controllers/hello_controller.ts"
] ]
}, },
"symfony/twig-bundle": { "symfony/twig-bundle": {

View file

0
app/tests/Unit/.gitkeep Normal file
View file

0
app/tests/Web/.gitkeep Normal file
View file

View file

@ -7,9 +7,16 @@
"noImplicitAny": true, "noImplicitAny": true,
"strict": true, "strict": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true "esModuleInterop": true,
"baseUrl": "./",
"paths": {
"@src/*": ["./*"],
"@packages/*": ["./packages/*"],
"@controllers/*": ["./controllers/*"],
"@styles/*": ["./styles/*"],
}
}, },
"files": [ "files": [
"assets" ".assets/**/*.ts"
] ]
} }

View file

@ -1,76 +1,41 @@
const Encore = require('@symfony/webpack-encore');
// Manually configure the runtime environment if not already configured yet by the "encore" command. const Encore = require('@symfony/webpack-encore');
// It's useful when you use tools that rely on webpack.config.js file. const path = require('path');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
if (!Encore.isRuntimeEnvironmentConfigured()) { if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
} }
const ROOT_PATH = path.resolve(__dirname, './');
const ASSETS_PATH = ROOT_PATH + '/assets';
const ALIASES = {
'@src' : ASSETS_PATH,
'@packages' : ASSETS_PATH + '/packages',
'@controllers' : ASSETS_PATH + '/controllers',
'@styles' : ASSETS_PATH + '/styles'
};
Encore Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/') .setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build') .setPublicPath('/build')
// only needed for CDN's or subdirectory deploy .addAliases(ALIASES)
//.setManifestKeyPrefix('build/')
/*
* ENTRY CONFIG
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './assets/app.ts') .addEntry('app', './assets/app.ts')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json') .enableStimulusBridge('./assets/controllers.json')
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk() .enableSingleRuntimeChunk()
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild() .cleanupOutputBeforeBuild()
.enableBuildNotifications() .enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction()) .enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction()) .enableVersioning(Encore.isProduction())
// configure Babel
// .configureBabel((config) => {
// config.plugins.push('@babel/a-babel-plugin');
// })
// enables and configure @babel/preset-env polyfills
.configureBabelPresetEnv((config) => { .configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage'; config.useBuiltIns = 'usage';
config.corejs = '3.23'; config.corejs = '3.23';
}) })
// enables Sass/SCSS support
.enableSassLoader() .enableSassLoader()
// uncomment if you use TypeScript
.enableTypeScriptLoader() .enableTypeScriptLoader()
.enableForkedTypeScriptTypesChecking()
// uncomment if you use React
//.enableReactPreset()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes(Encore.isProduction())
// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
; ;
module.exports = Encore.getWebpackConfig(); module.exports = Encore.getWebpackConfig();