Skip to content

Commit

Permalink
first commit 🔥
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Jan 11, 2023
1 parent d7e9bfa commit d3c71fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion config/laravel-package-generator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

return [

"stub-path" => __DIR__ .'/../../stubs/',
"packages-folder" => "packages"
];
16 changes: 8 additions & 8 deletions src/Console/LaravelPackageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct()
{
parent::__construct();
$this->publish = __DIR__ .'/../../publish/';
$this->stubPath = __DIR__ .'/../../stubs/';
$this->stubPath = config('laravel-package-generator.stub-path');
}


Expand Down Expand Up @@ -81,8 +81,8 @@ public function handle()
$this->info('Generating package boilerplate...');

//create package directory
if(!File::exists(base_path('packages'))){
File::makeDirectory(base_path('packages'));
if(!File::exists(base_path(config('laravel-package-generator.packages-folder')))){
File::makeDirectory(base_path(config('laravel-package-generator.packages-folder')));
}

$packageVendorPath = $packageVendorString
Expand All @@ -92,8 +92,8 @@ public function handle()
->toString();

//Create vendor directory
if(!File::exists(base_path('packages') . "/" .$packageVendorPath)){
File::makeDirectory(base_path('packages') . "/" .$packageVendorPath);
if(!File::exists(base_path(config('laravel-package-generator.packages-folder')) . "/" .$packageVendorPath)){
File::makeDirectory(base_path(config('laravel-package-generator.packages-folder')) . "/" .$packageVendorPath);
}

$packageNamePath = $packageString
Expand All @@ -103,11 +103,11 @@ public function handle()
->toString();

//Create package directory
if(!File::exists(base_path('packages') . "/" .$packageVendor . "/" . $packageNamePath)){
File::makeDirectory(base_path('packages') . "/" .$packageVendor . "/" . $packageNamePath);
if(!File::exists(base_path(config('laravel-package-generator.packages-folder')) . "/" .$packageVendor . "/" . $packageNamePath)){
File::makeDirectory(base_path(config('laravel-package-generator.packages-folder')) . "/" .$packageVendor . "/" . $packageNamePath);
}

$packagePath = base_path('packages') . "/" .$packageVendorPath . "/" . $packageNamePath;
$packagePath = base_path(config('laravel-package-generator.packages-folder')) . "/" .$packageVendorPath . "/" . $packageNamePath;

//Build a package inside vendor directory
$packageConfig !== 'yes' ? null : $this->handelFile('config', $packagePath. "/config", 'folder');
Expand Down
5 changes: 5 additions & 0 deletions src/LaravelPackageGeneratorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public function register(): void
__DIR__.'/../config/tomato-settings.php' => config_path('laravel-package-generator.php'),
], 'config');

//Publish Stubs
$this->publishes([
__DIR__.'/../stubs' => base_path('stubs/laravel-package-generator'),
], 'stubs');

//Register generate command
$this->commands([
LaravelPackageGenerator::class,
Expand Down

0 comments on commit d3c71fd

Please sign in to comment.