Переглянути джерело

Fix tryitout on Laravel type

shalvah 4 роки тому
батько
коміт
fa4a2d9f4d

+ 2 - 2
resources/views/partials/frontmatter.blade.php

@@ -16,9 +16,9 @@ logo: {{ $settings['logo'] ?? false }}
 
 toc_footers:
 @if($showPostmanCollectionButton)
-- <a href="{{ $postmanCollectionLink }}">View Postman Collection</a>
+- <a href="{{ $postmanCollectionLink }}">View Postman collection</a>
 @endif
 @if($showOpenAPISpecButton)
-- <a href="{{ $openAPISpecLink }}">View OpenAPI (Swagger) Spec</a>
+- <a href="{{ $openAPISpecLink }}">View OpenAPI (Swagger) spec</a>
 @endif
 - <a href='http://github.com/knuckleswtf/scribe'>Documentation powered by Scribe ✍</a>

+ 5 - 5
src/Writing/Writer.php

@@ -257,7 +257,7 @@ class Writer
     protected function performFinalTasksForLaravelType(): void
     {
         if (!is_dir($this->laravelTypeOutputPath)) {
-            mkdir($this->laravelTypeOutputPath);
+            mkdir($this->laravelTypeOutputPath, 0777, true);
         }
         if (!is_dir("public/vendor/scribe")) {
             mkdir("public/vendor/scribe", 0777, true);
@@ -284,14 +284,14 @@ class Writer
 
     public function writeHtmlDocs(): void
     {
-        ConsoleOutputUtils::info('Generating API HTML code');
+        ConsoleOutputUtils::info('Transforming Markdown docs to HTML...');
 
         $this->pastel->generate($this->sourceOutputPath . '/index.md', $this->staticTypeOutputPath);
+        // Add our custom JS
+        copy(__DIR__.'/../../resources/js/tryitout.js', $this->staticTypeOutputPath . '/js/tryitout.js');
 
         if (!$this->isStatic) {
             $this->performFinalTasksForLaravelType();
-        } else {
-            copy(__DIR__.'/../../resources/js/tryitout.js', $this->staticTypeOutputPath . '/js/tryitout.js');
         }
 
         ConsoleOutputUtils::success("Wrote HTML documentation to: " . ($this->isStatic ? $this->staticTypeOutputPath : $this->laravelTypeOutputPath));
@@ -312,7 +312,7 @@ class Writer
         $frontmatter = view('scribe::partials.frontmatter')
             ->with('showPostmanCollectionButton', $this->shouldGeneratePostmanCollection)
             ->with('showOpenAPISpecButton', $this->shouldGenerateOpenAPISpec)
-            // This path is wrong for laravel type but will be replaced in post
+            // These paths are wrong for laravel type but will be replaced in the performFinalTasksForLaravelType() method
             ->with('postmanCollectionLink', './collection.json')
             ->with('openAPISpecLink', './openapi.yaml')
             ->with('outputPath', 'docs')