Commit 0164db21 authored by Erik Niebla's avatar Erik Niebla
Browse files

Remove README parragraphs(instructions)

parent e37a2bd3
......@@ -4,7 +4,7 @@
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/run-tests?label=tests)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/Check%20&%20fix%20styling?label=code%20style)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
<!--delete-->
---
This repo can be used to scaffold a Laravel package. Follow these steps to get started:
......@@ -14,7 +14,7 @@ This repo can be used to scaffold a Laravel package. Follow these steps to get s
4. Have fun creating your package.
5. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
---
<!--/delete-->
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
## Support us
......
......@@ -93,12 +93,24 @@ function remove_composer_script($scriptName) {
file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
}
function remove_readme_paragraphs(string $file): void {
$contents = file_get_contents($file);
file_put_contents(
$file,
preg_replace('/<!--delete-->.*<!--\/delete-->/s', '', $contents) ?: $contents
);
}
function safeUnlink(string $filename) {
if (file_exists($filename) && is_file($filename)) {
unlink($filename);
}
}
function determineSeparator(string $path): string {
return str_replace('/', DIRECTORY_SEPARATOR, $path);
}
function replaceForWindows(): array {
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton vendor_name vendor_slug author@domain.com"'));
......@@ -177,12 +189,13 @@ foreach ($files as $file) {
]);
match (true) {
str_contains($file, 'src'.DIRECTORY_SEPARATOR.'Skeleton.php') => rename($file, '.'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'' . $className . '.php'),
str_contains($file, 'src'.DIRECTORY_SEPARATOR.'SkeletonServiceProvider.php') => rename($file, '.'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'' . $className . 'ServiceProvider.php'),
str_contains($file, 'src'.DIRECTORY_SEPARATOR.'Facades'.DIRECTORY_SEPARATOR.'Skeleton.php') => rename($file, '.'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Facades'.DIRECTORY_SEPARATOR.'' . $className . '.php'),
str_contains($file, 'src'.DIRECTORY_SEPARATOR.'Commands'.DIRECTORY_SEPARATOR.'SkeletonCommand.php') => rename($file, '.'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Commands'.DIRECTORY_SEPARATOR.'' . $className . 'Command.php'),
str_contains($file, 'database'.DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'create_skeleton_table.php.stub') => rename($file, '.'.DIRECTORY_SEPARATOR.'database'.DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR.'create_' . $packageSlugWithoutPrefix . '_table.php.stub'),
str_contains($file, 'config'.DIRECTORY_SEPARATOR.'skeleton.php') => rename($file, '.'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'' . $packageSlugWithoutPrefix . '.php'),
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . $packageSlugWithoutPrefix . '_table.php.stub')),
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
str_contains($file, 'README.md') => remove_readme_paragraphs($file),
default => [],
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment