Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'cslant:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Jan 9, 2024
2 parents edf7afa + b13c927 commit 65f6b0d
Show file tree
Hide file tree
Showing 29 changed files with 320 additions and 83 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -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}}
26 changes: 26 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .github/workflows/setup_test.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ npm-debug.log

package-lock.json
yarn.lock
/.sass-cache
/.sass-cache

build
.php-cs-fixer.cache
storage
40 changes: 40 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->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);
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@

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

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

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:
Expand All @@ -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"
```


Expand All @@ -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.

<p align="center">
<a href="https://packagist.org/packages/lbiltech/laravel-generator">
<a href="https://packagist.org/packages/cslant/laravel-generator">
<img src="https://img.shields.io/packagist/l/doctrine/orm.svg" data-origin="https://img.shields.io/packagist/l/doctrine/orm.svg" alt="license">
</a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions common/helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Lbil\LaravelGenerator\Exceptions\LaravelGeneratorException;
use CSlant\LaravelGenerator\Exceptions\LaravelGeneratorException;

if (!function_exists('laravel_generator_dist_path')) {
/**
Expand Down Expand Up @@ -43,7 +43,7 @@ function laravel_generator_asset(string $asset): string
throw new LaravelGeneratorException(sprintf('%s - this Laravel Generator asset does not exist', $asset));
}

$useAbsolutePath = config('laravel-generator.defaults.paths.use_absolute_path', true);
$useAbsolutePath = config('laravel-generator.defaults.paths.use_absolute_path');

return route('laravel_generator.asset', ['asset' => $asset], $useAbsolutePath).'?v='.filemtime($file);
}
Expand Down
44 changes: 30 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lbiltech/laravel-generator",
"name": "cslant/laravel-generator",
"description": "Laravel Generator",
"homepage": "https://github.com/lbiltech/laravel-generator",
"homepage": "https://github.com/cslant/laravel-generator",
"type": "library",
"license": "MIT",
"keywords": [
Expand All @@ -10,23 +10,24 @@
"crud generator",
"migration generator",
"model generator",
"controller",
"controller generator",
"repository",
"request",
"resource",
"factory",
"seeder",
"action",
"laravel-generator"
"laravel generator",
"cslant"
],
"autoload": {
"psr-4": {
"Lbil\\LaravelGenerator\\": "src/"
"CSlant\\LaravelGenerator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Lbil\\LaravelGenerator\\Tests\\": "tests/"
"CSlant\\LaravelGenerator\\Tests\\": "tests/"
}
},
"authors": [
Expand All @@ -40,23 +41,38 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.3|^8.0",
"laravel/framework": "^8.0|^9.0|^10.0",
"lbiltech/laravel-generator-ui": "^v1.0.0"
"php": "^8.1",
"laravel/framework": "^9.0|^10.0",
"cslant/laravel-generator-ui": "^v1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5|^10.0",
"mockery/mockery": "^1.5",
"ext-openssl": "*"
"friendsofphp/php-cs-fixer": "^v3.0",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.3",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3"
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
},
"support": {
"issues": "https://github.com/lbiltech/laravel-generator/issues"
"issues": "https://github.com/cslant/laravel-generator/issues"
},
"extra": {
"laravel": {
"providers": [
"Lbil\\LaravelGenerator\\Providers\\LaravelGeneratorServiceProvider"
"CSlant\\LaravelGenerator\\Providers\\LaravelGeneratorServiceProvider"
]
}
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true
}
}
}
Loading

0 comments on commit 65f6b0d

Please sign in to comment.