-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgenerate_types.php
More file actions
72 lines (61 loc) · 2.44 KB
/
generate_types.php
File metadata and controls
72 lines (61 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Standalone Telegram Bot API Type Generator
*
* Uses the extracted TypeGenerator class without requiring Laravel
* Follows SOLID principles and DRY - no code duplication
*
* Usage: php generate_types.php
*/
require_once 'vendor/autoload.php';
use Milly\Laragram\Generator\TypeGenerator;
use Milly\Laragram\Generator\ConsoleOutput;
class StandaloneGenerator
{
private TypeGenerator $generator;
private ConsoleOutput $output;
public function __construct()
{
$this->output = new ConsoleOutput();
$this->generator = new TypeGenerator(
__DIR__ . '/src/Methods',
__DIR__ . '/src/Types'
);
}
public function run(bool $typesOnly = false): void
{
$this->output->progress("Starting Telegram Bot API Type Generation...");
try {
if ($typesOnly) {
$this->output->info("Generating types only (no documentation)...");
$stats = $this->generator->generateTypesOnly();
$this->output->success("Generation completed successfully!");
$this->output->showStats($stats);
} else {
$this->output->info("Generating types and documentation...");
$stats = $this->generator->generate();
$this->output->success("Generation completed successfully!");
$this->output->showStats($stats);
$this->output->info("📚 Documentation generated in: docs/");
$this->output->info("🌐 Deploy to GitHub Pages: git add docs/ && git commit -m 'Update docs' && git push");
}
} catch (Exception $e) {
$this->output->error("Error: " . $e->getMessage());
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
exit(1);
}
}
}
// Main execution
$typesOnly = in_array('--types-only', $argv) || in_array('-t', $argv);
$generator = new StandaloneGenerator();
$generator->run($typesOnly);
if (!$typesOnly) {
echo "\n🚀 Documentation Generation Complete!\n";
echo "📁 Documentation saved to: docs/\n";
echo "🌐 To deploy to GitHub Pages:\n";
echo " 1. Enable GitHub Pages in repository settings\n";
echo " 2. Set source to 'docs' folder\n";
echo " 3. Push changes: git add docs/ && git commit -m 'Update docs' && git push\n";
echo " 4. Your docs will be available at: https://yourusername.github.io/laragram\n\n";
}