Skip to content

Commit 1e5a9a1

Browse files
committed
Release v1.0.15: FormKit admin forms and Twig Extra (REQ-TWIG-004).
1 parent 019140b commit 1e5a9a1

22 files changed

Lines changed: 1171 additions & 119 deletions

.scripts/check-twig-extra.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
# REQ-TWIG-004 — fail when Twig applies but twig/extra-bundle (and demos) are not ready.
3+
set -euo pipefail
4+
5+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6+
cd "$ROOT"
7+
8+
has_twig=0
9+
if find src -type f -name '*.twig' 2>/dev/null | grep -q .; then
10+
has_twig=1
11+
elif find templates Resources -type f -name '*.twig' 2>/dev/null | grep -q .; then
12+
has_twig=1
13+
fi
14+
15+
if [[ "$has_twig" -eq 0 ]]; then
16+
echo "check-twig-extra: Twig does not apply (no templates) — OK"
17+
exit 0
18+
fi
19+
20+
fail=0
21+
22+
if ! grep -q '"twig/extra-bundle"' composer.json; then
23+
echo "ERROR: twig/extra-bundle missing from package composer.json require (REQ-TWIG-004)" >&2
24+
fail=1
25+
fi
26+
27+
if ! grep -q '"twig/string-extra"' composer.json; then
28+
echo "ERROR: twig/string-extra missing from package composer.json require (REQ-TWIG-004 baseline)" >&2
29+
fail=1
30+
fi
31+
32+
shopt -s nullglob
33+
for demo_composer in demo/*/composer.json demo/*/*/composer.json; do
34+
[[ -f "$demo_composer" ]] || continue
35+
demo_dir="$(dirname "$demo_composer")"
36+
# Skip demos that never render Twig (no bundles.php / no twig)
37+
bundles_php="$demo_dir/config/bundles.php"
38+
if [[ ! -f "$bundles_php" ]]; then
39+
continue
40+
fi
41+
if ! grep -q 'TwigBundle' "$bundles_php" 2>/dev/null; then
42+
continue
43+
fi
44+
if ! grep -q '"twig/extra-bundle"' "$demo_composer"; then
45+
echo "ERROR: $demo_composer missing twig/extra-bundle (REQ-TWIG-004)" >&2
46+
fail=1
47+
fi
48+
if ! grep -q 'Twig\\\\Extra\\\\TwigExtraBundle\\\\TwigExtraBundle' "$bundles_php" \
49+
&& ! grep -q 'Twig\\Extra\\TwigExtraBundle\\TwigExtraBundle' "$bundles_php"; then
50+
echo "ERROR: $bundles_php missing TwigExtraBundle (REQ-TWIG-004)" >&2
51+
fail=1
52+
fi
53+
done
54+
55+
if [[ "$fail" -ne 0 ]]; then
56+
exit 1
57+
fi
58+
59+
echo "check-twig-extra: OK"

.twig-cs-fixer.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use TwigCsFixer\Config\Config;
6+
use TwigCsFixer\File\Finder;
7+
use TwigCsFixer\Ruleset\Ruleset;
8+
use TwigCsFixer\Standard\TwigCsFixer;
9+
10+
$paths = [];
11+
foreach ([__DIR__ . '/src', __DIR__ . '/templates'] as $path) {
12+
if (is_dir($path)) {
13+
$paths[] = $path;
14+
}
15+
}
16+
17+
$finder = new Finder();
18+
foreach ($paths as $path) {
19+
$finder->in($path);
20+
}
21+
$finder->exclude(['vendor', 'var', 'node_modules', 'coverage', 'demo']);
22+
23+
$ruleset = new Ruleset();
24+
$ruleset->addStandard(new TwigCsFixer());
25+
26+
$config = new Config();
27+
$config->setRuleset($ruleset);
28+
$config->setFinder($finder);
29+
30+
return $config;

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif
1111
COMPOSE := $(COMPOSE_BIN) -f $(COMPOSE_FILE)
1212
SERVICE_PHP := php
1313

14-
.PHONY: help up down down-dev build shell install assets test test-coverage cs-check cs-fix qa clean release-check release-check-demos composer-sync rector rector-dry phpstan update validate validate-translations check-no-cursor-coauthor check-open-prs strip-cursor-coauthor-from-history setup-hooks demo-smoke
14+
.PHONY: help up down down-dev build shell install assets test test-coverage cs-check cs-fix qa clean release-check release-check-demos composer-sync rector rector-dry phpstan update validate validate-translations check-no-cursor-coauthor check-open-prs strip-cursor-coauthor-from-history setup-hooks demo-smoke check-twig-extra
1515

1616
help:
1717
@echo "API Studio Bundle - Development Commands"
@@ -88,7 +88,12 @@ validate: ensure-up
8888
validate-translations: ensure-up
8989
@$(COMPOSE) exec -T $(SERVICE_PHP) php vendor/bin/yaml-lint src/Resources/translations
9090

91-
release-check: ensure-up check-no-cursor-coauthor check-open-prs composer-sync cs-fix cs-check rector-dry phpstan test-coverage validate-translations release-check-demos
91+
92+
check-twig-extra:
93+
@chmod +x .scripts/check-twig-extra.sh
94+
@./.scripts/check-twig-extra.sh
95+
96+
release-check: ensure-up check-no-cursor-coauthor check-open-prs check-twig-extra composer-sync cs-fix cs-check rector-dry phpstan test-coverage validate-translations release-check-demos
9297

