Package skeleton update
Test / test_all (push) Successful in 39s
Details
Test / test_all (push) Successful in 39s
Details
parent
afae241173
commit
51addf2b00
|
@ -0,0 +1,29 @@
|
||||||
|
name: Test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test_all:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
container: git.gertjankrol.nl/docker/php-toolkit:latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: composer install
|
||||||
|
run: composer install --profile
|
||||||
|
- name: phpunit
|
||||||
|
run: composer unit
|
||||||
|
- name: phplint
|
||||||
|
run: composer lint
|
||||||
|
- name: phpcs
|
||||||
|
run: composer style
|
||||||
|
- name: composer require check
|
||||||
|
run: composer require-check
|
||||||
|
- name: composer security check
|
||||||
|
run: composer security-check
|
||||||
|
- name: composer unused package check
|
||||||
|
run: composer unused-check
|
||||||
|
- name: composer normalize check
|
||||||
|
run: composer normalize --dry-run
|
|
@ -1,6 +1,8 @@
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/node_modules/
|
||||||
/vendor/
|
/vendor/
|
||||||
composer.lock
|
composer.lock
|
||||||
|
package-lock.json
|
||||||
*cache*
|
*cache*
|
||||||
*.log
|
*.log
|
||||||
*.tmp
|
*.tmp
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
stages:
|
|
||||||
- prepare
|
|
||||||
- test
|
|
||||||
|
|
||||||
prepare:composer-install:
|
|
||||||
stage: prepare
|
|
||||||
tags:
|
|
||||||
- prepare
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- echo "Start composer install"
|
|
||||||
- composer install --no-scripts --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1h
|
|
||||||
paths:
|
|
||||||
- composer.lock
|
|
||||||
- vendor/
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
test:composer-security-check:
|
|
||||||
stage: test
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
needs:
|
|
||||||
- job: prepare:composer-install
|
|
||||||
artifacts: true
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- echo "Start package security check"
|
|
||||||
- composer security-checker
|
|
||||||
allow_failure: true
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
test:php-codesniffer:
|
|
||||||
stage: test
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
needs:
|
|
||||||
- job: prepare:composer-install
|
|
||||||
artifacts: true
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- echo "Start PHP code sniffer"
|
|
||||||
- composer style
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
# https://github.com/overtrue/phplint
|
|
||||||
test:php-lint:
|
|
||||||
stage: test
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
needs:
|
|
||||||
- job: prepare:composer-install
|
|
||||||
artifacts: true
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- composer lint
|
|
||||||
interruptible: true
|
|
||||||
except:
|
|
||||||
- /^v\d+\.\d+\.\d+$/
|
|
||||||
|
|
||||||
test:phpunit-tests:
|
|
||||||
stage: test
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
needs:
|
|
||||||
- job: prepare:composer-install
|
|
||||||
artifacts: true
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- echo "Start PHPUnit tests"
|
|
||||||
- composer test
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
test:composer-require-checker:
|
|
||||||
stage: test
|
|
||||||
tags:
|
|
||||||
- test
|
|
||||||
needs:
|
|
||||||
- job: prepare:composer-install
|
|
||||||
artifacts: true
|
|
||||||
image: composer:2.4
|
|
||||||
script:
|
|
||||||
- echo "Downloading Composer require checker"
|
|
||||||
- curl -OL https://github.com/maglnet/ComposerRequireChecker/releases/download/4.0.0/composer-require-checker.phar
|
|
||||||
- echo "Start Composer require checker"
|
|
||||||
- php composer-require-checker.phar check composer.json
|
|
||||||
interruptible: true
|
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) Author
|
Copyright (c) 2023 - Gertjan Krol
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -20,6 +20,13 @@ composer require gkrol/skeleton
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
- Run PHPUnit: `composer unit`
|
||||||
|
- Run PHPLint: `composer lint`
|
||||||
|
- Run PHPCS/PHPCBF: `composer style`/`composer fix-style`
|
||||||
|
- Run require checker: `composer require-check`
|
||||||
|
- Run security checker: `composer security-check`
|
||||||
|
- Check for unused packages: `composer unused-check`
|
||||||
|
- **Run all tests: `composer test-all`**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer test
|
composer test
|
||||||
|
|
|
@ -1,30 +1,33 @@
|
||||||
{
|
{
|
||||||
"name": "gkrol/skeleton",
|
"name": "gkrol/skeleton",
|
||||||
"description": "Laravel package skeleton",
|
"description": "Laravel package skeleton",
|
||||||
|
"license": "MIT",
|
||||||
|
"type": "library",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"gkrol",
|
"gkrol",
|
||||||
"skeleton"
|
"skeleton"
|
||||||
],
|
],
|
||||||
"homepage": "https://git.gertjankrol.nl/gertjan/gkrol-laravel-package-skeleton",
|
|
||||||
"license": "MIT",
|
|
||||||
"type": "library",
|
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Gertjan Krol",
|
"name": "Gertjan Krol",
|
||||||
"email": "hello@gertjankrol.nl"
|
"email": "hello@gertjankrol.nl"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"homepage": "https://git.gertjankrol.nl/gertjan/gkrol-laravel-package-skeleton",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.1",
|
"php": "^8.1",
|
||||||
"illuminate/support": "^8.0"
|
"laravel/framework": "^10.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"orchestra/testbench": "^6.24",
|
"crawl/coding-standard": "^1.1",
|
||||||
"enlightn/security-checker": "^1.10",
|
"enlightn/security-checker": "^1.10",
|
||||||
"crawl/coding-standard": "^1.0",
|
"ergebnis/composer-normalize": "^2.31",
|
||||||
|
"icanhazstring/composer-unused": "^0.8.8",
|
||||||
|
"maglnet/composer-require-checker": "^4.6",
|
||||||
"mockery/mockery": "^1.5",
|
"mockery/mockery": "^1.5",
|
||||||
"overtrue/phplint": "^4.3",
|
"orchestra/testbench": "^8.5",
|
||||||
"phpunit/phpunit": "^9.5"
|
"overtrue/phplint": "^9.0",
|
||||||
|
"phpunit/phpunit": "^10.1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -36,28 +39,40 @@
|
||||||
"GKrol\\Skeleton\\Tests\\": "tests"
|
"GKrol\\Skeleton\\Tests\\": "tests"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
|
||||||
"lint": "vendor/bin/phplint ./ --exclude=vendor",
|
|
||||||
"style": "vendor/bin/phpcs --standard=phpcs.xml",
|
|
||||||
"fix-style": "vendor/bin/phpcbf --standard=phpcs.xml",
|
|
||||||
"security-checker": "vendor/bin/security-checker security:check composer.lock",
|
|
||||||
"test": "vendor/bin/phpunit --configuration phpunit.xml --colors=never"
|
|
||||||
},
|
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
|
||||||
"sort-packages": true,
|
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||||
}
|
"ergebnis/composer-normalize": true
|
||||||
|
},
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"sort-packages": true
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
|
||||||
"GKrol\\Skeleton\\SkeletonServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"Skeleton": "GKrol\\Skeleton\\SkeletonFacade"
|
"Skeleton": "GKrol\\Skeleton\\SkeletonFacade"
|
||||||
|
},
|
||||||
|
"providers": [
|
||||||
|
"GKrol\\Skeleton\\SkeletonServiceProvider"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"scripts": {
|
||||||
|
"fix-style": "vendor/bin/phpcbf --standard=phpcs.xml",
|
||||||
|
"lint": "vendor/bin/phplint ./ --exclude=vendor",
|
||||||
|
"require-check": "vendor/bin/composer-require-checker check composer.json",
|
||||||
|
"security-check": "vendor/bin/security-checker security:check composer.lock",
|
||||||
|
"style": "vendor/bin/phpcs --standard=phpcs.xml",
|
||||||
|
"test-all": [
|
||||||
|
"composer unit",
|
||||||
|
"composer lint",
|
||||||
|
"composer style",
|
||||||
|
"composer require-check",
|
||||||
|
"composer security-check",
|
||||||
|
"composer unused-check",
|
||||||
|
"composer normalize --dry-run"
|
||||||
|
],
|
||||||
|
"unit": "vendor/bin/phpunit --configuration phpunit.xml --colors=never",
|
||||||
|
"unused-check": "vendor/bin/composer-unused"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"laravel-vite-plugin": "^0.7",
|
||||||
|
"sass": "^1.62",
|
||||||
|
"vite": "^4.3"
|
||||||
|
}
|
||||||
|
}
|
13
phpunit.xml
13
phpunit.xml
|
@ -1,10 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage/>
|
||||||
<include>
|
|
||||||
<directory suffix=".php">./src</directory>
|
|
||||||
</include>
|
|
||||||
</coverage>
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Unit">
|
<testsuite name="Unit">
|
||||||
<directory suffix="Test.php">./tests/</directory>
|
<directory suffix="Test.php">./tests/</directory>
|
||||||
|
@ -13,4 +9,9 @@
|
||||||
<php>
|
<php>
|
||||||
|
|
||||||
</php>
|
</php>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">./src</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"resources/js/app.js": {
|
||||||
|
"file": "app.js",
|
||||||
|
"isEntry": true,
|
||||||
|
"src": "resources/js/app.js"
|
||||||
|
},
|
||||||
|
"resources/sass/app.scss": {
|
||||||
|
"file": "app.css",
|
||||||
|
"isEntry": true,
|
||||||
|
"src": "resources/sass/app.scss"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
/** Package JS goes here */
|
|
@ -0,0 +1 @@
|
||||||
|
/** Package CSS goes here */
|
|
@ -4,7 +4,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace GKrol\Skeleton;
|
namespace GKrol\Skeleton;
|
||||||
|
|
||||||
class Skeleton
|
final class Skeleton
|
||||||
{
|
{
|
||||||
|
public const PACKAGE_VENDOR = 'gkrol';
|
||||||
|
public const PACKAGE_NAME = 'skeleton';
|
||||||
|
|
||||||
// Build your next great package.
|
// Build your next great package.
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace GKrol\Skeleton;
|
||||||
use Illuminate\Support\Facades\Facade;
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \GKrol\Skeleton\Skeleton
|
* @see Skeleton
|
||||||
*/
|
*/
|
||||||
class SkeletonFacade extends Facade
|
class SkeletonFacade extends Facade
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,6 @@ class SkeletonFacade extends Facade
|
||||||
*/
|
*/
|
||||||
protected static function getFacadeAccessor(): string
|
protected static function getFacadeAccessor(): string
|
||||||
{
|
{
|
||||||
return SkeletonServiceProvider::PACKAGE_NAME;
|
return Skeleton::PACKAGE_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,9 @@ namespace GKrol\Skeleton;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class SkeletonServiceProvider extends ServiceProvider
|
final class SkeletonServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public const PACKAGE_VENDOR = 'gkrol';
|
private const COMMANDS = [];
|
||||||
public const PACKAGE_NAME = 'skeleton';
|
|
||||||
|
|
||||||
private const COMMANDS = [
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap the application services.
|
* Bootstrap the application services.
|
||||||
|
@ -21,30 +16,30 @@ class SkeletonServiceProvider extends ServiceProvider
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// Optional methods to load package assets
|
// Optional methods to load package assets
|
||||||
//$this->loadMigrationsFrom($this->getPackagePath() . '/database/migrations');
|
//$this->loadMigrationsFrom($this->packageRoot() . '/database/migrations');
|
||||||
//$this->loadRoutesFrom($this->getPackagePath() . '/routes.php');
|
//$this->loadRoutesFrom($this->packageRoot() . '/routes.php');
|
||||||
//$this->loadTranslationsFrom($this->getPackagePath() . '/resources/lang', self::PACKAGE_NAME);
|
//$this->loadTranslationsFrom($this->packageRoot() . '/resources/lang', Skeleton::PACKAGE_NAME);
|
||||||
//$this->loadViewsFrom($this->getPackagePath() . '/resources/views', self::PACKAGE_NAME);
|
//$this->loadViewsFrom($this->packageRoot() . '/resources/views', Skeleton::PACKAGE_NAME);
|
||||||
|
|
||||||
if ($this->app->runningInConsole()) {
|
if ($this->app->runningInConsole()) {
|
||||||
// Publish config
|
// Publish config
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
$this->getPackagePath() . '/config/config.php' => config_path(self::PACKAGE_NAME . '.php'),
|
$this->packageRoot() . '/config/config.php' => config_path(Skeleton::PACKAGE_NAME . '.php'),
|
||||||
], 'config');
|
], 'config');
|
||||||
|
|
||||||
// Publish assets
|
// Publish assets
|
||||||
//$this->publishes([
|
//$this->publishes([
|
||||||
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
|
// $this->packageRoot() . '/public' => public_path('vendor/' . Skeleton::PACKAGE_NAME),
|
||||||
//], ['assets', 'public']);
|
//], ['assets', 'public']);
|
||||||
|
|
||||||
// Publishing translation files
|
// Publishing translation files
|
||||||
//$this->publishes([
|
//$this->publishes([
|
||||||
// $this->getPackagePath() . '/resources/lang' => resource_path('lang/vendor/' . self::PACKAGE_NAME),
|
// $this->packageRoot() . '/resources/lang' => resource_path('lang/vendor/' . Skeleton::PACKAGE_NAME),
|
||||||
//], 'lang');
|
//], 'lang');
|
||||||
|
|
||||||
// Publishing views
|
// Publishing views
|
||||||
//$this->publishes([
|
//$this->publishes([
|
||||||
// $this->getPackagePath() . '/resources/views' => resource_path('views/vendor/' . self::PACKAGE_NAME),
|
// $this->packageRoot() . '/resources/views' => resource_path('views/vendor/' . Skeleton::PACKAGE_NAME),
|
||||||
//], 'views');
|
//], 'views');
|
||||||
|
|
||||||
// Registering package commands
|
// Registering package commands
|
||||||
|
@ -58,15 +53,15 @@ class SkeletonServiceProvider extends ServiceProvider
|
||||||
public function register(): void
|
public function register(): void
|
||||||
{
|
{
|
||||||
// Automatically apply the package configuration
|
// Automatically apply the package configuration
|
||||||
$this->mergeConfigFrom($this->getPackagePath() . '/config/config.php', self::PACKAGE_NAME);
|
$this->mergeConfigFrom($this->packageRoot() . '/config/config.php', Skeleton::PACKAGE_NAME);
|
||||||
|
|
||||||
// Register the main class to use with the facade
|
// Register the main class to use with the facade
|
||||||
$this->app->singleton(self::PACKAGE_NAME, static function () {
|
$this->app->singleton(Skeleton::PACKAGE_NAME, static function () {
|
||||||
return new Skeleton();
|
return new Skeleton();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPackagePath(): string
|
private function packageRoot(): string
|
||||||
{
|
{
|
||||||
return realpath(__DIR__ . '/..');
|
return realpath(__DIR__ . '/..');
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import laravel from 'laravel-vite-plugin';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
outDir: 'public',
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
entryFileNames: `[name].js`,
|
||||||
|
assetFileNames: `[name].[ext]`
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
laravel({
|
||||||
|
input: [
|
||||||
|
'resources/sass/app.scss',
|
||||||
|
'resources/js/app.js',
|
||||||
|
],
|
||||||
|
refresh: false,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
Loading…
Reference in New Issue