Skip to content

Commit 293fe94

Browse files
committed
refactored create command to make
1 parent f949b75 commit 293fe94

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

src/Commands/CreateCommand.php renamed to src/Commands/MakeCommand.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use IsaEken\ThemeSystem\ThemeSystem;
99
use IsaEken\ThemeSystem\Webpack;
1010

11-
class CreateCommand extends Command
11+
class MakeCommand extends Command
1212
{
1313
/**
1414
* The console command signature.
1515
*
1616
* @var string
1717
*/
18-
protected $signature = ThemeSystem::CommandPrefix . 'create {name}';
18+
protected $signature = 'make:theme {name}';
1919

2020
/**
2121
* The console command description.
@@ -38,19 +38,8 @@ public function handle(): void
3838
return;
3939
}
4040

41-
$this->info('Creating theme...');
42-
43-
$dir = theme_system()->getThemesDirectory() . '/' . $name;
44-
45-
File::makeDirectory($dir . '/public', recursive: true);
46-
File::makeDirectory($dir . '/resources/css', recursive: true);
47-
File::makeDirectory($dir . '/resources/js', recursive: true);
48-
File::put($dir . '/webpack.mix.js', Webpack::generateTheme());
49-
File::put($dir . '/resources/css/app.css', '');
50-
File::put($dir . '/resources/js/app.js', '');
51-
41+
theme_system()->make($name);
5242
Artisan::call(ThemeSystem::CommandPrefix . 'publish');
53-
5443
$this->info("Theme created: $name");
5544
}
5645
}

src/ThemeSystemServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace IsaEken\ThemeSystem;
44

5-
use IsaEken\ThemeSystem\Commands\CreateCommand;
5+
use IsaEken\ThemeSystem\Commands\MakeCommand;
66
use IsaEken\ThemeSystem\Commands\InitializeCommand;
77
use IsaEken\ThemeSystem\Commands\PublishCommand;
88
use IsaEken\ThemeSystem\Illuminate\FileViewFinder;
@@ -20,7 +20,7 @@ public function configurePackage(Package $package): void
2020
->hasCommands(
2121
PublishCommand::class,
2222
InitializeCommand::class,
23-
CreateCommand::class,
23+
MakeCommand::class,
2424
);
2525
}
2626

tests/BrowserTestCase.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ protected function getEnvironmentSetUp($app)
2727
$themeName = 'browser-test-theme';
2828

2929
if (!theme_system()->isExists($themeName)) {
30-
$dir = theme_system()->getThemesDirectory() . '/' . $themeName;
31-
File::makeDirectory("$dir/public", recursive: true);
32-
File::put("$dir/testing.blade.php", 'Testing');
30+
theme_system()->make($themeName);
31+
File::put(theme_path($themeName) . "/testing.blade.php", 'Testing');
3332
}
3433

3534
/** @var Router $router */

tests/ThemeSystemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ function makeTestingTheme(): string
5252
assertTrue(file_exists(public_path($name)));
5353
});
5454

55-
it('works create command', function () {
55+
it('works make command', function () {
5656
$name = Str::of(Str::random())->lower()->snake('-')->__toString();
57-
Artisan::call(ThemeSystem::CommandPrefix . 'create ' . $name);
57+
Artisan::call('make:theme ' . $name);
5858
assertTrue(theme_system()->isExists($name));
5959
});
6060

0 commit comments

Comments
 (0)