Skip to content

Commit d43b650

Browse files
committed
fix: Fixed bugs:
- Fixed imports by path - Renamed `context-generator` into `ctx`
1 parent 9cf57e3 commit d43b650

File tree

7 files changed

+18
-28
lines changed

7 files changed

+18
-28
lines changed

context-generator renamed to app.php

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env php
21
<?php
32

43
declare(strict_types=1);

box.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"vendor"
1414
],
1515
"files": [
16-
"context-generator",
16+
"ctx",
17+
"app.php",
1718
"LICENSE",
1819
"composer.json",
1920
"composer.lock",

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
}
5555
},
5656
"bin": [
57-
"context-generator"
57+
"ctx"
5858
],
5959
"scripts": {
6060
"cs-check": "vendor/bin/php-cs-fixer fix --dry-run",

context.yaml

+4-24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import:
2+
- path: src/Console/context.yaml
3+
- path: src/ConfigLoader/context.yaml
4+
15
documents:
26
- description: "Context Generator Project Structure"
37
outputPath: "project-structure.md"
@@ -51,14 +55,6 @@ documents:
5155
- 'FilesInterface.php'
5256
showTreeView: true
5357

54-
- description: Configuration System
55-
outputPath: core/config-loader.md
56-
sources:
57-
- type: file
58-
sourcePaths: src/ConfigLoader
59-
filePattern: '*.php'
60-
showTreeView: true
61-
6258
- description: Document Compilation System
6359
outputPath: core/document.md
6460
sources:
@@ -157,22 +153,6 @@ documents:
157153
filePattern: '*.php'
158154
showTreeView: true
159155

160-
- description: Console Commands
161-
outputPath: console/commands.md
162-
sources:
163-
- type: file
164-
sourcePaths: src/Console
165-
filePattern: '*Command.php'
166-
showTreeView: true
167-
168-
- description: Console Renderers
169-
outputPath: console/renderers.md
170-
sources:
171-
- type: file
172-
sourcePaths: src/Console/Renderer
173-
filePattern: '*.php'
174-
showTreeView: true
175-
176156
- description: Content Building System
177157
outputPath: utilities/content-builder.md
178158
sources:

ctx

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
require __DIR__ . '/app.php';

src/ConfigLoader/ConfigLoaderFactory.php

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function create(Directories $dirs, array $parserPlugins = []): ConfigLoad
4242

4343
// Create import resolver
4444
$importResolver = new ImportResolver(
45+
dirs: $dirs,
4546
files: $this->files,
4647
loaderFactory: $this,
4748
logger: $this->logger?->withPrefix('import-resolver'),
@@ -121,6 +122,7 @@ public function createForFile(Directories $dirs, array $parserPlugins = []): Con
121122

122123
// Create import resolver
123124
$importResolver = new ImportResolver(
125+
dirs: $dirs,
124126
files: $this->files,
125127
loaderFactory: $this,
126128
logger: $this->logger?->withPrefix('import-resolver'),

src/ConfigLoader/Import/ImportResolver.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Butschster\ContextGenerator\ConfigLoader\ConfigLoaderFactory;
88
use Butschster\ContextGenerator\ConfigLoader\Exception\ConfigLoaderException;
9+
use Butschster\ContextGenerator\Directories;
910
use Butschster\ContextGenerator\FilesInterface;
1011
use Psr\Log\LoggerInterface;
1112

@@ -15,6 +16,7 @@
1516
final readonly class ImportResolver
1617
{
1718
public function __construct(
19+
private Directories $dirs,
1820
private FilesInterface $files,
1921
private ConfigLoaderFactory $loaderFactory,
2022
private ?LoggerInterface $logger = null,
@@ -116,7 +118,9 @@ private function loadImportConfig(ImportConfig $importConfig): array
116118
}
117119

118120
try {
119-
$loader = $this->loaderFactory->createForFile($importConfig->absolutePath);
121+
$loader = $this->loaderFactory->createForFile(
122+
$this->dirs->withConfigPath($importConfig->absolutePath),
123+
);
120124

121125
if (!$loader->isSupported()) {
122126
throw new ConfigLoaderException(

0 commit comments

Comments
 (0)