Package skeleton update
Test / test_all (push) Successful in 39s
Details
Test / test_all (push) Successful in 39s
Details
parent
457a0cbe4b
commit
6bdf642c35
|
@ -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/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
composer.lock
|
||||
package-lock.json
|
||||
*cache*
|
||||
*.log
|
||||
*.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
|
||||
|
||||
Copyright (c) Author
|
||||
Copyright (c) 2023 - Gertjan Krol
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -20,6 +20,13 @@ composer require gkcld/skeleton
|
|||
```
|
||||
|
||||
### 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
|
||||
composer test
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
{
|
||||
"name": "gkcld/skeleton",
|
||||
"description": "GKcld Laravel package skeleton",
|
||||
"license": "MIT",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"gkcld",
|
||||
"skeleton"
|
||||
],
|
||||
"homepage": "https://git.gertjankrol.nl/gkcld/laravel-package-skeleton",
|
||||
"license": "MIT",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Gertjan Krol",
|
||||
"email": "hello@gertjankrol.nl"
|
||||
}
|
||||
],
|
||||
"homepage": "https://git.gertjankrol.nl/gkcld/laravel-package-skeleton",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"illuminate/support": "^8.0"
|
||||
"laravel/framework": "^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.24",
|
||||
"crawl/coding-standard": "^1.1",
|
||||
"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",
|
||||
"overtrue/phplint": "^4.3",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
"orchestra/testbench": "^8.5",
|
||||
"overtrue/phplint": "^9.0",
|
||||
"phpunit/phpunit": "^10.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -36,28 +39,40 @@
|
|||
"GKcld\\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": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"ergebnis/composer-normalize": true
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"GKcld\\Skeleton\\SkeletonServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Skeleton": "GKcld\\Skeleton\\SkeletonFacade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"providers": [
|
||||
"GKcld\\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"?>
|
||||
<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">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<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/>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/</directory>
|
||||
|
@ -13,4 +9,9 @@
|
|||
<php>
|
||||
|
||||
</php>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</source>
|
||||
</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 GKcld\Skeleton;
|
||||
|
||||
class Skeleton
|
||||
final class Skeleton
|
||||
{
|
||||
public const PACKAGE_VENDOR = 'gkcld';
|
||||
public const PACKAGE_NAME = 'skeleton';
|
||||
|
||||
// Build your next great package.
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@ namespace GKcld\Skeleton;
|
|||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @see \GKcld\Skeleton\Skeleton
|
||||
* @see Skeleton
|
||||
*/
|
||||
class SkeletonFacade extends Facade
|
||||
final class SkeletonFacade extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*/
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return SkeletonServiceProvider::PACKAGE_NAME;
|
||||
return Skeleton::PACKAGE_NAME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,9 @@ namespace GKcld\Skeleton;
|
|||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SkeletonServiceProvider extends ServiceProvider
|
||||
final class SkeletonServiceProvider extends ServiceProvider
|
||||
{
|
||||
public const PACKAGE_VENDOR = 'gkcld';
|
||||
public const PACKAGE_NAME = 'skeleton';
|
||||
|
||||
private const COMMANDS = [
|
||||
|
||||
];
|
||||
private const COMMANDS = [];
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
|
@ -21,30 +16,30 @@ class SkeletonServiceProvider extends ServiceProvider
|
|||
public function boot(): void
|
||||
{
|
||||
// Optional methods to load package assets
|
||||
//$this->loadMigrationsFrom($this->getPackagePath() . '/database/migrations');
|
||||
//$this->loadRoutesFrom($this->getPackagePath() . '/routes.php');
|
||||
//$this->loadTranslationsFrom($this->getPackagePath() . '/resources/lang', self::PACKAGE_NAME);
|
||||
//$this->loadViewsFrom($this->getPackagePath() . '/resources/views', self::PACKAGE_NAME);
|
||||
//$this->loadMigrationsFrom($this->packageRoot() . '/database/migrations');
|
||||
//$this->loadRoutesFrom($this->packageRoot() . '/routes.php');
|
||||
//$this->loadTranslationsFrom($this->packageRoot() . '/resources/lang', Skeleton::PACKAGE_NAME);
|
||||
//$this->loadViewsFrom($this->packageRoot() . '/resources/views', Skeleton::PACKAGE_NAME);
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
// Publish config
|
||||
$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');
|
||||
|
||||
// Publish assets
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
|
||||
// $this->packageRoot() . '/public' => public_path('vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], ['assets', 'public']);
|
||||
|
||||
// Publishing translation files
|
||||
//$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');
|
||||
|
||||
// Publishing views
|
||||
//$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');
|
||||
|
||||
// Registering package commands
|
||||
|
@ -58,15 +53,15 @@ class SkeletonServiceProvider extends ServiceProvider
|
|||
public function register(): void
|
||||
{
|
||||
// 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
|
||||
$this->app->singleton(self::PACKAGE_NAME, static function () {
|
||||
$this->app->singleton(Skeleton::PACKAGE_NAME, static function () {
|
||||
return new Skeleton();
|
||||
});
|
||||
}
|
||||
|
||||
private function getPackagePath(): string
|
||||
private function packageRoot(): string
|
||||
{
|
||||
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