commit 38a6f15a820ea7c7153e60a60a657e5de6f9ce29 Author: Gertjan Krol Date: Wed Aug 30 20:22:13 2023 +0200 Initial commit diff --git a/.forgejo/workflows/test.yaml b/.forgejo/workflows/test.yaml new file mode 100644 index 0000000..b245281 --- /dev/null +++ b/.forgejo/workflows/test.yaml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..403dc62 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/.idea/ +/node_modules/ +/vendor/ +composer.lock +package-lock.json +*cache* +*.log +*.tmp diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000..0ea59b7 --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,8 @@ +path: ./ +jobs: 10 +cache: cache/phplint +extensions: + - php +exclude: + - vendor +warning: false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a46a5c5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog +All notable changes to this package will be documented in this file + +## Unreleased + +## 1.0.0 - 202X-XX-XX +- Initial release [major] \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cc4c643 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contributing + +Contributions are **welcome** and will be fully **credited**. + +Please read and understand the contribution guide before creating an issue or pull request. + +## Etiquette + +This project is open source, and as such, the maintainers give their free time to build and maintain the source code +held within. They make the code freely available in the hope that it will be of use to other developers. It would be +extremely unfair for them to suffer abuse or anger for their hard work. + +Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the +world that developers are civilized and selfless people. + +It's the duty of the maintainer to ensure that all submissions to the project are of sufficient +quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. + +## Viability + +When requesting or submitting new features, first consider whether it might be useful to others. Open +source projects are used by many developers, who may have entirely different needs to your own. Think about +whether or not your feature is likely to be used by other users of the project. + +## Procedure + +Before filing an issue: + +- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. +- Check to make sure your feature suggestion isn't already present within the project. +- Check the pull requests tab to ensure that the bug doesn't have a fix in progress. +- Check the pull requests tab to ensure that the feature isn't already in progress. + +Before submitting a pull request: + +- Check the codebase to ensure that your feature doesn't already exist. +- Check the pull requests to ensure that another person hasn't already submitted the feature or fix. + +## Requirements + +- **Follow the [Crawl Coding Standard](https://git.gertjankrol.nl/crawl/coding-standard)** - Basically run `composer style` before committing/pushing. + +- **Add tests!** + +- **Document any change in behaviour** - Make sure the `CHANGELOG.md`, `README.md` and any other relevant documentation are kept up-to-date. + +- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option. + +- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. + +- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. + +**Happy coding**! diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..40ded4e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f4a06c3 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# Vertumnus Laravel package skeleton + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/vertumnus/skeleton.svg?style=flat-square)](https://packagist.org/packages/vertumnus/skeleton) +[![Total Downloads](https://img.shields.io/packagist/dt/vertumnus/skeleton.svg?style=flat-square)](https://packagist.org/packages/vertumnus/skeleton) + +This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors. + +## Installation + +You can install the package via composer: + +```bash +composer require vertumnus/skeleton +``` + +## Usage + +```php +// Usage description here +``` + +### 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`** + +### Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Contributing + +Please see [CONTRIBUTING](CONTRIBUTING.md) for details. + +### Security + +If you discover any security related issues, please email security@gkcld.net instead of using the issue tracker. + +## Authors +- [Gertjan Krol](https://git.gertjankrol.nl/gertjan) + +## License + +The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f8feac8 --- /dev/null +++ b/composer.json @@ -0,0 +1,79 @@ +{ + "name": "vertumnus/skeleton", + "description": "Vertumnus Laravel package skeleton", + "license": "MIT", + "type": "library", + "keywords": [ + "vertumnus", + "laravel", + "skeleton" + ], + "authors": [ + { + "name": "Gertjan Krol", + "email": "contact@gertjankrol.nl" + } + ], + "homepage": "https://git.gertjankrol.nl/vertumnus/skeleton", + "require": { + "php": "^8.2", + "laravel/framework": "^10.21" + }, + "require-dev": { + "crawl/coding-standard": "^1.1", + "enlightn/security-checker": "^1.10", + "ergebnis/composer-normalize": "^2.35", + "icanhazstring/composer-unused": "^0.8", + "maglnet/composer-require-checker": "^4.6", + "mockery/mockery": "^1.6", + "orchestra/testbench": "^8.10", + "overtrue/phplint": "^9.0", + "phpunit/phpunit": "^10.3" + }, + "autoload": { + "psr-4": { + "Vertumnus\\Skeleton\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Vertumnus\\Skeleton\\Tests\\": "tests" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true + }, + "optimize-autoloader": true, + "sort-packages": true + }, + "extra": { + "laravel": { + "aliases": { + "Skeleton": "Vertumnus\\Skeleton\\SkeletonFacade" + }, + "providers": [ + "Vertumnus\\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" + } +} diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..cadb71c --- /dev/null +++ b/config/config.php @@ -0,0 +1,10 @@ + + + Crawl Coding Standard for Packages + + + + + + + + + + + + + config + database + resources + src + tests + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..f26461a --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,17 @@ + + + + + + ./tests/ + + + + + + + + ./src + + + diff --git a/public/app.css b/public/app.css new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/public/app.css @@ -0,0 +1 @@ + diff --git a/public/app.js b/public/app.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/public/app.js @@ -0,0 +1 @@ + diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..37da698 --- /dev/null +++ b/public/manifest.json @@ -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" + } +} \ No newline at end of file diff --git a/resources/js/app.js b/resources/js/app.js new file mode 100644 index 0000000..33f2668 --- /dev/null +++ b/resources/js/app.js @@ -0,0 +1 @@ +/** Package JS goes here */ diff --git a/resources/lang/.gitkeep b/resources/lang/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/sass/app.scss b/resources/sass/app.scss new file mode 100644 index 0000000..1f86393 --- /dev/null +++ b/resources/sass/app.scss @@ -0,0 +1 @@ +/** Package CSS goes here */ diff --git a/resources/views/.gitkeep b/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/Skeleton.php b/src/Skeleton.php new file mode 100644 index 0000000..154c6e7 --- /dev/null +++ b/src/Skeleton.php @@ -0,0 +1,13 @@ +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->packageRoot() . '/config/config.php' => config_path(Skeleton::PACKAGE_NAME . '.php'), + ], Skeleton::PACKAGE_NAME . '-config'); + + // Publish assets + //$this->publishes([ + // $this->packageRoot() . '/public' => public_path('vendor/' . Skeleton::PACKAGE_NAME), + //], Skeleton::PACKAGE_NAME . '-assets'); + + // Publish translation files + //$this->publishes([ + // $this->packageRoot() . '/resources/lang' => resource_path('lang/vendor/' . Skeleton::PACKAGE_NAME), + //], Skeleton::PACKAGE_NAME . '-lang'); + + // Publish views + //$this->publishes([ + // $this->packageRoot() . '/resources/views' => resource_path('views/vendor/' . Skeleton::PACKAGE_NAME), + //], Skeleton::PACKAGE_NAME . '-views'); + + // Registering package commands + $this->commands(self::COMMANDS); + } + } + + /** + * Register the application services. + */ + public function register(): void + { + // Automatically apply the package configuration + $this->mergeConfigFrom($this->packageRoot() . '/config/config.php', Skeleton::PACKAGE_NAME); + + // Register the main class to use with the facade + $this->app->singleton(Skeleton::PACKAGE_NAME, static function () { + return new Skeleton(); + }); + } + + private function packageRoot(): string + { + return dirname(__DIR__ . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR; + } + + private function resourcesPath(): string + { + return $this->packageRoot() . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR; + } +} diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..36a56f0 --- /dev/null +++ b/vite.config.js @@ -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, + }), + ], +});