-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
361 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
package: | ||
- core | ||
- builder | ||
- jobs | ||
- press | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Environment | ||
.env | ||
.env.backup | ||
|
||
# Composer | ||
/vendor | ||
composer.lock | ||
auth.json | ||
|
||
# NPM / Node | ||
/node_modules | ||
npm-debug.log | ||
package-lock.json | ||
|
||
# Laravel | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
|
||
# PHPUnit | ||
.phpunit.result.cache | ||
phpunit.xml | ||
|
||
# Yarn | ||
yarn-error.log | ||
|
||
# PHPStan | ||
/build | ||
phpstan.neon | ||
|
||
# Testbench | ||
testbench.yaml | ||
|
||
# PHP CS Fixer | ||
.php-cs-fixer.cache | ||
|
||
# Homestead | ||
Homestead.json | ||
Homestead.yaml | ||
|
||
# IDEs | ||
/.idea | ||
/.vscode | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
# Windows | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Moox <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
![Moox Core](https://github.com/mooxphp/moox/raw/main/_other/art/banner/core.jpg) | ||
|
||
# Moox Core | ||
|
||
The Moox Core package cares for many common features. It is required by all Moox packages. | ||
|
||
## Quick Installation | ||
|
||
These two commmands are all you need to install the package: | ||
|
||
```bash | ||
composer require moox/core | ||
php artisan mooxcore:install | ||
``` | ||
|
||
Curious what the install command does? See manual installation below. | ||
|
||
## Manual Installation | ||
|
||
Instead of using the install-command `php artisan mooxcore:install` you are able to install this package manually step by step: | ||
|
||
```bash | ||
// Publish the config file with: | ||
php artisan vendor:publish --tag="core-config" | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Security Vulnerabilities | ||
|
||
Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. | ||
|
||
## Credits | ||
|
||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Security Policy | ||
|
||
## Supported Versions | ||
|
||
We maintain the current version of `Moox Core` actively. | ||
|
||
Do not expect security fixes for older versions. | ||
|
||
## Reporting a Vulnerability | ||
|
||
If you find any security-related bug, please report it to [email protected]. | ||
|
||
Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "moox/core", | ||
"description": "The Moox Core package cares for many common features. It is required by all Moox packages.", | ||
"keywords": [ | ||
"Laravel", | ||
"Filament", | ||
"Filament plugin", | ||
"Laravel package" | ||
], | ||
"homepage": "https://moox.org/", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Moox Developer", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1.0", | ||
"spatie/laravel-package-tools": "^1.13.0", | ||
"filament/filament": "^3.2", | ||
"invaders-xx/filament-jsoneditor": "^3.0", | ||
"leandrocfe/filament-apex-charts": "^3.1", | ||
"ryangjchandler/filament-progress-column": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Moox\\Core\\": "src" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Moox\\Core\\CoreServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
// No config atm | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'breadcrumb' => 'Core', | ||
'title' => 'Core', | ||
'navigation_label' => 'Core', | ||
'navigation_group' => 'Moox Core', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'breadcrumb' => 'Core', | ||
'title' => 'Core', | ||
'navigation_label' => 'Core', | ||
'navigation_group' => 'Moox Core', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'breadcrumb' => 'Core', | ||
'title' => 'Core', | ||
'navigation_label' => 'Core', | ||
'navigation_group' => 'Moox Core', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'breadcrumb' => 'Core', | ||
'title' => 'Core', | ||
'navigation_label' => 'Core', | ||
'navigation_group' => 'Moox Core', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
|
||
namespace Moox\Core\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\File; | ||
|
||
use function Laravel\Prompts\confirm; | ||
use function Laravel\Prompts\error; | ||
use function Laravel\Prompts\info; | ||
use function Laravel\Prompts\note; | ||
use function Laravel\Prompts\warning; | ||
|
||
class InstallCommand extends Command | ||
{ | ||
protected $signature = 'mooxcore:install'; | ||
|
||
protected $description = 'Install Moox Core and register all needed plugins.'; | ||
|
||
protected $providerPath; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->providerPath = app_path('Providers/Filament/AdminPanelProvider.php'); | ||
} | ||
|
||
public function handle(): void | ||
{ | ||
$this->art(); | ||
$this->welcome(); | ||
$this->checkForFilament(); | ||
$this->registerPlugins(); | ||
$this->sayGoodbye(); | ||
} | ||
|
||
public function art(): void | ||
{ | ||
info(' | ||
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ | ||
▓▓▒░░▒▓▓▒▒░░░░░░▒▒▓▓▓▒░░░░░░░▒▓▓ ▓▓▓▓▒░░░░░░░▒▓▓▓▓ ▓▓▓▓▓▒░░░░░░░▒▒▓▓▓▓▓▒▒▒▒▓▓ ▓▓▓▒▒▒▒▓▓ | ||
▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▒░░░░░░░░░░░░░▒▓▓▓ ▓▓▓▓▒░░░░░░░░░░░░░▒▓▓▓░░░░░▒▓▓ ▓▓▒░░░░░▓▓ | ||
▓▒░░░░░░▒▓▓▓▓▒░░░░░░░▒▓▓▓▓░░░░░▒▓▓▓░░░░░▒▓▓▓▓▒░░░░░░░▓▓▓▓░░░░░░▒▓▓▓▓▓░░░░░░▒▓▓░░░░░▒▓▓▓▓▓░░░░░▒▓▓ | ||
▓▒░░░░▓▓▓▓ ▓▓░░░░░▓▓▓ ▓▓▓░░░░▒▓▓░░░░▒▓▓▓ ▓▓▓▓░░░░░▓░░░░░░▓▓▓▓ ▓▓▓▒░░░░▓▓▓▒░░░░░▓▓▓░░░░░▓▓▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓░░░░▒▓▓ ▓▓▓░░▒░░░░░▓▓▓ ▓▓░░░░▒▓▓▓▓░░░░░░░░░░░▓▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓░░░░▒▓ ▓▓▓░░░░░▒▓▓ ▓▓▒░░░░▓ ▓▓▓░░░░░░░░░▓▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓░░░░▒▓▓ ▓▓▒░░░░░▒░░▒▓▓ ▓▓░░░░▒▓▓▓▒░░░░░▒░░░░░▒▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓▓░░░░▒▓▓▓ ▓▓▓▒░░░░░▒▒░░░░░▒▓▓▓ ▓▓▓░░░░░▓▓▓░░░░░▒▓▓▓░░░░░▒▓▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓▓▓░░░░░░▒▒▓▓▒░░░░░░▒▓▓▓▓░░░░░░░▒▒▓▓▒░░░░░░▓▓▓░░░░░▒▓▓▓▓▓▒░░░░░▓▓ | ||
▓▒░░░░▒▓ ▓▓░░░░░▓▓ ▓▓░░░░▒▓▓▓▓▒░░░░░░░░░░░░░▒▓▓▓ ▓▓▓▓▒░░░░░░░░░░░░░▒▓▓▒░░░░░▓▓▓ ▓▓▒░░░░░▒▓ | ||
▓▓░░░▒▓▓ ▓▓▒░░░▒▓▓ ▓▓░░░░▓▓ ▓▓▓▓▒░░░░░░▒▒▓▓▓▓ ▓▓▓▓▓▒▒░░░░░▒▒▓▓▓▓▓░░░░▒▓▓ ▓▓▓░░░░▒▓ | ||
▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ | ||
'); | ||
} | ||
|
||
public function welcome(): void | ||
{ | ||
note('Welcome to the Moox Core installer'); | ||
} | ||
|
||
public function checkForFilament(): void | ||
{ | ||
if (! File::exists($this->providerPath)) { | ||
error('The Filament AdminPanelProvider.php or FilamentServiceProvider.php file does not exist.'); | ||
info(' '); | ||
warning('You should install FilamentPHP first, see https://filamentphp.com/docs/panels/installation'); | ||
info(' '); | ||
if (confirm('Do you want to install Filament now?', true)) { | ||
info('Starting Filament installer...'); | ||
$this->call('filament:install', ['--panels' => true]); | ||
} | ||
} | ||
|
||
if (! File::exists($this->providerPath)) { | ||
if (! confirm('Filament is not installed properly. Do you want to proceed anyway?', false)) { | ||
info('Installation cancelled.'); | ||
|
||
return; // cancel installation | ||
} | ||
} | ||
} | ||
|
||
public function registerPlugins(): void | ||
{ | ||
note('Registering Moox Core Plugins...'); | ||
|
||
if (File::exists($this->providerPath)) { | ||
$content = File::get($this->providerPath); | ||
$intend = ' '; | ||
|
||
$pluginsToAdd = ['Leandrocfe\FilamentApexCharts\FilamentApexChartsPlugin']; | ||
|
||
$function = '::make(),'; | ||
|
||
$pattern = '/->plugins\(\[([\s\S]*?)\]\);/'; | ||
$newPlugins = ''; | ||
|
||
foreach ($pluginsToAdd as $plugin) { | ||
$pluginParts = explode('\\', $plugin); | ||
$pluginName = $pluginParts[2]; | ||
$searchPlugin = '/'.$pluginName.'/'; | ||
if (preg_match($searchPlugin, $content)) { | ||
info("$pluginName already registered."); | ||
} else { | ||
$newPlugins .= $intend.$plugin.$function."\n"; | ||
} | ||
} | ||
|
||
if ($newPlugins) { | ||
if (preg_match($pattern, $content)) { | ||
info('Plugins section found. Adding new plugins...'); | ||
|
||
$replacement = "->plugins([$1\n$newPlugins\n ]);"; | ||
$newContent = preg_replace($pattern, $replacement, $content); | ||
} else { | ||
info('Plugins section created. Adding new plugins...'); | ||
|
||
$pluginsSection = " ->plugins([\n$newPlugins\n ]);"; | ||
$placeholderPattern = '/(\->authMiddleware\(\[.*?\]\))\s*\;/s'; | ||
$replacement = "$1\n".$pluginsSection; | ||
$newContent = preg_replace($placeholderPattern, $replacement, $content, 1); | ||
} | ||
File::put($this->providerPath, $newContent); | ||
} | ||
} | ||
} | ||
|
||
public function sayGoodbye(): void | ||
{ | ||
note('Moox Core installed successfully. Enjoy!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Moox\Core; | ||
|
||
use Moox\Core\Commands\InstallCommand; | ||
use Spatie\LaravelPackageTools\Package; | ||
use Spatie\LaravelPackageTools\PackageServiceProvider; | ||
|
||
class CoreServiceProvider extends PackageServiceProvider | ||
{ | ||
public function configurePackage(Package $package): void | ||
{ | ||
$package | ||
->name('core') | ||
->hasConfigFile() | ||
->hasTranslations() | ||
->hasCommand(InstallCommand::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters