Skip to content

Commit

Permalink
Cleaning up readme and config command.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Nov 23, 2024
1 parent 08a6ebb commit ea3f0da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to `laravel-ddd` will be documented in this file.

## [Unreleased]
## [1.2.0] - 2024-11-23
### Breaking
- Stubs are now published to `base_path('stubs/ddd')` instead of `resource_path('stubs/ddd')`. In other words, they are now co-located alongside the framework's published stubs, within a ddd subfolder.
- Published stubs now use `.stub` extension instead of `.php.stub` (following Laravel's convention).
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ You may initialize the package using the `ddd:install` artisan command. This wil
php artisan ddd:install
```

### Configuration
For first-time installations, a config wizard is available to populate the `ddd.php` config file interactively:
```bash
php artisan ddd:config wizard
```
For existing installations with a config file published from a previous version, you may use the `ddd:config update` command to rebuild and merge it with the latest package copy:
```bash
php artisan ddd:config update
```
See [Configuration Utility](#config-utility) for more details about the config utility.

### Peer Dependencies
The following additional packages are suggested (but not required) while working with this package.
- Data Transfer Objects: [spatie/laravel-data](https://github.com/spatie/laravel-data)
Expand Down Expand Up @@ -97,6 +108,8 @@ The following generators are currently available:

Generated objects will be placed in the appropriate domain namespace as specified by `ddd.namespaces.*` in the [config file](#config-file).

<a name="config-utility"></a>

### Config Utility (Since 1.2)
A configuration utility was introduced in 1.2 to help manage the package's configuration over time.
```bash
Expand All @@ -106,7 +119,7 @@ Output:
```
┌ Laravel-DDD Config Utility ──────────────────────────────────┐
│ › ● Run the configuration wizard │
│ ○ Update and merge ddd.php with latest package version
│ ○ Rebuild and merge ddd.php with latest package copy
│ ○ Detect domain namespace from composer.json │
│ ○ Sync composer.json from ddd.php │
│ ○ Exit │
Expand All @@ -117,7 +130,7 @@ These config tasks are also invokeable directly using arguments:
# Run the configuration wizard
php artisan ddd:config wizard

# Update and merge ddd.php with latest package version
# Rebuild and merge ddd.php with latest package copy
php artisan ddd:config update

# Detect domain namespace from composer.json
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function home(): int
{
$action = select('Laravel-DDD Config Utility', [
'wizard' => 'Run the configuration wizard',
'update' => 'Update and merge ddd.php with latest package version',
'update' => 'Rebuild and merge ddd.php with latest package version',
'detect' => 'Detect domain namespace from composer.json',
'composer' => 'Sync composer.json from ddd.php',
'exit' => 'Exit',
Expand Down
11 changes: 1 addition & 10 deletions tests/Command/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Illuminate\Database\Migrations\MigrationCreator;
use Lunarstorm\LaravelDDD\Commands\ConfigCommand;
use Lunarstorm\LaravelDDD\Facades\DDD;
use Lunarstorm\LaravelDDD\Tests\BootsTestApplication;
Expand All @@ -9,15 +8,7 @@

beforeEach(function () {
$this->setupTestApplication();

// $this->app->when(MigrationCreator::class)
// ->needs('$customStubPath')
// ->give(fn() => $this->app->basePath('stubs'));

$this->originalComposerContents = file_get_contents(base_path('composer.json'));

// $this->artisan('clear-compiled')->assertSuccessful()->execute();
// $this->artisan('optimize:clear')->assertSuccessful()->execute();
});

afterEach(function () {
Expand Down Expand Up @@ -77,7 +68,7 @@
->execute();
})->skip(fn () => ConfigCommand::hasRequiredVersionOfLaravelPrompts());

it('can update and merge ddd.php with latest package version', function () {
it('can Rebuild and merge ddd.php with latest package version', function () {
$configPath = config_path('ddd.php');

$originalContents = <<<'PHP'
Expand Down

0 comments on commit ea3f0da

Please sign in to comment.