Skip to content

Commit

Permalink
Create missing baseline directories (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmason30 authored Oct 9, 2023
1 parent 4fc9536 commit e760980
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/translation-linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
| option when running the command.
|
*/
'baseline' => base_path('translations.unused.baseline.json'),
'baseline' => lang_path('.lint/unused.json'),

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Collections/ResultObjectCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function reset(): void
$this->items = [];
}

public function toBaseLineJson(): string
public function toBaselineJson(): string
{
return $this
->groupBy('locale')
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Collections/ResultObjectCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ResultObjectCollection extends Arrayable, Enumerable
{
public function reset(): void;

public function toBaseLineJson(): string;
public function toBaselineJson(): string;

public function toCommandTableOutputArray(FieldCollectionContract $fields): array;

Expand Down
9 changes: 5 additions & 4 deletions src/Writers/UnusedBaselineFileWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public function __construct(

public function execute(ResultObjectCollection $results)
{
$this->filesystem->put(
$this->file,
$results->toBaseLineJson(),
);
$path = $this->filesystem->dirname($this->file);

$this->filesystem->ensureDirectoryExists($path);

$this->filesystem->put($this->file, $results->toBaselineJson());
}
}

0 comments on commit e760980

Please sign in to comment.