From 5b552b3960b087ab119f60d41a612a8ef501359f Mon Sep 17 00:00:00 2001 From: freek Date: Mon, 15 Nov 2021 16:27:37 +0100 Subject: [PATCH] configure package --- .github/FUNDING.yml | 2 +- .github/ISSUE_TEMPLATE/config.yml | 8 +- .github/SECURITY.md | 2 +- CHANGELOG.md | 2 +- LICENSE.md | 2 +- README.md | 26 +-- composer.json | 24 +-- config/health.php | 5 + config/skeleton.php | 5 - configure.php | 151 ------------------ database/factories/ModelFactory.php | 2 +- ....php.stub => create_health_table.php.stub} | 2 +- phpunit.xml.dist | 2 +- ...{SkeletonCommand.php => HealthCommand.php} | 6 +- src/Health.php | 7 + src/HealthFacade.php | 16 ++ ...Provider.php => HealthServiceProvider.php} | 12 +- src/Skeleton.php | 7 - src/SkeletonFacade.php | 16 -- tests/Pest.php | 2 +- tests/TestCase.php | 10 +- 21 files changed, 79 insertions(+), 230 deletions(-) create mode 100644 config/health.php delete mode 100644 config/skeleton.php delete mode 100644 configure.php rename database/migrations/{create_skeleton_table.php.stub => create_health_table.php.stub} (80%) rename src/Commands/{SkeletonCommand.php => HealthCommand.php} (63%) create mode 100755 src/Health.php create mode 100644 src/HealthFacade.php rename src/{SkeletonServiceProvider.php => HealthServiceProvider.php} (59%) delete mode 100755 src/Skeleton.php delete mode 100644 src/SkeletonFacade.php diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c68765b0..5ccc87cf 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -github: :vendor_name +github: spatie diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d91c4761..664e2a87 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,16 +1,16 @@ blank_issues_enabled: false contact_links: - name: Ask a question - url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a + url: https://github.com/spatie/laravel-health/discussions/new?category=q-a about: Ask the community for help - name: Request a feature - url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas + url: https://github.com/spatie/laravel-health/discussions/new?category=ideas about: Share ideas for new features - name: Report a security issue - url: https://github.com/:vendor_name/:package_name/security/policy + url: https://github.com/spatie/laravel-health/security/policy about: Learn how to notify us for sensitive bugs - name: Report a bug url: https://github - name: Report a bug - url: https://github.com/:vendor_name/:package_name/issues/new + url: https://github.com/spatie/laravel-health/issues/new about: Report a reproducable bug diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 12ab7c2e..ca913434 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -1,3 +1,3 @@ # Security Policy -If you discover any security related issues, please email author@domain.com instead of using the issue tracker. +If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker. diff --git a/CHANGELOG.md b/CHANGELOG.md index 767365d5..ba1cc7be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -All notable changes to `:package_name` will be documented in this file. +All notable changes to `laravel-health` will be documented in this file. ## 1.0.0 - 202X-XX-XX diff --git a/LICENSE.md b/LICENSE.md index 58c9ad42..cfe14134 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) :vendor_name +Copyright (c) spatie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5faf283b..2653f7f4 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# :package_description +# Check the health of your Laravel app -[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug) -[![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) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-health.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-health) +[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-health/run-tests?label=tests)](https://github.com/spatie/laravel-health/actions?query=workflow%3Arun-tests+branch%3Amain) +[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-health/Check%20&%20fix%20styling?label=code%20style)](https://github.com/spatie/laravel-health/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) +[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-health.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-health) --- This repo can be used to scaffold a Laravel package. Follow these steps to get started: -1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton +1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this laravel-health 2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files 3. Remove this block of text. 4. Have fun creating your package. @@ -19,7 +19,7 @@ This is where your description should go. Limit it to a paragraph or two. Consid ## Support us -[](https://spatie.be/github-ad-click/:package_name) +[](https://spatie.be/github-ad-click/laravel-health) We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). @@ -30,19 +30,19 @@ We highly appreciate you sending us a postcard from your hometown, mentioning wh You can install the package via composer: ```bash -composer require :vendor_slug/:package_slug +composer require spatie/laravel-health ``` You can publish and run the migrations with: ```bash -php artisan vendor:publish --tag=":package_slug_without_prefix-migrations" +php artisan vendor:publish --tag="laravel-health_without_prefix-migrations" php artisan migrate ``` You can publish the config file with: ```bash -php artisan vendor:publish --tag=":package_slug_without_prefix-config" +php artisan vendor:publish --tag="laravel-health_without_prefix-config" ``` Optionally, you can publish the views using @@ -61,8 +61,8 @@ return [ ## Usage ```php -$skeleton = new VendorName\Skeleton(); -echo $skeleton->echoPhrase('Hello, VendorName!'); +$laravel-health = new Spatie\Health(); +echo $laravel-health->echoPhrase('Hello, Spatie!'); ``` ## Testing @@ -85,7 +85,7 @@ Please review [our security policy](../../security/policy) on how to report secu ## Credits -- [:author_name](https://github.com/:author_username) +- [Freek Van der Herten](https://github.com/freekmurze) - [All Contributors](../../contributors) ## License diff --git a/composer.json b/composer.json index 2c217397..53b9bd4b 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": ":vendor_slug/:package_slug", - "description": ":package_description", + "name": "spatie/laravel-health", + "description": "Check the health of your Laravel app", "keywords": [ - ":vendor_name", + "spatie", "laravel", - ":package_slug" + "laravel-health" ], - "homepage": "https://github.com/:vendor_slug/:package_slug", + "homepage": "https://github.com/spatie/laravel-health", "license": "MIT", "authors": [ { - "name": ":author_name", - "email": "author@domain.com", + "name": "Freek Van der Herten", + "email": "freek@spatie.be", "role": "Developer" } ], @@ -34,13 +34,13 @@ }, "autoload": { "psr-4": { - "VendorName\\Skeleton\\": "src", - "VendorName\\Skeleton\\Database\\Factories\\": "database/factories" + "Spatie\\Health\\": "src", + "Spatie\\Health\\Database\\Factories\\": "database/factories" } }, "autoload-dev": { "psr-4": { - "VendorName\\Skeleton\\Tests\\": "tests" + "Spatie\\Health\\Tests\\": "tests" } }, "scripts": { @@ -54,10 +54,10 @@ "extra": { "laravel": { "providers": [ - "VendorName\\Skeleton\\SkeletonServiceProvider" + "Spatie\\Health\\HealthServiceProvider" ], "aliases": { - "Skeleton": "VendorName\\Skeleton\\SkeletonFacade" + "Health": "Spatie\\Health\\HealthFacade" } } }, diff --git a/config/health.php b/config/health.php new file mode 100644 index 00000000..3dc57e29 --- /dev/null +++ b/config/health.php @@ -0,0 +1,5 @@ +"); -writeln("Namespace : {$vendorNamespace}\\{$className}"); -writeln("Class name : {$className}"); -writeln('------'); - -writeln('This script will replace the above values in all relevant files in the project directory.'); - -if (! confirm('Modify files?', true)) { - exit(1); -} - -$files = (str_starts_with(strtoupper(PHP_OS), 'WIN') ? replaceForWindows() : replaceForAllOtherOSes()); - -foreach ($files as $file) { - replace_in_file($file, [ - ':author_name' => $authorName, - ':author_username' => $authorUsername, - 'author@domain.com' => $authorEmail, - ':vendor_name' => $vendorName, - ':vendor_slug' => $vendorSlug, - 'VendorName' => $vendorNamespace, - ':package_name' => $packageName, - ':package_slug' => $packageSlug, - ':package_slug_without_prefix' => $packageSlugWithoutPrefix, - 'Skeleton' => $className, - 'skeleton' => $packageSlug, - ':package_description' => $description, - ]); - - match (true) { - str_contains($file, 'src/Skeleton.php') => rename($file, './src/' . $className . '.php'), - str_contains($file, 'src/SkeletonServiceProvider.php') => rename($file, './src/' . $className . 'ServiceProvider.php'), - str_contains($file, 'src/SkeletonFacade.php') => rename($file, './src/' . $className . 'Facade.php'), - str_contains($file, 'src/Commands/SkeletonCommand.php') => rename($file, './src/Commands/' . $className . 'Command.php'), - str_contains($file, 'database/migrations/create_skeleton_table.php.stub') => rename($file, './database/migrations/create_' . $packageSlugWithoutPrefix . '_table.php.stub'), - str_contains($file, 'config/skeleton.php') => rename($file, './config/' . $packageSlugWithoutPrefix . '.php'), - default => [], - }; -} - -confirm('Execute `composer install` and run tests?') && run('composer install && composer test'); - -confirm('Let this script delete itself?', true) && unlink(__FILE__); diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index c51604f4..755df246 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -1,6 +1,6 @@ id(); // add fields diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3bbe22af..94c0e39b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -19,7 +19,7 @@ verbose="true" > - + tests diff --git a/src/Commands/SkeletonCommand.php b/src/Commands/HealthCommand.php similarity index 63% rename from src/Commands/SkeletonCommand.php rename to src/Commands/HealthCommand.php index 3e5f6280..a295dc0c 100644 --- a/src/Commands/SkeletonCommand.php +++ b/src/Commands/HealthCommand.php @@ -1,12 +1,12 @@ name('skeleton') + ->name('laravel-health') ->hasConfigFile() ->hasViews() - ->hasMigration('create_skeleton_table') - ->hasCommand(SkeletonCommand::class); + ->hasMigration('create_laravel-health_table') + ->hasCommand(HealthCommand::class); } } diff --git a/src/Skeleton.php b/src/Skeleton.php deleted file mode 100755 index 66fab603..00000000 --- a/src/Skeleton.php +++ /dev/null @@ -1,7 +0,0 @@ -in(__DIR__); diff --git a/tests/TestCase.php b/tests/TestCase.php index d04fb0cc..a122d6c2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,10 +1,10 @@ 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory' + fn (string $modelName) => 'Spatie\\Health\\Database\\Factories\\'.class_basename($modelName).'Factory' ); } protected function getPackageProviders($app) { return [ - SkeletonServiceProvider::class, + HealthServiceProvider::class, ]; } @@ -29,7 +29,7 @@ public function getEnvironmentSetUp($app) config()->set('database.default', 'testing'); /* - $migration = include __DIR__.'/../database/migrations/create_skeleton_table.php.stub'; + $migration = include __DIR__.'/../database/migrations/create_laravel-health_table.php.stub'; $migration->up(); */ }