Initial commit
This commit is contained in:
commit
2b156878ad
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
28
.gitattributes
vendored
Normal file
28
.gitattributes
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# Path-based git attributes
|
||||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
|
||||
|
||||
# Ignore all test and documentation with "export-ignore".
|
||||
/.github export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.idea export-ignore
|
||||
/.prettierrc export-ignore
|
||||
/.package-lock.json export-ignore
|
||||
/.editorconfig export-ignore
|
||||
/.php_cs.dist.php export-ignore
|
||||
/.vscode export-ignore
|
||||
/art export-ignore
|
||||
/docs export-ignore
|
||||
/images export-ignore
|
||||
/tests export-ignore
|
||||
/package.json export-ignore
|
||||
/phpstan-baseline.neon export-ignore
|
||||
/phpstan.neon.dist export-ignore
|
||||
/postcss.config.js export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/pint.json export-ignore
|
||||
/psalm.xml export-ignore
|
||||
/psalm.xml.dist export-ignore
|
||||
/tailwind.config.js export-ignore
|
||||
/testbench.yaml export-ignore
|
||||
/UPGRADING.md export-ignore
|
||||
55
.github/CONTRIBUTING.md
vendored
Normal file
55
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
# 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 skills, 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
|
||||
|
||||
If the project maintainer has any additional requirements, you will find them listed here.
|
||||
|
||||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
|
||||
|
||||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
|
||||
|
||||
- **Document any change in behaviour** - Make sure the `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**!
|
||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
github: :vendor_name
|
||||
66
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
66
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: Bug Report
|
||||
description: Report an Issue or Bug with the Package
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What happened?
|
||||
description: What did you expect to happen?
|
||||
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: how-to-reproduce
|
||||
attributes:
|
||||
label: How to reproduce the bug
|
||||
description: How did this occur, please add any config values used and provide a set of reliable steps if possible.
|
||||
placeholder: When I do X I see Y.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: package-version
|
||||
attributes:
|
||||
label: Package Version
|
||||
description: What version of our Package are you running? Please be as specific as possible
|
||||
placeholder: 2.0.0
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: php-version
|
||||
attributes:
|
||||
label: PHP Version
|
||||
description: What version of PHP are you running? Please be as specific as possible
|
||||
placeholder: 8.2.0
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: laravel-version
|
||||
attributes:
|
||||
label: Laravel Version
|
||||
description: What version of Laravel are you running? Please be as specific as possible
|
||||
placeholder: 9.0.0
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: operating-systems
|
||||
attributes:
|
||||
label: Which operating systems does with happen with?
|
||||
description: You may select more than one.
|
||||
multiple: true
|
||||
options:
|
||||
- macOS
|
||||
- Windows
|
||||
- Linux
|
||||
- type: textarea
|
||||
id: notes
|
||||
attributes:
|
||||
label: Notes
|
||||
description: Use this field to provide any other notes that you feel might be relevant to the issue.
|
||||
validations:
|
||||
required: false
|
||||
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Ask a question
|
||||
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
|
||||
about: Ask the community for help
|
||||
- name: Request a feature
|
||||
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
|
||||
about: Share ideas for new features
|
||||
- name: Report a security issue
|
||||
url: https://github.com/:vendor_name/:package_name/security/policy
|
||||
about: Learn how to notify us for sensitive bugs
|
||||
3
.github/SECURITY.md
vendored
Normal file
3
.github/SECURITY.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Security Policy
|
||||
|
||||
If you discover any security related issues, please email author@domain.com instead of using the issue tracker.
|
||||
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
labels:
|
||||
- "dependencies"
|
||||
33
.github/workflows/dependabot-auto-merge.yml
vendored
Normal file
33
.github/workflows/dependabot-auto-merge.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
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@v2.4.0
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: Auto-merge Dependabot PRs for semver-minor 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}}
|
||||
27
.github/workflows/fix-php-code-style-issues.yml
vendored
Normal file
27
.github/workflows/fix-php-code-style-issues.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: "Fix PHP Code Styling"
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.php'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
php-code-styling:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Fix PHP code style issues
|
||||
uses: aglipanci/laravel-pint-action@2.6
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v6
|
||||
with:
|
||||
commit_message: Fix styling
|
||||
26
.github/workflows/phpstan.yml
vendored
Normal file
26
.github/workflows/phpstan.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: PHPStan
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.php'
|
||||
- 'phpstan.neon.dist'
|
||||
|
||||
jobs:
|
||||
phpstan:
|
||||
name: phpstan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
coverage: none
|
||||
|
||||
- name: Install composer dependencies
|
||||
uses: ramsey/composer-install@v3
|
||||
|
||||
- name: Run PHPStan
|
||||
run: ./vendor/bin/phpstan --error-format=github
|
||||
51
.github/workflows/run-tests.yml
vendored
Normal file
51
.github/workflows/run-tests.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: run-tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
php: [8.2, 8.1]
|
||||
laravel: [10.*]
|
||||
stability: [prefer-lowest, prefer-stable]
|
||||
include:
|
||||
- laravel: 10.*
|
||||
testbench: 8.*
|
||||
carbon: 2.*
|
||||
|
||||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
|
||||
coverage: none
|
||||
|
||||
- name: Setup problem matchers
|
||||
run: |
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
|
||||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
|
||||
|
||||
- name: List Installed Dependencies
|
||||
run: composer show -D
|
||||
|
||||
- name: Execute tests
|
||||
run: vendor/bin/pest --ci
|
||||
31
.github/workflows/update-changelog.yml
vendored
Normal file
31
.github/workflows/update-changelog.yml
vendored
Normal file
@ -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@v6
|
||||
with:
|
||||
branch: main
|
||||
commit_message: Update CHANGELOG
|
||||
file_pattern: CHANGELOG.md
|
||||
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
.idea
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
.vscode
|
||||
build
|
||||
composer.lock
|
||||
coverage
|
||||
docs
|
||||
node_modules
|
||||
phpunit.xml
|
||||
phpstan.neon
|
||||
testbench.yaml
|
||||
vendor
|
||||
5
.prettierrc
Normal file
5
.prettierrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to `:package_name` will be documented in this file.
|
||||
|
||||
## 1.0.0 - 202X-XX-XX
|
||||
|
||||
- initial release
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) :vendor_name <author@domain.com>
|
||||
|
||||
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.
|
||||
86
README.md
Normal file
86
README.md
Normal file
@ -0,0 +1,86 @@
|
||||
# :package_description
|
||||
|
||||
[](https://packagist.org/packages/:vendor_slug/:package_slug)
|
||||
[](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
|
||||
[](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
|
||||
[](https://packagist.org/packages/:vendor_slug/:package_slug)
|
||||
|
||||
<!--delete-->
|
||||
---
|
||||
This repo can be used to scaffold a Filament plugin. Follow these steps to get started:
|
||||
|
||||
1. Press the "Use this template" button at the top of this repo to create a new repo with the contents of this skeleton.
|
||||
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files.
|
||||
3. Make something great!
|
||||
---
|
||||
<!--/delete-->
|
||||
|
||||
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install the package via composer:
|
||||
|
||||
```bash
|
||||
composer require :vendor_slug/:package_slug
|
||||
```
|
||||
|
||||
You can publish and run the migrations with:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=":package_slug-migrations"
|
||||
php artisan migrate
|
||||
```
|
||||
|
||||
You can publish the config file with:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=":package_slug-config"
|
||||
```
|
||||
|
||||
Optionally, you can publish the views using
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --tag=":package_slug-views"
|
||||
```
|
||||
|
||||
This is the contents of the published config file:
|
||||
|
||||
```php
|
||||
return [
|
||||
];
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
$variable = new VendorName\Skeleton();
|
||||
echo $variable->echoPhrase('Hello, VendorName!');
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
composer test
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
|
||||
|
||||
## Credits
|
||||
|
||||
- [:author_name](https://github.com/:author_username)
|
||||
- [All Contributors](../../contributors)
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||
50
bin/build.js
Normal file
50
bin/build.js
Normal file
@ -0,0 +1,50 @@
|
||||
import esbuild from 'esbuild'
|
||||
|
||||
const isDev = process.argv.includes('--dev')
|
||||
|
||||
async function compile(options) {
|
||||
const context = await esbuild.context(options)
|
||||
|
||||
if (isDev) {
|
||||
await context.watch()
|
||||
} else {
|
||||
await context.rebuild()
|
||||
await context.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
const defaultOptions = {
|
||||
define: {
|
||||
'process.env.NODE_ENV': isDev ? `'development'` : `'production'`,
|
||||
},
|
||||
bundle: true,
|
||||
mainFields: ['module', 'main'],
|
||||
platform: 'neutral',
|
||||
sourcemap: isDev ? 'inline' : false,
|
||||
sourcesContent: isDev,
|
||||
treeShaking: true,
|
||||
target: ['es2020'],
|
||||
minify: !isDev,
|
||||
plugins: [{
|
||||
name: 'watchPlugin',
|
||||
setup: function (build) {
|
||||
build.onStart(() => {
|
||||
console.log(`Build started at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
|
||||
})
|
||||
|
||||
build.onEnd((result) => {
|
||||
if (result.errors.length > 0) {
|
||||
console.log(`Build failed at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`, result.errors)
|
||||
} else {
|
||||
console.log(`Build finished at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
|
||||
}
|
||||
})
|
||||
}
|
||||
}],
|
||||
}
|
||||
|
||||
compile({
|
||||
...defaultOptions,
|
||||
entryPoints: ['./resources/js/index.js'],
|
||||
outfile: './resources/dist/skeleton.js',
|
||||
})
|
||||
79
composer.json
Normal file
79
composer.json
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": ":vendor_slug/:package_slug",
|
||||
"description": ":package_description",
|
||||
"keywords": [
|
||||
":vendor_name",
|
||||
"laravel",
|
||||
":package_slug"
|
||||
],
|
||||
"homepage": "https://github.com/:vendor_slug/:package_slug",
|
||||
"support": {
|
||||
"issues": "https://github.com/:vendor_slug/:package_slug/issues",
|
||||
"source": "https://github.com/:vendor_slug/:package_slug"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": ":author_name",
|
||||
"email": "author@domain.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"filament/filament": "^3.0",
|
||||
"filament/forms": "^3.0",
|
||||
"filament/tables": "^3.0",
|
||||
"spatie/laravel-package-tools": "^1.15.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "^1.0",
|
||||
"nunomaduro/collision": "^7.9",
|
||||
"nunomaduro/larastan": "^2.0.1",
|
||||
"orchestra/testbench": "^8.0",
|
||||
"pestphp/pest": "^2.1",
|
||||
"pestphp/pest-plugin-arch": "^2.0",
|
||||
"pestphp/pest-plugin-laravel": "^2.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.0",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"spatie/laravel-ray": "^1.26"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"VendorName\\Skeleton\\": "src/",
|
||||
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"VendorName\\Skeleton\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
|
||||
"analyse": "vendor/bin/phpstan analyse",
|
||||
"test": "vendor/bin/pest",
|
||||
"test-coverage": "vendor/bin/pest --coverage",
|
||||
"format": "vendor/bin/pint"
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"VendorName\\Skeleton\\SkeletonServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
6
config/skeleton.php
Normal file
6
config/skeleton.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
// config for VendorName/Skeleton
|
||||
return [
|
||||
|
||||
];
|
||||
370
configure.php
Normal file
370
configure.php
Normal file
@ -0,0 +1,370 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$gitName = run('git config user.name');
|
||||
$authorName = ask('Author name', $gitName);
|
||||
|
||||
$gitEmail = run('git config user.email');
|
||||
$authorEmail = ask('Author email', $gitEmail);
|
||||
|
||||
$usernameGuess = explode(':', run('git config remote.origin.url'))[1] ?? '';
|
||||
if ($usernameGuess !== '') {
|
||||
$usernameGuess = dirname($usernameGuess);
|
||||
$usernameGuess = basename($usernameGuess);
|
||||
}
|
||||
$authorUsername = ask('Author username', $usernameGuess);
|
||||
|
||||
$vendorName = ask('Vendor name', $authorUsername);
|
||||
$vendorSlug = slugify($vendorName);
|
||||
$vendorNamespace = str_replace('-', '', ucwords($vendorName));
|
||||
$vendorNamespace = ask('Vendor namespace', $vendorNamespace);
|
||||
|
||||
$currentDirectory = getcwd();
|
||||
$folderName = basename($currentDirectory);
|
||||
|
||||
$packageName = ask('Package name', $folderName);
|
||||
$packageSlug = slugify($packageName);
|
||||
$packageSlugWithoutPrefix = removePrefix('filament-', $packageSlug);
|
||||
|
||||
$className = titleCase($packageName);
|
||||
$className = ask('Class name', $className);
|
||||
$variableName = lcfirst($className);
|
||||
$description = ask('Package description', "This is my package $packageSlug");
|
||||
|
||||
$usePhpStan = confirm('Enable PhpStan?', true);
|
||||
$usePint = confirm('Enable Pint?', true);
|
||||
$useDependabot = confirm('Enable Dependabot?', true);
|
||||
$useLaravelRay = confirm('Enable Ray?', true);
|
||||
$useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true);
|
||||
|
||||
$isTheme = confirm('Is this a custom theme?');
|
||||
$formsOnly = ! $isTheme && confirm('Is this for Forms only?');
|
||||
$tablesOnly = ! ($isTheme || $formsOnly) && confirm('Is this for Tables only?');
|
||||
|
||||
writeln("\r");
|
||||
writeln('------');
|
||||
writeln("Author : \e[0;36m$authorName ($authorUsername, $authorEmail)\e[0m");
|
||||
writeln("Vendor : \e[0;36m$vendorName ($vendorSlug)\e[0m");
|
||||
writeln('Package : ' . "\e[0;36m" . $packageSlug . ($description ? " <{$description}>" : '') . "\e[0m");
|
||||
writeln("Namespace : \e[0;36m$vendorNamespace\\$className\e[0m");
|
||||
writeln("Class name : \e[0;36m$className\e[0m");
|
||||
writeln('---');
|
||||
writeln("\e[1;37mPackages & Utilities\e[0m");
|
||||
writeln('Larastan/PhpStan : ' . ($usePhpStan ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
|
||||
writeln('Pint : ' . ($usePint ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
|
||||
writeln('Use Dependabot : ' . ($useDependabot ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
|
||||
writeln('Use Ray : ' . ($useLaravelRay ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
|
||||
writeln('Auto-Changelog : ' . ($useUpdateChangelogWorkflow ? "\e[0;32mYes" : "\e[0;31mNo") . "\e[0m");
|
||||
if ($formsOnly) {
|
||||
writeln("Filament/Forms : \e[0;32mYes\e[0m");
|
||||
} elseif ($tablesOnly) {
|
||||
writeln("Filament/Tables : \e[0;32mYes\e[0m");
|
||||
} else {
|
||||
writeln("Filament/Filament : \e[0;32mYes\e[0m");
|
||||
}
|
||||
writeln('------');
|
||||
writeln("\r");
|
||||
writeln('This script will replace the above values in all relevant files in the project directory.');
|
||||
writeln("\r");
|
||||
|
||||
if (! confirm('Modify files?', true)) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ($formsOnly) {
|
||||
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
|
||||
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
|
||||
|
||||
removeComposerDeps([
|
||||
'filament/filament',
|
||||
'filament/tables',
|
||||
], 'require');
|
||||
} elseif ($tablesOnly) {
|
||||
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
|
||||
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
|
||||
|
||||
removeComposerDeps([
|
||||
'filament/filament',
|
||||
'filament/forms',
|
||||
], 'require');
|
||||
} else {
|
||||
if ($isTheme) {
|
||||
safeUnlink(__DIR__ . '/src/SkeletonServiceProvider.php');
|
||||
safeUnlink(__DIR__ . '/src/SkeletonPlugin.php');
|
||||
safeUnlink(__DIR__ . '/src/Skeleton.php');
|
||||
removeDirectory(__DIR__ . '/bin');
|
||||
removeDirectory(__DIR__ . '/config');
|
||||
removeDirectory(__DIR__ . '/database');
|
||||
removeDirectory(__DIR__ . '/stubs');
|
||||
removeDirectory(__DIR__ . '/resources/js');
|
||||
removeDirectory(__DIR__ . '/resources/lang');
|
||||
removeDirectory(__DIR__ . '/resources/views');
|
||||
removeDirectory(__DIR__ . '/src/Commands');
|
||||
removeDirectory(__DIR__ . '/src/Facades');
|
||||
removeDirectory(__DIR__ . '/src/Testing');
|
||||
|
||||
setupPackageJsonForTheme();
|
||||
|
||||
} else {
|
||||
safeUnlink(__DIR__ . '/src/SkeletonTheme.php');
|
||||
}
|
||||
|
||||
removeComposerDeps([
|
||||
'filament/forms',
|
||||
'filament/tables',
|
||||
], 'require');
|
||||
}
|
||||
|
||||
$files = (str_starts_with(strtoupper(PHP_OS), 'WIN') ? replaceForWindows() : replaceForAllOtherOSes());
|
||||
|
||||
foreach ($files as $file) {
|
||||
replaceInFile($file, [
|
||||
':author_name' => $authorName,
|
||||
':author_username' => $authorUsername,
|
||||
'author@domain.com' => $authorEmail,
|
||||
':vendor_name' => $vendorName,
|
||||
':vendor_slug' => $vendorSlug,
|
||||
'VendorName' => $vendorNamespace,
|
||||
':package_name' => $packageName,
|
||||
':package_slug' => $packageSlug,
|
||||
':package_slug_without_prefix' => $packageSlugWithoutPrefix,
|
||||
'Skeleton' => $className,
|
||||
'skeleton' => $packageSlug,
|
||||
'migration_table_name' => titleSnake($packageSlug),
|
||||
'variable' => $variableName,
|
||||
':package_description' => $description,
|
||||
]);
|
||||
|
||||
match (true) {
|
||||
str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/' . $className . '.php')),
|
||||
str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/' . $className . 'ServiceProvider.php')),
|
||||
str_contains($file, determineSeparator('src/SkeletonTheme.php')) => rename($file, determineSeparator('./src/' . $className . (str_ends_with($className, 'Theme') ? '.php' : 'Theme.php'))),
|
||||
str_contains($file, determineSeparator('src/SkeletonPlugin.php')) => rename($file, determineSeparator('./src/' . $className . 'Plugin.php')),
|
||||
str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/' . $className . '.php')),
|
||||
str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/' . $className . 'Command.php')),
|
||||
str_contains($file, determineSeparator('src/Testing/TestsSkeleton.php')) => rename($file, determineSeparator('./src/Testing/Tests' . $className . '.php')),
|
||||
str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_' . titleSnake($packageSlugWithoutPrefix) . '_table.php.stub')),
|
||||
str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/' . $packageSlugWithoutPrefix . '.php')),
|
||||
str_contains($file, determineSeparator('resources/lang/en/skeleton.php')) => rename($file, determineSeparator('./resources/lang/en/' . $packageSlugWithoutPrefix . '.php')),
|
||||
str_contains($file, 'README.md') => removeTag($file, 'delete'),
|
||||
default => [],
|
||||
};
|
||||
}
|
||||
|
||||
if (! $useDependabot) {
|
||||
safeUnlink(__DIR__ . '/.github/dependabot.yml');
|
||||
safeUnlink(__DIR__ . '/.github/workflows/dependabot-auto-merge.yml');
|
||||
}
|
||||
|
||||
if (! $useLaravelRay) {
|
||||
removeComposerDeps(['spatie/laravel-ray'], 'require-dev');
|
||||
}
|
||||
|
||||
if (! $usePhpStan) {
|
||||
safeUnlink(__DIR__ . '/phpstan.neon.dist');
|
||||
safeUnlink(__DIR__ . '/phpstan-baseline.neon');
|
||||
safeUnlink(__DIR__ . '/.github/workflows/phpstan.yml');
|
||||
|
||||
removeComposerDeps([
|
||||
'phpstan/extension-installer',
|
||||
'phpstan/phpstan-deprecation-rules',
|
||||
'phpstan/phpstan-phpunit',
|
||||
'nunomaduro/larastan',
|
||||
], 'require-dev');
|
||||
|
||||
removeComposerDeps(['analyse'], 'scripts');
|
||||
}
|
||||
|
||||
if (! $usePint) {
|
||||
safeUnlink(__DIR__ . '/.github/workflows/fix-php-code-style-issues.yml');
|
||||
safeUnlink(__DIR__ . '/pint.json');
|
||||
|
||||
removeComposerDeps([
|
||||
'laravel/pint',
|
||||
], 'require-dev');
|
||||
|
||||
removeComposerDeps(['format'], 'scripts');
|
||||
}
|
||||
|
||||
if (! $useUpdateChangelogWorkflow) {
|
||||
safeUnlink(__DIR__ . '/.github/workflows/update-changelog.yml');
|
||||
}
|
||||
|
||||
confirm('Execute `composer install`?') && run('composer install');
|
||||
|
||||
if (confirm('Let this script delete itself?', true)) {
|
||||
unlink(__FILE__);
|
||||
}
|
||||
|
||||
function ask(string $question, string $default = ''): string
|
||||
{
|
||||
$def = $default ? "\e[0;33m ($default)" : '';
|
||||
$answer = readline("\e[0;32m" . $question . $def . ": \e[0m");
|
||||
|
||||
if (! $answer) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return $answer;
|
||||
}
|
||||
|
||||
function confirm(string $question, bool $default = false): bool
|
||||
{
|
||||
$answer = ask($question, ($default ? 'Y/n' : 'y/N'));
|
||||
|
||||
if (strtolower($answer) === 'y/n') {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return strtolower($answer) === 'y';
|
||||
}
|
||||
|
||||
function writeln(string $line): void
|
||||
{
|
||||
echo $line . PHP_EOL;
|
||||
}
|
||||
|
||||
function run(string $command): string
|
||||
{
|
||||
return trim((string) shell_exec($command));
|
||||
}
|
||||
|
||||
function slugify(string $subject): string
|
||||
{
|
||||
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $subject), '-'));
|
||||
}
|
||||
|
||||
function titleCase(string $subject): string
|
||||
{
|
||||
return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $subject)));
|
||||
}
|
||||
|
||||
function titleSnake(string $subject, string $replace = '_'): string
|
||||
{
|
||||
return str_replace(['-', '_'], $replace, $subject);
|
||||
}
|
||||
|
||||
function replaceInFile(string $file, array $replacements): void
|
||||
{
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
file_put_contents(
|
||||
$file,
|
||||
str_replace(
|
||||
array_keys($replacements),
|
||||
array_values($replacements),
|
||||
$contents
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function removePrefix(string $prefix, string $content): string
|
||||
{
|
||||
if (str_starts_with($content, $prefix)) {
|
||||
return substr($content, strlen($prefix));
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function removeComposerDeps(array $names, string $location): void
|
||||
{
|
||||
$data = json_decode(file_get_contents(__DIR__ . '/composer.json'), true);
|
||||
|
||||
foreach ($data[$location] as $name => $version) {
|
||||
if (in_array($name, $names, true)) {
|
||||
unset($data[$location][$name]);
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents(__DIR__ . '/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
function removeNpmDeps(array $names, string $location): void
|
||||
{
|
||||
$data = json_decode(file_get_contents(__DIR__ . '/package.json'), true);
|
||||
|
||||
foreach ($data[$location] as $name => $version) {
|
||||
if (in_array($name, $names, true)) {
|
||||
unset($data[$location][$name]);
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents(__DIR__ . '/package.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES |
|
||||
JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
function removeTag(string $file, string $tag): void
|
||||
{
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
file_put_contents(
|
||||
$file,
|
||||
preg_replace('/<!--' . $tag . '-->.*<!--\/' . $tag . '-->/s', '', $contents) ?: $contents
|
||||
);
|
||||
}
|
||||
|
||||
function setupPackageJsonForTheme(): void
|
||||
{
|
||||
removeNpmDeps([
|
||||
'purge',
|
||||
'dev',
|
||||
'dev:scripts',
|
||||
'build',
|
||||
'build:scripts',
|
||||
], 'scripts');
|
||||
|
||||
removeNpmDeps([
|
||||
'@awcodes/filament-plugin-purge',
|
||||
'esbuild',
|
||||
'npm-run-all',
|
||||
'prettier',
|
||||
'prettier-plugin-tailwindcss',
|
||||
], 'devDependencies');
|
||||
|
||||
replaceInFile(__DIR__ . '/package.json', [
|
||||
'dev:styles' => 'dev',
|
||||
'build:styles' => 'build',
|
||||
]);
|
||||
}
|
||||
|
||||
function safeUnlink(string $filename): void
|
||||
{
|
||||
if (file_exists($filename) && is_file($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
function determineSeparator(string $path): string
|
||||
{
|
||||
return str_replace('/', DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
|
||||
function replaceForWindows(): array
|
||||
{
|
||||
return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i \\vendor\\ | findstr /v /i ' . basename(__FILE__) . ' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton migration_table_name vendor_name vendor_slug author@domain.com"'));
|
||||
}
|
||||
|
||||
function replaceForAllOtherOSes(): array
|
||||
{
|
||||
return explode(PHP_EOL, run('find ./* ./.github/* -name "vendor" -type d -prune \
|
||||
-o -name "configure.php" -prune \
|
||||
-o -type f -print0 | xargs -0 grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|migration_table_name|vendor_name|vendor_slug|author@domain.com"'));
|
||||
}
|
||||
|
||||
function removeDirectory($dir): void
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != '.' && $object != '..') {
|
||||
if (filetype($dir . '/' . $object) == 'dir') {
|
||||
removeDirectory($dir . '/' . $object);
|
||||
} else {
|
||||
unlink($dir . '/' . $object);
|
||||
}
|
||||
}
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
19
database/factories/ModelFactory.php
Normal file
19
database/factories/ModelFactory.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/*
|
||||
class ModelFactory extends Factory
|
||||
{
|
||||
protected $model = YourModel::class;
|
||||
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
*/
|
||||
19
database/migrations/create_skeleton_table.php.stub
Normal file
19
database/migrations/create_skeleton_table.php.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('migration_table_name_table', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// add fields
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
};
|
||||
26
package.json
Normal file
26
package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/skeleton.css --postcss --watch",
|
||||
"dev:scripts": "node bin/build.js --dev",
|
||||
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/skeleton.css --postcss --minify && npm run purge",
|
||||
"build:scripts": "node bin/build.js",
|
||||
"purge": "filament-purge -i resources/dist/skeleton.css -o resources/dist/skeleton.css -v 3.x",
|
||||
"dev": "npm-run-all --parallel dev:*",
|
||||
"build": "npm-run-all build:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@awcodes/filament-plugin-purge": "^1.1.1",
|
||||
"@tailwindcss/forms": "^0.5.4",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"esbuild": "^0.19.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.26",
|
||||
"postcss-import": "^15.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-plugin-tailwindcss": "^0.1.13",
|
||||
"tailwindcss": "^3.3.3"
|
||||
}
|
||||
}
|
||||
0
phpstan-baseline.neon
Normal file
0
phpstan-baseline.neon
Normal file
14
phpstan.neon.dist
Normal file
14
phpstan.neon.dist
Normal file
@ -0,0 +1,14 @@
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
||||
parameters:
|
||||
level: 4
|
||||
paths:
|
||||
- src
|
||||
- config
|
||||
- database
|
||||
tmpDir: build/phpstan
|
||||
checkOctaneCompatibility: true
|
||||
checkModelProperties: true
|
||||
checkMissingIterableValueType: false
|
||||
|
||||
38
phpunit.xml.dist
Normal file
38
phpunit.xml.dist
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
executionOrder="random"
|
||||
failOnWarning="true"
|
||||
failOnRisky="true"
|
||||
failOnEmptyTestSuite="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
backupStaticProperties="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="VendorName Test Suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage>
|
||||
<report>
|
||||
<html outputDirectory="build/coverage"/>
|
||||
<text outputFile="build/coverage.txt"/>
|
||||
<clover outputFile="build/logs/clover.xml"/>
|
||||
</report>
|
||||
</coverage>
|
||||
<logging>
|
||||
<junit outputFile="build/report.junit.xml"/>
|
||||
</logging>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
||||
14
pint.json
Normal file
14
pint.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"preset": "laravel",
|
||||
"rules": {
|
||||
"blank_line_before_statement": true,
|
||||
"concat_space": {
|
||||
"spacing": "one"
|
||||
},
|
||||
"method_argument_space": true,
|
||||
"single_trait_insert_per_statement": true,
|
||||
"types_spaces": {
|
||||
"space": "single"
|
||||
}
|
||||
}
|
||||
}
|
||||
8
postcss.config.cjs
Normal file
8
postcss.config.cjs
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
"postcss-import": {},
|
||||
"tailwindcss/nesting": {},
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
1
resources/css/index.css
Normal file
1
resources/css/index.css
Normal file
@ -0,0 +1 @@
|
||||
@import '../../vendor/filament/filament/resources/css/theme.css';
|
||||
0
resources/dist/.gitkeep
vendored
Normal file
0
resources/dist/.gitkeep
vendored
Normal file
0
resources/js/index.js
Normal file
0
resources/js/index.js
Normal file
6
resources/lang/en/skeleton.php
Normal file
6
resources/lang/en/skeleton.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
// translations for VendorName/Skeleton
|
||||
return [
|
||||
//
|
||||
];
|
||||
0
resources/views/.gitkeep
Normal file
0
resources/views/.gitkeep
Normal file
19
src/Commands/SkeletonCommand.php
Normal file
19
src/Commands/SkeletonCommand.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SkeletonCommand extends Command
|
||||
{
|
||||
public $signature = 'skeleton';
|
||||
|
||||
public $description = 'My command';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->comment('All done');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
16
src/Facades/Skeleton.php
Normal file
16
src/Facades/Skeleton.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @see \VendorName\Skeleton\Skeleton
|
||||
*/
|
||||
class Skeleton extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return \VendorName\Skeleton\Skeleton::class;
|
||||
}
|
||||
}
|
||||
5
src/Skeleton.php
Normal file
5
src/Skeleton.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
class Skeleton {}
|
||||
37
src/SkeletonPlugin.php
Normal file
37
src/SkeletonPlugin.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
|
||||
class SkeletonPlugin implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'skeleton';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public static function make(): static
|
||||
{
|
||||
return app(static::class);
|
||||
}
|
||||
|
||||
public static function get(): static
|
||||
{
|
||||
/** @var static $plugin */
|
||||
$plugin = filament(app(static::class)->getId());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
}
|
||||
152
src/SkeletonServiceProvider.php
Normal file
152
src/SkeletonServiceProvider.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Support\Assets\AlpineComponent;
|
||||
use Filament\Support\Assets\Asset;
|
||||
use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Filament\Support\Facades\FilamentIcon;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Livewire\Features\SupportTesting\Testable;
|
||||
use Spatie\LaravelPackageTools\Commands\InstallCommand;
|
||||
use Spatie\LaravelPackageTools\Package;
|
||||
use Spatie\LaravelPackageTools\PackageServiceProvider;
|
||||
use VendorName\Skeleton\Commands\SkeletonCommand;
|
||||
use VendorName\Skeleton\Testing\TestsSkeleton;
|
||||
|
||||
class SkeletonServiceProvider extends PackageServiceProvider
|
||||
{
|
||||
public static string $name = 'skeleton';
|
||||
|
||||
public static string $viewNamespace = 'skeleton';
|
||||
|
||||
public function configurePackage(Package $package): void
|
||||
{
|
||||
/*
|
||||
* This class is a Package Service Provider
|
||||
*
|
||||
* More info: https://github.com/spatie/laravel-package-tools
|
||||
*/
|
||||
$package->name(static::$name)
|
||||
->hasCommands($this->getCommands())
|
||||
->hasInstallCommand(function (InstallCommand $command) {
|
||||
$command
|
||||
->publishConfigFile()
|
||||
->publishMigrations()
|
||||
->askToRunMigrations()
|
||||
->askToStarRepoOnGitHub(':vendor_slug/:package_slug');
|
||||
});
|
||||
|
||||
$configFileName = $package->shortName();
|
||||
|
||||
if (file_exists($package->basePath("/../config/{$configFileName}.php"))) {
|
||||
$package->hasConfigFile();
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../database/migrations'))) {
|
||||
$package->hasMigrations($this->getMigrations());
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../resources/lang'))) {
|
||||
$package->hasTranslations();
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../resources/views'))) {
|
||||
$package->hasViews(static::$viewNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
public function packageRegistered(): void {}
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
// Asset Registration
|
||||
FilamentAsset::register(
|
||||
$this->getAssets(),
|
||||
$this->getAssetPackageName()
|
||||
);
|
||||
|
||||
FilamentAsset::registerScriptData(
|
||||
$this->getScriptData(),
|
||||
$this->getAssetPackageName()
|
||||
);
|
||||
|
||||
// Icon Registration
|
||||
FilamentIcon::register($this->getIcons());
|
||||
|
||||
// Handle Stubs
|
||||
if (app()->runningInConsole()) {
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
$file->getRealPath() => base_path("stubs/skeleton/{$file->getFilename()}"),
|
||||
], 'skeleton-stubs');
|
||||
}
|
||||
}
|
||||
|
||||
// Testing
|
||||
Testable::mixin(new TestsSkeleton);
|
||||
}
|
||||
|
||||
protected function getAssetPackageName(): ?string
|
||||
{
|
||||
return ':vendor_slug/:package_slug';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Asset>
|
||||
*/
|
||||
protected function getAssets(): array
|
||||
{
|
||||
return [
|
||||
// AlpineComponent::make('skeleton', __DIR__ . '/../resources/dist/components/skeleton.js'),
|
||||
Css::make('skeleton-styles', __DIR__ . '/../resources/dist/skeleton.css'),
|
||||
Js::make('skeleton-scripts', __DIR__ . '/../resources/dist/skeleton.js'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string>
|
||||
*/
|
||||
protected function getCommands(): array
|
||||
{
|
||||
return [
|
||||
SkeletonCommand::class,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getIcons(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getRoutes(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function getScriptData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getMigrations(): array
|
||||
{
|
||||
return [
|
||||
'create_skeleton_table',
|
||||
];
|
||||
}
|
||||
}
|
||||
39
src/SkeletonTheme.php
Normal file
39
src/SkeletonTheme.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
use Filament\Support\Assets\Theme;
|
||||
use Filament\Support\Color;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
|
||||
class Skeleton implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'skeleton';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
FilamentAsset::register([
|
||||
Theme::make('skeleton', __DIR__ . '/../resources/dist/skeleton.css'),
|
||||
]);
|
||||
|
||||
$panel
|
||||
->font('DM Sans')
|
||||
->primaryColor(Color::Amber)
|
||||
->secondaryColor(Color::Gray)
|
||||
->warningColor(Color::Amber)
|
||||
->dangerColor(Color::Rose)
|
||||
->successColor(Color::Green)
|
||||
->grayColor(Color::Gray)
|
||||
->theme('skeleton');
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
13
src/Testing/TestsSkeleton.php
Normal file
13
src/Testing/TestsSkeleton.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Testing;
|
||||
|
||||
use Livewire\Features\SupportTesting\Testable;
|
||||
|
||||
/**
|
||||
* @mixin Testable
|
||||
*/
|
||||
class TestsSkeleton
|
||||
{
|
||||
//
|
||||
}
|
||||
0
stubs/.gitkeep
Normal file
0
stubs/.gitkeep
Normal file
10
tailwind.config.js
Normal file
10
tailwind.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
const preset = require('./vendor/filament/filament/tailwind.config.preset')
|
||||
|
||||
module.exports = {
|
||||
presets: [preset],
|
||||
content: [
|
||||
'./app/Filament/**/*.php',
|
||||
'./resources/views/filament/**/*.blade.php',
|
||||
'./vendor/filament/**/*.blade.php',
|
||||
],
|
||||
}
|
||||
5
tests/ArchTest.php
Normal file
5
tests/ArchTest.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
it('will not use debugging functions')
|
||||
->expect(['dd', 'dump', 'ray'])
|
||||
->each->not->toBeUsed();
|
||||
5
tests/ExampleTest.php
Normal file
5
tests/ExampleTest.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
it('can test', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
5
tests/Pest.php
Normal file
5
tests/Pest.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
use VendorName\Skeleton\Tests\TestCase;
|
||||
|
||||
uses(TestCase::class)->in(__DIR__);
|
||||
60
tests/TestCase.php
Normal file
60
tests/TestCase.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Tests;
|
||||
|
||||
use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
|
||||
use BladeUI\Icons\BladeIconsServiceProvider;
|
||||
use Filament\Actions\ActionsServiceProvider;
|
||||
use Filament\FilamentServiceProvider;
|
||||
use Filament\Forms\FormsServiceProvider;
|
||||
use Filament\Infolists\InfolistsServiceProvider;
|
||||
use Filament\Notifications\NotificationsServiceProvider;
|
||||
use Filament\Support\SupportServiceProvider;
|
||||
use Filament\Tables\TablesServiceProvider;
|
||||
use Filament\Widgets\WidgetsServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Livewire\LivewireServiceProvider;
|
||||
use Orchestra\Testbench\TestCase as Orchestra;
|
||||
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider;
|
||||
use VendorName\Skeleton\SkeletonServiceProvider;
|
||||
|
||||
class TestCase extends Orchestra
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Factory::guessFactoryNamesUsing(
|
||||
fn (string $modelName) => 'VendorName\\Skeleton\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
|
||||
);
|
||||
}
|
||||
|
||||
protected function getPackageProviders($app)
|
||||
{
|
||||
return [
|
||||
ActionsServiceProvider::class,
|
||||
BladeCaptureDirectiveServiceProvider::class,
|
||||
BladeHeroiconsServiceProvider::class,
|
||||
BladeIconsServiceProvider::class,
|
||||
FilamentServiceProvider::class,
|
||||
FormsServiceProvider::class,
|
||||
InfolistsServiceProvider::class,
|
||||
LivewireServiceProvider::class,
|
||||
NotificationsServiceProvider::class,
|
||||
SupportServiceProvider::class,
|
||||
TablesServiceProvider::class,
|
||||
WidgetsServiceProvider::class,
|
||||
SkeletonServiceProvider::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function getEnvironmentSetUp($app)
|
||||
{
|
||||
config()->set('database.default', 'testing');
|
||||
|
||||
/*
|
||||
$migration = include __DIR__.'/../database/migrations/create_skeleton_table.php.stub';
|
||||
$migration->up();
|
||||
*/
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user