Skip to content

Commit

Permalink
Merge pull request #3 from suraj-webkul/compatible-to-2.0.0
Browse files Browse the repository at this point in the history
Compatible to v2.0.0
  • Loading branch information
devansh-webkul authored Sep 27, 2024
2 parents affd983 + 0c9a4d0 commit 381dc79
Show file tree
Hide file tree
Showing 57 changed files with 797 additions and 573 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This changelog consists the bug & security fixes and new features being included in the releases listed below.

## **v2.0.0(23rd of September, 2024)** - _Release_

- [compatibility] Compatibility for Krayin v2.0.0.

- [feature] If no arguments are passed, it will prompt for the required argument.

## **v1.0.0 (27th of September, 2024)** - _Release_

- [feature] Create package with a single command.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It packs in lots of demanding features that allows your business to scale in no

## 2. Requirements

* **Krayin**: v1.0.x
* **Krayin**: v2.0.x

## 3. Installation

Expand All @@ -28,7 +28,7 @@ composer require krayin/krayin-package-generator

After setting up, you will see that there are list of package commands which help you to make your package creation smooth.

Below are the list of commands,
Below are the list of commands, If no arguments are passed, it will prompt for the required argument.

| S. No. | Commands | Info | Required Arguments | Optional Arguments |
| :----- | :------------------------------------- | :-------------------------------------------------------------------------------------------------------------- | :------------------------------------- | :------------------ |
Expand Down
32 changes: 21 additions & 11 deletions src/Console/Command/CommandMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Webkul\PackageGenerator\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'package:make-command')]
class CommandMakeCommand extends MakeCommand
{
/**
Expand All @@ -12,38 +15,45 @@ class CommandMakeCommand extends MakeCommand
protected $signature = 'package:make-command {name} {package} {--force}';

/**
* The console command description.
* The type of class being generated.
*
* @var string
*/
protected $type = 'Console command';

/**
* The console command description.
*
* @var string|null
*/
protected $description = 'Create a new command.';

/**
* @return mixed
* Get the stub file for the generator.
*/
protected function getStubContents()
protected function getStubContents(): string
{
return $this->packageGenerator->getStubContents('command', $this->getStubVariables());
}

/**
* @return array
* Get the stub variables.
*/
protected function getStubVariables()
protected function getStubVariables(): array
{
return [
'NAMESPACE' => $this->getClassNamespace($this->argument('package') . '/Console/Commands'),
'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/Console/Commands'),
'CLASS' => $this->getClassName(),
];
}

/**
* @return string
* Get the source file path.
*/
protected function getSourceFilePath()
protected function getSourceFilePath(): string
{
$path = base_path('packages/' . $this->argument('package')) . '/src/Console/Commands';
$path = base_path('packages/'.$this->argument('package')).'/src/Console/Commands';

return $path . '/' . $this->getClassName() . '.php';
return "$path/{$this->getClassName()}.php";
}
}
}
32 changes: 20 additions & 12 deletions src/Console/Command/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Webkul\PackageGenerator\Console\Command;

use Webkul\PackageGenerator\Generators\PackageGenerator;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'package:make-controller')]
class ControllerMakeCommand extends MakeCommand
{
/**
Expand All @@ -14,39 +15,46 @@ class ControllerMakeCommand extends MakeCommand
protected $signature = 'package:make-controller {name} {package} {--force}';

/**
* The console command description.
* The type of class being generated.
*
* @var string
*/
protected $type = 'Controller';

/**
* The console command description.
*
* @var string|null
*/
protected $description = 'Create a new controller.';

/**
* @return mixed
* Get the stub file for the generator.
*/
protected function getStubContents()
protected function getStubContents(): string
{
return $this->packageGenerator->getStubContents('controller', $this->getStubVariables());
}

/**
* @return array
* Get the stub variables.
*/
protected function getStubVariables()
protected function getStubVariables(): array
{
return [
'NAMESPACE' => $this->getClassNamespace($this->argument('package') . '/Http/Controllers'),
'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/Http/Controllers'),
'CLASS' => $this->getClassName(),
'LOWER_NAME' => $this->getLowerName(),
];
}

