Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1ea38de
Initial plan
Copilot Dec 29, 2025
290edfc
Add EloquentGlobalRepository and update ServiceProvider to support El…
Copilot Dec 29, 2025
be195ed
Address code review feedback: remove unused import and add beforeEach…
Copilot Dec 29, 2025
27cf935
Fix EloquentGlobalRepository to properly merge builder globals with d…
Copilot Dec 29, 2025
db633d3
Improve comments in EloquentGlobalRepository for clarity
Copilot Dec 29, 2025
5670d1a
Fix GlobalsStore to not pass key to constructor and correct type hints
Copilot Dec 29, 2025
f3672ce
Remove unused BaseTaxonomy import from GlobalsStore
Copilot Dec 29, 2025
0586b3d
docs: add project guidelines for development, testing, and usage
tdwesten Jan 2, 2026
f7468fd
docs: add project guidelines for development, testing, and usage
tdwesten Jan 2, 2026
3fe7732
Merge remote-tracking branch 'origin/copilot/add-global-registration-…
tdwesten Jan 2, 2026
21a052c
test: add unit tests for `CollectionRepository` and `GlobalRepository…
tdwesten Jan 2, 2026
26bce89
feat: add navigation support with `BaseNavigation` class, navigation …
tdwesten Jan 2, 2026
25b6192
feat: add navigation support with `BaseNavigation` class, navigation …
tdwesten Jan 2, 2026
f1d0b5a
test: add unit tests for repositories, fields, and fieldsets, includi…
tdwesten Jan 2, 2026
a28ebc7
test: add unit tests for `MakeBlueprintCommand`, `MakeCollectionComma…
tdwesten Jan 2, 2026
b0f48c8
test: add comprehensive unit tests for blueprints, fields, repositori…
tdwesten Jan 3, 2026
b9d1687
feat: implement auto registration and discovery for blueprints, field…
tdwesten Jan 3, 2026
d552e2b
docs: refine guidelines with expanded installation, testing, and conf…
tdwesten Jan 3, 2026
0bb0eb1
refactor: rename `Collor` and `Taggeble` field types to `Color` and `…
tdwesten Jan 3, 2026
c2687a7
feat: enhance UI with dark mode support in `not-editable.blade.php`
tdwesten Jan 3, 2026
8e7ecf0
feat: introduce asset container support with `BaseAssetContainer` imp…
tdwesten Jan 3, 2026
a01c092
ci: add GitHub Actions workflow for testing across multiple PHP and L…
tdwesten Jan 3, 2026
93e6589
test: enforce return types in all unit and feature tests
tdwesten Jan 3, 2026
ee2882d
ci: update requirements and test matrix for PHP, Laravel, and Statami…
tdwesten Jan 3, 2026
6e7eb66
ci: consolidate CI workflows and adjust test matrix
tdwesten Jan 3, 2026
1508eaa
ci: consolidate CI workflows and adjust test matrix
tdwesten Jan 3, 2026
e8688bb
test: add feature tests for `NavigationController` and `NavigationBlu…
tdwesten Jan 4, 2026
a71ad0c
test: add feature tests and extend builder support for asset containers
tdwesten Jan 4, 2026
479a39d
test: remove unused test coverage summary and compatibility scripts
tdwesten Jan 4, 2026
b77ee70
test: remove unused test coverage summary and compatibility scripts
tdwesten Jan 4, 2026
b474bd5
Merge remote-tracking branch 'origin/version-2' into version-2
tdwesten Jan 4, 2026
4777e11
feat: add changelog and enhance global set, navigation, and field typ…
tdwesten Jan 4, 2026
6dd0d8c
chore: bump version to 2.0.0 in composer.json
tdwesten Jan 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/ci.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Execute PHP Linting via Pint
run: ./vendor/bin/pint --bail

