From ce747b9db52e6fd022fcfe92ae84db2cb64a267d Mon Sep 17 00:00:00 2001 From: RVxLab Date: Sat, 12 Jun 2021 09:44:27 +0200 Subject: [PATCH] Modify the skeleton to what I need it to be --- .github/FUNDING.yml | 1 - .github/ISSUE_TEMPLATE/config.yml | 6 +- .github/SECURITY.md | 3 - .github/workflows/php-cs-fixer.yml | 2 +- .github/workflows/{psalm.yml => phpstan.yml} | 8 +- .github/workflows/run-tests.yml | 2 +- .gitignore | 2 +- .php-cs-fixer.php | 25 ++++ .php_cs.dist.php | 40 ----- CHANGELOG.md | 2 +- LICENSE.md | 2 +- Makefile | 60 ++++++++ README.md | 76 +++------- composer.json | 35 ++--- config/skeleton.php | 5 - configure-skeleton.sh | 137 ------------------ database/factories/ModelFactory.php | 19 --- .../migrations/create_skeleton_table.php.stub | 19 --- docker-compose.override.yml.dist | 4 + docker-compose.yml | 13 ++ docker/workspace/Dockerfile | 46 ++++++ docker/workspace/php.ini | 4 + phpstan.neon | 6 + phpunit.xml.dist | 2 +- psalm.xml.dist | 16 -- src/Commands/SkeletonCommand.php | 17 --- src/FilamentColorpickerServiceProvider.php | 18 +++ src/Skeleton.php | 7 - src/SkeletonFacade.php | 16 -- src/SkeletonServiceProvider.php | 25 ---- testbench.yaml | 2 +- tests/ExampleTest.php | 12 +- tests/TestCase.php | 36 ++--- 33 files changed, 245 insertions(+), 423 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/SECURITY.md rename .github/workflows/{psalm.yml => phpstan.yml} (84%) create mode 100644 .php-cs-fixer.php delete mode 100644 .php_cs.dist.php create mode 100644 Makefile delete mode 100644 config/skeleton.php delete mode 100755 configure-skeleton.sh delete mode 100644 database/factories/ModelFactory.php delete mode 100644 database/migrations/create_skeleton_table.php.stub create mode 100644 docker-compose.override.yml.dist create mode 100644 docker-compose.yml create mode 100644 docker/workspace/Dockerfile create mode 100644 docker/workspace/php.ini create mode 100644 phpstan.neon delete mode 100644 psalm.xml.dist delete mode 100644 src/Commands/SkeletonCommand.php create mode 100644 src/FilamentColorpickerServiceProvider.php delete mode 100755 src/Skeleton.php delete mode 100644 src/SkeletonFacade.php delete mode 100644 src/SkeletonServiceProvider.php diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c68765b..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: :vendor_name diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 0d31fb8..088e19e 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: Ask a question - url: https://github.com/vendor_slug/package_slug/discussions/new?category=q-a + url: https://github.com/rvxlab/filament-colorpicker/discussions/new?category=q-a about: Ask the community for help - name: Request a feature - url: https://github.com/vendor_slug/package_slug/discussions/new?category=ideas + url: https://github.com/rvxlab/filament-colorpicker/discussions/new?category=ideas about: Share ideas for new features - name: Report a bug - url: https://github.com/vendor_slug/package_slug/issues/new + url: https://github.com/rvxlab/filament-colorpicker/issues/new about: Report a reproducable bug diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index 12ab7c2..0000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Security Policy - -If you discover any security related issues, please email author@domain.com instead of using the issue tracker. diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index f55d1fa..5811f0c 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -15,7 +15,7 @@ jobs: - name: Run PHP CS Fixer uses: docker://oskarstark/php-cs-fixer-ga with: - args: --config=.php_cs.dist.php --allow-risky=yes + args: --config=.php-cs-fixer.php --allow-risky=yes - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/psalm.yml b/.github/workflows/phpstan.yml similarity index 84% rename from .github/workflows/psalm.yml rename to .github/workflows/phpstan.yml index e48b24f..28e5764 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/phpstan.yml @@ -1,10 +1,10 @@ -name: Psalm +name: PHPStan on: push: paths: - '**.php' - - 'psalm.xml.dist' + - 'phpstan.neon' jobs: psalm: @@ -29,5 +29,5 @@ jobs: - name: Run composer install run: composer install -n --prefer-dist - - name: Run psalm - run: ./vendor/bin/psalm --output-format=github + - name: Run PHPStan + run: php -d memory_limit=-1 vendor/bin/phpstan analyze diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 28b0602..017ebb2 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,4 @@ -name: run-tests +name: Run tests on: push: diff --git a/.gitignore b/.gitignore index 0a63bc1..f631bd7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,8 @@ composer.lock coverage docs phpunit.xml -psalm.xml testbench.yaml vendor node_modules .php-cs-fixer.cache +docker-compose.override.yml diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..c842a95 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,25 @@ +setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + '@Symfony:risky' => true, + '@PHP71Migration:risky' => true, + '@PHP73Migration' => true, + 'blank_line_after_opening_tag' => true, + 'method_argument_space' => false, + ]) + ->setFinder((new PhpCsFixer\Finder()) + ->in( + array_map( + static fn (string $dir) => __DIR__ . '/' . $dir, + $dirs, + ) + ), + ); diff --git a/.php_cs.dist.php b/.php_cs.dist.php deleted file mode 100644 index 3de28fd..0000000 --- a/.php_cs.dist.php +++ /dev/null @@ -1,40 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index 767365d..c929c6a 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 `filament-colorpicker` will be documented in this file. ## 1.0.0 - 202X-XX-XX diff --git a/LICENSE.md b/LICENSE.md index 58c9ad4..b527106 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) :vendor_name +Copyright (c) rvxlab 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/Makefile b/Makefile new file mode 100644 index 0000000..cfa59a4 --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +.PHONY: testbench + +EXEC="docker-compose exec -u app workspace" + +uid=1000 +gid=1000 + +## Docker +up: + docker-compose up -d + +start: up + +down: + docker-compose down + +stop: down + +dcbuild: + docker-compose build + +composer: + "$(EXEC)" composer $(cmd) + +## Artisan +testbench: + "$(EXEC)" php vendor/bin/testbench $(cmd) + +## Testing +phpcsfixer: + "$(EXEC)" vendor/bin/php-cs-fixer fix + +phpstan: + "$(EXEC)" php -d memory_limit=-1 vendor/bin/phpstan analyze + +test: + "$(EXEC)" vendor/bin/testbench package:test --parallel --no-coverage + +test-coverage: + "$(EXEC)" vendor/bin/phpunit --coverage-html coverage + +test-all: phpstan phpcsfixer test + +## Npm + +npm: + "$(EXEC)" npm $(cmd) + +npm-dev: + "$(EXEC)" npm run dev + +npm-watch: + "$(EXEC)" npm run watch + +npm-prod: + "$(EXEC)" npm run prod + +## Misc +sh: + "$(EXEC)" sh diff --git a/README.md b/README.md index ca1e50f..5b56d0d 100644 --- a/README.md +++ b/README.md @@ -1,85 +1,49 @@ -# :package_description +# A colorpicker package for Laravel Filament -[![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/rvxlab/filament-colorpicker.svg?style=flat-square)](https://packagist.org/packages/rvxlab/filament-colorpicker) +[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/rvxlab/filament-colorpicker/run-tests?label=tests)](https://github.com/rvxlab/filament-colorpicker/actions?query=workflow%3Arun-tests+branch%3Amain) +[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/rvxlab/filament-colorpicker/Check%20&%20fix%20styling?label=code%20style)](https://github.com/rvxlab/filament-colorpicker/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) +[![Total Downloads](https://img.shields.io/packagist/dt/rvxlab/filament-colorpicker.svg?style=flat-square)](https://packagist.org/packages/rvxlab/filament-colorpicker) ---- -This repo can be used as 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 -2. Run "./configure-skeleton.sh" 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. -5. If you need help creating a package, consider picking up our Laravel Package Training video course. ---- - -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. - -## Support us - -[](https://spatie.be/github-ad-click/:package_name) - -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). - -We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). +**TODO: Add a description** ## Installation You can install the package via composer: ```bash -composer require vendor_slug/package_slug +composer require rvxlab/filament-colorpicker ``` -You can publish and run the migrations with: +## Usage -```bash -php artisan vendor:publish --provider="VendorName\Skeleton\SkeletonServiceProvider" --tag="package_slug-migrations" -php artisan migrate -``` +**TODO** -You can publish the config file with: -```bash -php artisan vendor:publish --provider="VendorName\Skeleton\SkeletonServiceProvider" --tag="package_slug-config" -``` +## Changelog -This is the contents of the published config file: +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. -```php -return [ -]; -``` +## Contributing -## Usage +For development this repository contains a Docker Compose file to provide all the tools needed, as well as a Makefile to run useful commands. -```php -$skeleton = new VendorName\Skeleton(); -echo $skeleton->echoPhrase('Hello, Spatie!'); -``` +To make use of this, ensure you have Docker and Docker Compose installed. -## Testing +To get started: ```bash -composer test +make dcbuild # Build the Docker image +make start # Run the container +make composer cmd=install ``` -## Changelog - -Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. - -## Contributing +Additionally you can copy and modify `docker-compose.override.yml.dist` to add any additional changes needed for the workspace container. Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. -## Security Vulnerabilities - -Please review [our security policy](../../security/policy) on how to report security vulnerabilities. - ## Credits -- [:author_name](https://github.com/:author_username) +- [RVxLab](https://github.com/RVxLab) - [All Contributors](../../contributors) ## License diff --git a/composer.json b/composer.json index ccc4f8d..5bf20b9 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": "vendor_slug/package_slug", - "description": ":package_description", + "name": "rvxlab/filament-colorpicker", + "description": "A colorpicker package for Laravel Filament", "keywords": [ - ":vendor_name", + "rvxlab", "laravel", - "package_slug" + "filament-colorpicker" ], - "homepage": "https://github.com/vendor_slug/package_slug", + "homepage": "https://github.com/rvxlab/filament-colorpicker", "license": "MIT", "authors": [ { - "name": ":author_name", - "email": "author@domain.com", + "name": "RVxLab", + "email": "richard@rvx.works", "role": "Developer" } ], @@ -22,38 +22,35 @@ }, "require-dev": { "brianium/paratest": "^6.2", + "friendsofphp/php-cs-fixer": "^3.0", "nunomaduro/collision": "^5.3", + "nunomaduro/larastan": "^0.7.6", "orchestra/testbench": "^6.15", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-phpunit": "^0.12.19", "phpunit/phpunit": "^9.3", - "spatie/laravel-ray": "^1.9", - "vimeo/psalm": "^4.4" + "spatie/laravel-ray": "^1.9" }, "autoload": { "psr-4": { - "VendorName\\Skeleton\\": "src", - "VendorName\\Skeleton\\Database\\Factories\\": "database/factories" + "RVxLab\\FilamentColorpicker\\": "src" } }, "autoload-dev": { "psr-4": { - "VendorName\\Skeleton\\Tests\\": "tests" + "RVxLab\\FilamentColorpicker\\Tests\\": "tests" } }, - "scripts": { - "psalm": "vendor/bin/psalm", - "test": "./vendor/bin/testbench package:test --parallel --no-coverage", - "test-coverage": "vendor/bin/phpunit --coverage-html coverage" - }, "config": { "sort-packages": true }, "extra": { "laravel": { "providers": [ - "VendorName\\Skeleton\\SkeletonServiceProvider" + "RVxLab\\FilamentColorpicker\\FilamentColorpickerServiceProvider" ], "aliases": { - "Skeleton": "VendorName\\Skeleton\\SkeletonFacade" + "FilamentColorpicker": "RVxLab\\FilamentColorpicker\\FilamentColorpickerFacade" } } }, diff --git a/config/skeleton.php b/config/skeleton.php deleted file mode 100644 index 6f1c500..0000000 --- a/config/skeleton.php +++ /dev/null @@ -1,5 +0,0 @@ -" or ".