/**
* @return string
* Get the source file path.
*/
protected function getSourceFilePath()
protected function getSourceFilePath(): string
{
$path = base_path('packages/' . $this->argument('package')) . '/src/Http/Controllers';
$path = base_path('packages/'.$this->argument('package')).'/src/Http/Controllers';

return $path . '/' . $this->getClassName() . '.php';
return "$path/{$this->getClassName()}.php";
}
}
}
30 changes: 20 additions & 10 deletions src/Console/Command/DatagridMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Webkul\PackageGenerator\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'package:make-datagrid')]
class DatagridMakeCommand extends MakeCommand
{
/**
Expand All @@ -11,6 +14,13 @@ class DatagridMakeCommand extends MakeCommand
*/
protected $signature = 'package:make-datagrid {name} {package} {--force}';

/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Datagrid';

/**
* The console command description.
*
Expand All @@ -19,31 +29,31 @@ class DatagridMakeCommand extends MakeCommand
protected $description = 'Create a new datagrid.';

/**
* @return mixed
* Get the stub file for the generator.
*/
protected function getStubContents()
protected function getStubContents(): string
{
return $this->packageGenerator->getStubContents('datagrid', $this->getStubVariables());
}

/**
* @return array
* Get the stub variables.
*/
protected function getStubVariables()
protected function getStubVariables(): array
{
return [
'NAMESPACE' => $this->getClassNamespace($this->argument('package') . '/Datagrids'),
'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/DataGrids'),
'CLASS' => $this->getClassName(),
];
}

/**
* @return string
* Get the source file path.
*/
protected function getSourceFilePath()
protected function getSourceFilePath(): string
{
$path = base_path('packages/' . $this->argument('package')) . '/src/Datagrids';
$path = base_path('packages/'.$this->argument('package')).'/src/DataGrids';

return $path . '/' . $this->getClassName() . '.php';
return "$path/{$this->getClassName()}.php";
}
}
}
30 changes: 20 additions & 10 deletions src/Console/Command/EventMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Webkul\PackageGenerator\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'package:make-event')]
class EventMakeCommand extends MakeCommand
{
/**
Expand All @@ -11,6 +14,13 @@ class EventMakeCommand extends MakeCommand
*/
protected $signature = 'package:make-event {name} {package} {--force}';

/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Event';

/**
* The console command description.
*
Expand All @@ -19,31 +29,31 @@ class EventMakeCommand extends MakeCommand
protected $description = 'Create a new event.';

/**
* @return mixed
* Get the stub file for the generator.
*/
protected function getStubContents()
protected function getStubContents(): string
{
return $this->packageGenerator->getStubContents('event', $this->getStubVariables());
}

/**
* @return array
* Get the stub variables.
*/
protected function getStubVariables()
protected function getStubVariables(): array
{
return [
'NAMESPACE' => $this->getClassNamespace($this->argument('package') . '/Events'),
'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/Events'),
'CLASS' => $this->getClassName(),
];
}

/**
* @return string
* Get the source file path.
*/
protected function getSourceFilePath()
protected function getSourceFilePath(): string
{
$path = base_path('packages/' . $this->argument('package')) . '/src/Events';
$path = base_path('packages/'.$this->argument('package')).'/src/Events';

return $path . '/' . $this->getClassName() . '.php';
return "$path/{$this->getClassName()}.php";
}
}
}
30 changes: 20 additions & 10 deletions src/Console/Command/ListenerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Webkul\PackageGenerator\Console\Command;

use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'package:make-listener')]
class ListenerMakeCommand extends MakeCommand
{
/**
Expand All @@ -11,6 +14,13 @@ class ListenerMakeCommand extends MakeCommand
*/
protected $signature = 'package:make-listener {name} {package} {--force}';

/**
* The type of class being generated.
*
* @var string
*/
protected $type = 'Listener';

/**
* The console command description.
*
Expand All @@ -19,31 +29,31 @@ class ListenerMakeCommand extends MakeCommand
protected $description = 'Create a new listener.';

/**
* @return mixed
* Get the stub file for the generator.
*/
protected function getStubContents()
protected function getStubContents(): string
{
return $this->packageGenerator->getStubContents('listener', $this->getStubVariables());
}

/**
* @return array
* Get the stub variables.
*/
protected function getStubVariables()
protected function getStubVariables(): array
{
return [
'NAMESPACE' => $this->getClassNamespace($this->argument('package') . '/Listeners'),
'NAMESPACE' => $this->getClassNamespace($this->argument('package').'/Listeners'),
'CLASS' => $this->getClassName(),
];
}

/**
* @return string
* Get the source file path.
*/
protected function getSourceFilePath()
protected function getSourceFilePath(): string
{
$path = base_path('packages/' . $this->argument('package')) . '/src/Listeners';
$path = base_path('packages/'.$this->argument('package')).'/src/Listeners';

return $path . '/' . $this->getClassName() . '.php';
return "$path/{$this->getClassName()}.php";
}
}
}
Loading

0 comments on commit 381dc79

Please sign in to comment.