diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 0000000..0281309 --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,32 @@ +name: Dependabot auto-merge +on: pull_request_target + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1.6.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Auto-merge Dependabot PRs for semver-major updates + if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Auto-merge Dependabot PRs for semver-patch updates + if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml new file mode 100644 index 0000000..802d168 --- /dev/null +++ b/.github/workflows/php-cs-fixer.yml @@ -0,0 +1,26 @@ +name: Check & fix styling + +on: [push] + +permissions: + contents: write + +jobs: + php-cs-fixer: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Run PHP CS Fixer + uses: docker://oskarstark/php-cs-fixer-ga + with: + args: --config=.php-cs-fixer.dist.php --allow-risky=yes + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Fix styling diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..ff3cbb0 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,32 @@ +name: PHPStan + +on: [push, pull_request] + +jobs: + phpstan: + runs-on: ${{ matrix.os }} + name: PHPStan - P${{ matrix.php }} + + strategy: + matrix: + os: [ ubuntu-latest ] + php: [ '8.1', '8.2', '8.3' ] + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@2.26.0 + with: + php-version: ${{ matrix.php }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + composer install --no-interaction --no-progress --no-suggest + + - name: Run PHPStan + run: | + composer analyse --error-format=github diff --git a/.github/workflows/setup_test.yml b/.github/workflows/setup_test.yml new file mode 100644 index 0000000..f1b2866 --- /dev/null +++ b/.github/workflows/setup_test.yml @@ -0,0 +1,34 @@ +name: Setup & test + +on: [ push, pull_request ] + +jobs: + tests: + name: Composer P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest ] + php: [ '8.1', '8.2', '8.3' ] + laravel: [ 10.*, 9.* ] + include: + - laravel: 10.* + testbench: 8.* + - laravel: 9.* + testbench: 8.* + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + composer install --no-interaction --no-progress --no-suggest + + - name: Run tests + run: | + composer validate --strict diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..acd4c1d --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,31 @@ +name: Update Changelog + +on: + release: + types: [released] + +permissions: + contents: write + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: main + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.name }} + release-notes: ${{ github.event.release.body }} + + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: main + commit_message: Update CHANGELOG + file_pattern: CHANGELOG.md diff --git a/.gitignore b/.gitignore index b4ddc5f..d216841 100755 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,8 @@ npm-debug.log package-lock.json yarn.lock -/.sass-cache \ No newline at end of file +/.sass-cache + +build +.php-cs-fixer.cache +storage diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..001df5e --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,40 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + __DIR__ . '/routes', + __DIR__ . '/resources', + ]) + ->name('*.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], + 'no_unused_imports' => 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 new file mode 100644 index 0000000..cd82b96 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +Here you can see the full list of changes between each Laravel Generator release. + +## v1.0 - 2023-06-26 + +- Experimental release diff --git a/LICENSE b/LICENSE index 8cc32b7..792c300 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Tan Nguyen +Copyright (c) 2023 CSlant 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 2ff0c20..ce54596 100755 --- a/README.md +++ b/README.md @@ -2,16 +2,17 @@ This package is used to generate models, controllers, views, routes, migrations, seeders, factories, requests, and more for Laravel. -[![Latest Version](https://img.shields.io/github/release/lbiltech/laravel-generator.svg?style=flat-square)](https://github.com/lbiltech/laravel-generator/releases) -[![Total Downloads](https://img.shields.io/packagist/dt/lbiltech/laravel-generator.svg?style=flat-square)](https://packagist.org/packages/lbiltech/laravel-generator) +[![Latest Version](https://img.shields.io/github/release/cslant/laravel-generator.svg?style=flat-square)](https://github.com/cslant/laravel-generator/releases) +[![Total Downloads](https://img.shields.io/packagist/dt/cslant/laravel-generator.svg?style=flat-square)](https://packagist.org/packages/cslant/laravel-generator) +![Test Status](https://img.shields.io/github/actions/workflow/status/cslant/laravel-generator/setup_test.yml?label=tests&branch=main) [![StyleCI](https://styleci.io/repos/605697295/shield)](https://styleci.io/repos/605697295) -[![Quality Score](https://img.shields.io/scrutinizer/g/lbiltech/laravel-generator.svg?style=flat-square)](https://scrutinizer-ci.com/g/lbiltech/laravel-generator) -[![Maintainability](https://api.codeclimate.com/v1/badges/231c123bfa276fd1ac3c/maintainability)](https://codeclimate.com/github/lbiltech/laravel-generator/maintainability) +[![Quality Score](https://img.shields.io/scrutinizer/g/cslant/laravel-generator.svg?style=flat-square)](https://scrutinizer-ci.com/g/cslant/laravel-generator) +[![Maintainability](https://api.codeclimate.com/v1/badges/231c123bfa276fd1ac3c/maintainability)](https://codeclimate.com/github/cslant/laravel-generator/maintainability) ## Technology -- PHP ^7.3|^8.0 -- Laravel Framework 8.x, 9.x, 10.x +- PHP ^8.1 +- Laravel Framework 9.x, 10.x - Composer ## Installation @@ -19,7 +20,7 @@ This package is used to generate models, controllers, views, routes, migrations, You can install the package with [Composer](https://getcomposer.org/) using the following command: ```bash -composer require lbiltech/laravel-generator +composer require cslant/laravel-generator ``` ## Publish the config file, views, and language files @@ -27,7 +28,7 @@ composer require lbiltech/laravel-generator If you want to change the default configuration, the views, or the language files, you can publish them with the following command: ```bash - php artisan vendor:publish --provider="Lbil\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" + php artisan vendor:publish --provider="CSlant\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" ``` If you have run the above command, you will see the following files in your project: @@ -40,13 +41,13 @@ If you have run the above command, you will see the following files in your proj Also, you can publish only the config file with the following command: ```bash - php artisan vendor:publish --provider="Lbil\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" --tag="config" + php artisan vendor:publish --provider="CSlant\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" --tag="config" ``` Similarly, you can publish only the views with the following command: ```bash - php artisan vendor:publish --provider="Lbil\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" --tag="views" + php artisan vendor:publish --provider="CSlant\LaravelGenerator\Providers\LaravelGeneratorServiceProvider" --tag="views" ``` @@ -55,7 +56,7 @@ Similarly, you can publish only the views with the following command: The MIT License (MIT). Please see [License File](LICENSE) for more information.
-
+