Added vite for JS/CSS assets, made some changes to ServiceProvider
parent
972ddb9214
commit
acd26c85f6
|
@ -1,6 +1,8 @@
|
|||
/.idea/
|
||||
/node_modules/
|
||||
/vendor/
|
||||
composer.lock
|
||||
package-lock.json
|
||||
*cache*
|
||||
*.log
|
||||
*.tmp
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"illuminate/support": "^8.0"
|
||||
"illuminate/support": "^9.25"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^6.24",
|
||||
"enlightn/security-checker": "^1.10",
|
||||
"crawl/coding-standard": "^1.0",
|
||||
"mockery/mockery": "^1.5",
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"laravel-vite-plugin": "^0.5",
|
||||
"vite": "^3.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"resources/js/app.js": {
|
||||
"file": "app.cdb7ca6c.js",
|
||||
"src": "resources/js/app.js",
|
||||
"isEntry": true
|
||||
},
|
||||
"resources/sass/app.scss": {
|
||||
"file": "app.923f0842.css",
|
||||
"src": "resources/sass/app.scss",
|
||||
"isEntry": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
/** Package JS goes here */
|
|
@ -0,0 +1 @@
|
|||
/** Package CSS goes here */
|
|
@ -4,7 +4,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Crawl\Skeleton;
|
||||
|
||||
class Skeleton
|
||||
final class Skeleton
|
||||
{
|
||||
public const PACKAGE_VENDOR = 'crawl';
|
||||
public const PACKAGE_NAME = 'skeleton';
|
||||
|
||||
// Build your next great package.
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@ namespace Crawl\Skeleton;
|
|||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @see \Crawl\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,11 +6,8 @@ namespace Crawl\Skeleton;
|
|||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SkeletonServiceProvider extends ServiceProvider
|
||||
final class SkeletonServiceProvider extends ServiceProvider
|
||||
{
|
||||
public const PACKAGE_VENDOR = 'crawl';
|
||||
public const PACKAGE_NAME = 'skeleton';
|
||||
|
||||
private const COMMANDS = [
|
||||
|
||||
];
|
||||
|
@ -21,31 +18,31 @@ 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'),
|
||||
], 'config');
|
||||
$this->packageRoot() . '/config/config.php' => config_path(Skeleton::PACKAGE_NAME . '.php'),
|
||||
], Skeleton::PACKAGE_NAME . '-config');
|
||||
|
||||
// Publish assets
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
|
||||
//], ['assets', 'public']);
|
||||
// $this->packageRoot() . '/public' => public_path('vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-assets');
|
||||
|
||||
// Publishing translation files
|
||||
// Publish translation files
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/lang' => resource_path('lang/vendor/' . self::PACKAGE_NAME),
|
||||
//], 'lang');
|
||||
// $this->packageRoot() . '/resources/lang' => resource_path('lang/vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-lang');
|
||||
|
||||
// Publishing views
|
||||
// Publish views
|
||||
//$this->publishes([
|
||||
// $this->getPackagePath() . '/resources/views' => resource_path('views/vendor/' . self::PACKAGE_NAME),
|
||||
//], 'views');
|
||||
// $this->packageRoot() . '/resources/views' => resource_path('views/vendor/' . Skeleton::PACKAGE_NAME),
|
||||
//], Skeleton::PACKAGE_NAME . '-views');
|
||||
|
||||
// Registering package commands
|
||||
$this->commands(self::COMMANDS);
|
||||
|
@ -58,15 +55,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,20 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: 'public',
|
||||
assetsDir: '',
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
input: [
|
||||
'resources/sass/app.scss',
|
||||
'resources/js/app.js',
|
||||
],
|
||||
refresh: false,
|
||||
publicDirectory: 'public',
|
||||
buildDirectory: '.',
|
||||
}),
|
||||
],
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
const mix = require('laravel-mix');
|
||||
mix.options({
|
||||
terser: {
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
mix.setPublicPath('public')
|
||||
|
||||
mix.js('resources/js/app.js', '')
|
||||
mix.sass('resources/sass/app.scss', '')
|
||||
mix.version()
|
Loading…
Reference in New Issue