test:
needs: [ linting ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.2, 8.3, 8.4 ]
laravel: [ 11.*, 12.* ]
statamic: [ 5.* ]
stability: [ prefer-stable ]
exclude:
- php: 8.2
laravel: 11.*
- php: 8.2
laravel: 12.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - S${{ matrix.statamic }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: pcov

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "statamic/cms:${{ matrix.statamic }}" "orchestra/testbench:${{ matrix.laravel == '11.*' && '^9.0' || '^10.0' }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction -W

- name: Execute tests
run: vendor/bin/pest --coverage-clover coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
109 changes: 109 additions & 0 deletions .junie/guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
### Project Guidelines

#### Purpose
The Statamic Builder speeds up building Statamic sites by providing a fluent, PHP-based API to define sites, blueprints, fieldsets, collections, navigations, and taxonomies. This approach enhances code readability and maintainability by replacing traditional YAML configuration with PHP classes.

#### Build and Configuration

This project is a Statamic addon that integrates deeply with Statamic's core systems and provides a fluent API for
building blueprints and fieldsets.

- **Requirements**: PHP 8.2+, Statamic 5.4+, Laravel 10/11/12.
- **Installation**:
```bash
composer install
```
- **Service Provider**: `Tdwesten\StatamicBuilder\ServiceProvider` is automatically registered via Laravel's package
discovery. It handles component discovery, repository binding, and command registration.
- **Configuration**:
Publish the configuration file to customize discovery paths and register components manually:
```bash
php artisan vendor:publish --tag=statamic
```
- **Exporting to YAML**:
If you need to generate standard Statamic YAML files from your PHP definitions:
```bash
php artisan statamic-builder:export
```

#### Testing
The project uses [Pest](https://pestphp.com/) for testing, along with `orchestra/testbench` for Laravel/Statamic integration.

- **Configuring Tests**:
- Tests extend `Tests\TestCase`, which boots the Statamic environment.
- No additional database configuration is typically required as it uses in-memory storage for testing.
- **Running Tests**:
Execute the following command to run the full test suite:
```bash
./vendor/bin/pest
```
To run tests and static analysis (Rector):
```bash
composer test
```
- **Adding Tests**:
- Place new tests in `tests/Unit` or `tests/Feature`.
- For new field types, use the generator to create a starting test: `composer generate-field MyField`.

**Verified Example Test Case:**
```php
<?php

use Tdwesten\StatamicBuilder\Blueprint;
use Tdwesten\StatamicBuilder\FieldTypes\Section;
use Tdwesten\StatamicBuilder\FieldTypes\Tab;
use Tdwesten\StatamicBuilder\FieldTypes\Text;

test('it can build a simple blueprint', function () {
$blueprint = new class('test_handle') extends Blueprint {
public function registerTabs(): array
{
return [
Tab::make('main', [
Section::make('General', [
Text::make('title')->displayName('Title'),
]),
]),
];
}
};

$array = $blueprint->toArray();

expect($blueprint->getHandle())->toBe('test_handle');
expect($array['tabs']['main']['sections'][0]['display'])->toBe('General');
});
```

#### Development Information

- **Mandatory Tasks**: Always perform the following tasks when completing a task or before submitting a pull request:
- **Update README**: Ensure `README.md` reflects any new features or changes.
- **Format Code**: Run `vendor/bin/pint` to maintain consistent code style.
- **Run Tests**: Ensure all tests pass by running `./vendor/bin/pest`.
- **Code Style**: Follow PSR-12 and Laravel coding standards. `laravel/pint` is included for formatting.
- **Static Analysis/Refactoring**: Rector is used for automated refactoring and code quality. Run it via:
```bash
./vendor/bin/rector
```
- **Fluent API Design**: Always use the `make()` static method for instantiating fields and chainable setters (e.g.,
`->displayName()`, `->instructions()`, `->required()`) for configuration.
- **Custom Field Types**: New field types should extend `Tdwesten\StatamicBuilder\FieldTypes\Field`.
- **Field Generator**:
```bash
composer generate-field MyFieldName
```
This command populates `src/FieldTypes/` and `tests/Unit/` using templates in the `field-generator/` directory.

#### Auto Registration & Discovery

The addon supports auto-discovery to avoid manual registration in `config/statamic/builder.php`.

- **Enable**: Set `'auto_registration' => true` in the config.
- **Requirements**:
- **Blueprints**: Must implement `public static function handle(): string` and
`public static function blueprintNamespace(): string`.
- **Collections, Taxonomies, Globals, Navigations**: Must implement `public static function handle(): string`.
- **Sites**: Must implement `public function handle(): string`.
- **Default Paths**: Components are discovered in `app/Blueprints`, `app/Collections`, etc. These can be customized in
the `auto_discovery` configuration.
Loading