Comments (9)
I can confirm for 'dev-master'
/var/www$ php artisan scribe:generate --no-extraction
🔊 info Generating API HTML code
ErrorException
file_get_contents(resources/views/scribe/index.blade.php): failed to open stream: No such file or directory
at vendor/knuckleswtf/scribe/src/Writing/Writer.php:198
194| // We need to do this delete first, otherwise move won't work if folder exists
195| Utils::deleteDirectoryAndContents("public/vendor/scribe/", getcwd());
196| rename("{$this->outputPath}/", "public/vendor/scribe/");
197|
> 198| $contents = file_get_contents("$this->outputPath/index.blade.php");
199|
200| // Rewrite links to go through Laravel
201| $contents = preg_replace('#href="css/(.+?)"#', 'href="{{ asset("vendor/scribe/css/$1") }}"', $contents);
202| $contents = preg_replace('#src="(js|images)/(.+?)"#', 'src="{{ asset("vendor/scribe/$1/$2") }}"', $contents);
+18 vendor frames
19 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
removing / commenting L195 and L196 in Writer.php
protected function performFinalTasksForLaravelType(): void
{
// Make output a Blade view
if (!is_dir($this->outputPath)) {
mkdir($this->outputPath);
}
rename("{$this->outputPath}/index.html", "$this->outputPath/index.blade.php");
// Move assets from public/docs to public/vendor/scribe
// We need to do this delete first, otherwise move won't work if folder exists
// Utils::deleteDirectoryAndContents("public/vendor/scribe/", getcwd());
// rename("{$this->outputPath}/", "public/vendor/scribe/");
the generation proceeds
/var/www$ php artisan scribe:generate --no-extraction
🔊 info Generating API HTML code
👍 success Wrote HTML documentation to: resources/views/scribe
Another way would be to get contents first and then rename / move the assets
and befor writing the final file create the directory (resources/views/scribe) again
protected function performFinalTasksForLaravelType(): void
{
// Make output a Blade view
if (!is_dir($this->outputPath)) {
mkdir($this->outputPath);
}
rename("{$this->outputPath}/index.html", "$this->outputPath/index.blade.php");
$contents = file_get_contents("$this->outputPath/index.blade.php");
// Move assets from public/docs to public/vendor/scribe
// We need to do this delete first, otherwise move won't work if folder exists
Utils::deleteDirectoryAndContents("public/vendor/scribe/", getcwd());
rename("{$this->outputPath}/", "public/vendor/scribe/");
// Rewrite links to go through Laravel
$contents = preg_replace('#href="css/(.+?)"#', 'href="{{ asset("vendor/scribe/css/$1") }}"', $contents);
$contents = preg_replace('#src="(js|images)/(.+?)"#', 'src="{{ asset("vendor/scribe/$1/$2") }}"', $contents);
$contents = str_replace('href="./collection.json"', 'href="{{ route("scribe.json") }}"', $contents);
if (!is_dir($this->outputPath)) {
mkdir($this->outputPath);
}
file_put_contents("$this->outputPath/index.blade.php", $contents);
}
from scribe.
Thanks for the detailed report! I was able to recognise and fix the actual issue. This means I won't be merging your PR, as the complete fix was more involved than that. You can view it here. Please confirm by switching to version 1.0.0-beta2 and see if it works well.
from scribe.
Writer paths have errors in them, so generating doesn't work
Config laravel.url should be laravel.docs_url
You definitely need to share more details about these. Also, did you follow the migration guide?
from scribe.
I know this is minimal, but I lack the time now. I fixed the issues locally to see what the problem was.
It just misses files at locations in the Writer.
from scribe.
Have you tried switching to dev-master?
from scribe.
Can confirm :) this issue is happening to me as well...
Blade is being generated in the same folder and then is moved
to public dir
and then it's trying to access old dir before it was moved.
Please merge the pull request
from scribe.
Make that 1.0.0-beta3. 🤦♂️
from scribe.
Hey @shalvah I can confirm that 1.0.0-beta3 resolves the issue for the file saving.
Thank you for the fast response!
And thank you for taking the time to explain the closing of the PR.🙏
I suspected the PR would be a sloppy solution and that I was probably missing some complexity.
from scribe.
Thanks for fixing!
from scribe.
Related Issues (20)
- Strategy ResponseCalls running on all endpoints instead of only GET endpoints HOT 4
- getting 401 Unauthorized in each routes where i set the middleware HOT 1
- Plugin List?
- How to override post-response script content for the postman? HOT 1
- Using @apiResource as a @bodyParam? HOT 1
- scalar theme doesnt properly generate example and child attributes HOT 1
- array request not render and not examplae
- Example is not using factory HOT 1
- Missing 'Accept' => 'application/json' HOT 5
- How to send NULL values? HOT 2
- Support wider range of types
- How use recursive schema ? HOT 1
- 404 Not Found on Production HOT 6
- Multiple responses do not generate oneOf correctly
- The package is ending with a Check Failed Error HOT 1
- Badges don't work with element theme HOT 3
- Response fields overflows to dark box on default theme
- Theme Dark Mode Support HOT 1
- HTML Generated by scribe uses a version of lodash that has had a 9.1 CVE vulnerability since 2019 amongst 5 others HOT 3
- Support auto generete with laravel-data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.