Skip to content

Commit

Permalink
First iteration of Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Jan 31, 2025
1 parent 6b33a58 commit 3e4a7ee
Show file tree
Hide file tree
Showing 21 changed files with 234 additions and 3,706 deletions.
27 changes: 26 additions & 1 deletion src/Toolkit/bin/build-registry.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
#!/usr/bin/env php
<?php

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

use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\UX\Toolkit\Registry\Registry;
use Symfony\UX\Toolkit\Registry\RegistryItem;

// --- Configuration
$templateDir = __DIR__ . '/../templates';
$registryDir = __DIR__ . '/../registry';
// --- End of Configuration

$registry = Registry::empty();
$filesystem = new Filesystem();

$finderTemplates = Finder::create()
->files()
->in($templateDir)
->name('*.html.twig')
->sortByName();

foreach ($finderTemplates as $file) {
$registry->add(RegistryItem::fromFile($file));
}

$registry->save($registryDir, $filesystem);
3 changes: 3 additions & 0 deletions src/Toolkit/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
"symfony/ux-twig-component": "^2.22",
"symfony/filesystem": "^7.2"
},
"require-dev": {
"symfony/finder": "6.4|^7.0"
},
"autoload": {
"psr-4": {
"Symfony\\UX\\Toolkit\\": "src"
Expand Down
Loading

0 comments on commit 3e4a7ee

Please sign in to comment.