9398
# REQ-TEST-011 — boot demo stack and assert one HTTP 200
9499
demo-smoke:
@@ -138,3 +143,6 @@ check-open-prs:
138143
strip-cursor-coauthor-from-history:
139144
@chmod +x .scripts/strip-cursor-coauthor-from-history.sh
140145
@./.scripts/strip-cursor-coauthor-from-history.sh main
146+
147+
twig-lint: ensure-up
148+
@$(COMPOSE) exec -T $(SERVICE_PHP) composer twig:lint || $(COMPOSE) exec -T $(SERVICE_PHP) ./vendor/bin/twig-cs-fixer lint --config=.twig-cs-fixer.php

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ This bundle is **FrankenPHP worker mode friendly**.
2929
composer require nowo-tech/api-studio-bundle
3030
```
3131

32-
Register the bundle:
32+
Register the bundle and hard dependencies (Flex usually does this):
3333

3434
```php
3535
// config/bundles.php
3636
Nowo\ApiStudioBundle\ApiStudioBundle::class => ['all' => true],
37+
Nowo\UiKitBundle\NowoUiKitBundle::class => ['all' => true],
38+
Nowo\FormKitBundle\NowoFormKitBundle::class => ['all' => true],
39+
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
3740
```
3841

3942
Install the Asset component (required for Twig `asset()` in the request console):
@@ -81,6 +84,9 @@ Open `/api-studio` in your browser.
8184
- Doctrine ORM
8285
- `ext-json`
8386
- `ext-soap` (optional, for SOAP execution)
87+
- [UiKitBundle](https://github.com/nowo-tech/UiKitBundle) `^1.4`
88+
- [FormKitBundle](https://github.com/nowo-tech/FormKitBundle) `^2.0`
89+
- `twig/extra-bundle` + `twig/string-extra` `^3.12` (REQ-TWIG-004)
8490

8591
## Browser scripts (pre/post-request)
8692

composer.json

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nowo-tech/api-studio-bundle",
3-
"description": "Symfony bundle for managing, documenting, and testing REST, SOAP, and GraphQL APIs your own Postman/Apidog inside Symfony.",
3+
"description": "Symfony bundle for managing, documenting, and testing REST, SOAP, and GraphQL APIs \u2014 your own Postman/Apidog inside Symfony.",
44
"type": "symfony-bundle",
55
"license": "MIT",
66
"keywords": [
@@ -24,7 +24,7 @@
2424
},
2525
"authors": [
2626
{
27-
"name": "Héctor Franco Aceituno",
27+
"name": "H\u00e9ctor Franco Aceituno",
2828
"email": "hectorfranco@nowo.tech",
2929
"homepage": "https://github.com/HecFranco",
3030
"role": "Developer"
@@ -35,10 +35,12 @@
3535
}
3636
],
3737
"require": {
38-
"php": ">=8.2 <8.6",
3938
"doctrine/doctrine-bundle": "^2.10 || ^3.0",
4039
"doctrine/orm": "^2.15 || ^3.0",
4140
"ext-json": "*",
41+
"nowo-tech/form-kit-bundle": "^2.0",
42+
"nowo-tech/ui-kit-bundle": "^1.4",
43+
"php": ">=8.2 <8.6",
4244
"symfony/asset": "^7.0 || ^8.0",
4345
"symfony/config": "^7.0 || ^8.0",
4446
"symfony/dependency-injection": "^7.0 || ^8.0",
@@ -49,11 +51,12 @@
4951
"symfony/routing": "^7.0 || ^8.0",
5052
"symfony/security-bundle": "^7.0 || ^8.0",
5153
"symfony/security-csrf": "^7.0 || ^8.0",
52-
"symfony/twig-bundle": "^7.0 || ^8.0",
5354
"symfony/translation": "^7.0 || ^8.0",
55+
"symfony/twig-bundle": "^7.0 || ^8.0",
5456
"symfony/validator": "^7.0 || ^8.0",
5557
"symfony/yaml": "^7.0 || ^8.0",
56-
"nowo-tech/ui-kit-bundle": "^1.4"
58+
"twig/extra-bundle": "^3.12",
59+
"twig/string-extra": "^3.12"
5760
},
5861
"require-dev": {
5962
"friendsofphp/php-cs-fixer": "^3.0",
@@ -64,7 +67,8 @@
6467
"phpstan/phpstan-symfony": "^2.0",
6568
"phpunit/phpunit": "^10.0 || ^11.0",
6669
"rector/rector": "^2.0",
67-
"symfony/browser-kit": "^7.0 || ^8.0"
70+
"symfony/browser-kit": "^7.0 || ^8.0",
71+
"vincentlanglet/twig-cs-fixer": "^3.0"
6872
},
6973
"autoload": {
7074
"psr-4": {
@@ -77,7 +81,10 @@
7781
}
7882
},
7983
"archive": {
80-
"exclude": ["/demo", "/.cursor"]
84+
"exclude": [
85+
"/demo",
86+
"/.cursor"
87+
]
8188
},
8289
"config": {
8390
"sort-packages": true,
@@ -107,7 +114,10 @@
107114
"qa": [
108115
"@cs-check",
109116
"@test"
110-
]
117+
],
118+
"twig:lint": "twig-cs-fixer lint --config=.twig-cs-fixer.php",
119+
"twig:fix": "twig-cs-fixer fix --config=.twig-cs-fixer.php",
120+
"twig:fix:check": "twig-cs-fixer lint --config=.twig-cs-fixer.php --fix"
111121
},
112122
"scripts-descriptions": {
113123
"test": "Run PHPUnit tests",

0 commit comments

Comments
 (0)