Skip to content

Commit ffd5ec8

Browse files
authored
fix!: create theme:clean command for cleaning theme static files and cache, remove old mageforge:static:clean command (#80)
1 parent b73b178 commit ffd5ec8

File tree

6 files changed

+23
-27
lines changed

6 files changed

+23
-27
lines changed

.github/workflows/magento-compatibility.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ jobs:
149149
bin/magento m:h:c:c --show-all --detailed
150150
151151
echo "Test MageForge Static Clean command with dry-run:"
152-
bin/magento mageforge:static:clean --all --dry-run
152+
bin/magento mageforge:theme:clean --all --dry-run
153153
154154
echo "Test MageForge Static Clean aliases:"
155-
bin/magento mageforge:static:clean --all --dry-run
155+
bin/magento mageforge:theme:clean --all --dry-run
156156
echo "Test MageForge Static Clean aliases:"
157-
bin/magento m:st:c --help
157+
bin/magento m:t:c --help
158158
bin/magento frontend:clean --help
159159
160160
echo "Test Theme Name Suggestions (non-interactive):"
@@ -165,7 +165,7 @@ jobs:
165165
bin/magento mageforge:theme:watch Magent/lum --help || echo "Expected failure - WatchCommand"
166166
167167
echo "Testing CleanCommand with invalid theme name:"
168-
bin/magento mageforge:static:clean Magent/lum --dry-run || echo "Expected failure - CleanCommand"
168+
bin/magento mageforge:theme:clean Magent/lum --dry-run || echo "Expected failure - CleanCommand"
169169
170170
echo "Testing TokensCommand with invalid theme name:"
171171
bin/magento mageforge:hyva:tokens Magent/lum --help || echo "Expected failure - TokensCommand"
@@ -306,10 +306,10 @@ jobs:
306306
bin/magento m:h:c:c --show-all --detailed
307307
308308
echo "Test MageForge Static Clean command with dry-run:"
309-
bin/magento mageforge:static:clean --all --dry-run
309+
bin/magento mageforge:theme:clean --all --dry-run
310310
311311
echo "Test MageForge Static Clean alias:"
312-
bin/magento m:st:c --help
312+
bin/magento m:t:c --help
313313
bin/magento frontend:clean --help
314314
315315
echo "Test Theme Name Suggestions (non-interactive):"
@@ -320,7 +320,7 @@ jobs:
320320
bin/magento mageforge:theme:watch Magent/lum --help || echo "Expected failure - WatchCommand"
321321
322322
echo "Testing CleanCommand with invalid theme name:"
323-
bin/magento mageforge:static:clean Magent/lum --dry-run || echo "Expected failure - CleanCommand"
323+
bin/magento mageforge:theme:clean Magent/lum --dry-run || echo "Expected failure - CleanCommand"
324324
325325
echo "Testing TokensCommand with invalid theme name:"
326326
bin/magento mageforge:hyva:tokens Magent/lum --help || echo "Expected failure - TokensCommand"

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ All notable changes to this project will be documented in this file.
5555
- Detailed file-level issues with line numbers
5656
- Exit code 1 for critical issues, 0 for success
5757
- Command aliases: `m:h:c:c`, `hyva:check`
58-
- feat: add `mageforge:static:clean` command for comprehensive cache and generated files cleanup
59-
- feat: add interactive multi-theme selection for static:clean command using Laravel Prompts
58+
- feat: add `mageforge:theme:clean` command for comprehensive cache and generated files cleanup
59+
- feat: add interactive multi-theme selection for theme:clean command using Laravel Prompts
6060
- feat: add `--all` option to clean all themes at once
6161
- feat: add `--dry-run` option to preview what would be cleaned without deleting
6262
- feat: add command alias `frontend:clean` for quick access
63-
- feat: add CI/CD tests for static:clean command in compatibility workflow
63+
- feat: add CI/CD tests for theme:clean command in compatibility workflow
6464

6565
#### Fixed
6666

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Please ensure that your Magento installation meets this requirement before insta
4040
| `mageforge:theme:watch` | Starts watch mode for theme development | `m:t:w`, `frontend:watch` |
4141
| `mageforge:hyva:tokens` | Generate Hyvä design tokens (Hyvä themes only) | `m:h:t` |
4242
| `mageforge:hyva:compatibility:check`| Check modules for Hyvä theme compatibility issues | `m:h:c:c`, `hyva:check` |
43-
| `mageforge:static:clean` | Clean static files, cache and generated files for a theme | `m:st:c`,`frontend:clean` |
43+
| `mageforge:theme:clean` | Clean theme static files and cache directories | `m:t:c`, `frontend:clean` |
4444

4545
---
4646

docs/commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ bin/magento mageforge:theme:watch [--theme=THEME]
9494

9595
---
9696

97-
### 4. CleanCommand (`mageforge:static:clean`)
97+
### 4. CleanCommand (`mageforge:theme:clean`)
9898

9999
**Purpose**: Cleans var/view_preprocessed, pub/static, var/page_cache, var/tmp and generated directories for specific theme.
100100

101-
**File**: `/src/Console/Command/Static/CleanCommand.php`
101+
**File**: `/src/Console/Command/Theme/CleanCommand.php`
102102

103103
**Dependencies**:
104104

@@ -109,7 +109,7 @@ bin/magento mageforge:theme:watch [--theme=THEME]
109109
**Usage**:
110110

111111
```bash
112-
bin/magento mageforge:static:clean [<themename>]
112+
bin/magento mageforge:theme:clean [<themename>]
113113
```
114114

115115
**Implementation Details**:

src/Console/Command/Static/CleanCommand.php renamed to src/Console/Command/Theme/CleanCommand.php

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

33
declare(strict_types=1);
44

5-
namespace OpenForgeProject\MageForge\Console\Command\Static;
5+
namespace OpenForgeProject\MageForge\Console\Command\Theme;
66

77
use Laravel\Prompts\MultiSelectPrompt;
88
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -46,12 +46,8 @@ public function __construct(
4646
*/
4747
protected function configure(): void
4848
{
49-
$this->setName($this->getCommandName('static', 'clean'))
50-
->setDescription(
51-
'Clean theme-specific static files (var/view_preprocessed, pub/static) '
52-
. 'for selected themes and global cache directories '
53-
. '(var/page_cache, var/tmp, generated)'
54-
)
49+
$this->setName($this->getCommandName('theme', 'clean'))
50+
->setDescription('Clean theme static files and cache directories')
5551
->addArgument(
5652
'themeCodes',
5753
InputArgument::IS_ARRAY,
@@ -69,7 +65,7 @@ protected function configure(): void
6965
InputOption::VALUE_NONE,
7066
'Show what would be cleaned without actually deleting anything'
7167
)
72-
->setAliases(['m:st:c', 'frontend:clean']);
68+
->setAliases(['m:t:c', 'frontend:clean']);
7369
}
7470

7571
/**
@@ -178,9 +174,9 @@ private function displayAvailableThemes(array $themes): void
178174
}
179175

180176
$this->io->newLine();
181-
$this->io->info('Usage: bin/magento mageforge:static:clean <theme-code> [<theme-code>...]');
182-
$this->io->info(' bin/magento mageforge:static:clean --all');
183-
$this->io->info('Example: bin/magento mageforge:static:clean Magento/luma');
177+
$this->io->info('Usage: bin/magento mageforge:theme:clean <theme-code> [<theme-code>...]');
178+
$this->io->info(' bin/magento mageforge:theme:clean --all');
179+
$this->io->info('Example: bin/magento mageforge:theme:clean Magento/luma');
184180
}
185181

186182
/**

src/etc/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
OpenForgeProject\MageForge\Console\Command\Theme\BuildCommand</item>
1818
<item name="mageforge_theme_watch" xsi:type="object">
1919
OpenForgeProject\MageForge\Console\Command\Theme\WatchCommand</item>
20-
<item name="mageforge_static_clean" xsi:type="object">
21-
OpenForgeProject\MageForge\Console\Command\Static\CleanCommand</item>
20+
<item name="mageforge_theme_clean" xsi:type="object">
21+
OpenForgeProject\MageForge\Console\Command\Theme\CleanCommand</item>
2222
<item name="mageforge_hyva_compatibility_check" xsi:type="object">
2323
OpenForgeProject\MageForge\Console\Command\Hyva\CompatibilityCheckCommand</item>
2424
<item name="mageforge_theme_tokens" xsi:type="object">

0 commit comments

Comments
 (0)