@@ -22,11 +22,7 @@ protected function configure(): void
2222 ->addOption ('no-js ' , null , InputOption::VALUE_NONE , 'Disable JS compilation (core + plugins) ' )
2323 ->addOption ('no-twig ' , null , InputOption::VALUE_NONE , 'Disable Twig watch/live reload feedback ' )
2424 ->addOption ('no-scss ' , null , InputOption::VALUE_NONE , 'Disable SCSS compilation ' )
25- ->addOption ('open-browser ' , null , InputOption::VALUE_NONE , 'Auto-open browser on startup ' )
26- ->addOption ('theme-name ' , null , InputOption::VALUE_REQUIRED , 'Technical theme name passed to theme:dump ' )
27- ->addOption ('theme-id ' , null , InputOption::VALUE_REQUIRED , 'Theme ID passed to theme:dump ' )
28- ->addOption ('domain-url ' , null , InputOption::VALUE_REQUIRED , 'Sales channel domain URL passed to theme:dump ' )
29- ->addOption ('pick-theme ' , null , InputOption::VALUE_NONE , 'Force interactive theme:dump theme/domain picker ' );
25+ ->addOption ('open-browser ' , null , InputOption::VALUE_NONE , 'Auto-open browser on startup ' );
3026 }
3127
3228 protected function execute (InputInterface $ input , OutputInterface $ output ): int
@@ -67,35 +63,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6763 $ disableTwig = (bool ) $ input ->getOption ('no-twig ' );
6864 $ disableScss = (bool ) $ input ->getOption ('no-scss ' );
6965 $ openBrowser = (bool ) $ input ->getOption ('open-browser ' );
70- $ themeName = $ this ->normalizeOptionalString ($ input ->getOption ('theme-name ' ));
71- $ themeId = $ this ->normalizeOptionalString ($ input ->getOption ('theme-id ' ));
72- $ domainUrl = $ this ->normalizeOptionalString ($ input ->getOption ('domain-url ' ));
73- $ pickThemeOption = (bool ) $ input ->getOption ('pick-theme ' );
74- $ canRunThemePicker = $ input ->isInteractive () && Process::isTtySupported ();
75- $ hasExplicitThemeSelection = $ themeName !== '' || $ themeId !== '' || $ domainUrl !== '' ;
76- $ pickTheme = $ pickThemeOption || (!$ hasExplicitThemeSelection && $ canRunThemePicker );
7766 $ scssEngine = $ this ->resolveScssEngine ();
7867
79- if ($ themeName !== '' && $ themeId !== '' ) {
80- $ io ->error ('Use either --theme-name or --theme-id (not both). ' );
81-
82- return self ::FAILURE ;
83- }
84-
85- if ($ domainUrl !== '' && $ themeId === '' ) {
86- $ io ->error ('--domain-url requires --theme-id. Use --pick-theme for interactive theme/domain selection. ' );
87-
88- return self ::FAILURE ;
89- }
90-
91- if ($ pickThemeOption && ($ themeName !== '' || $ themeId !== '' || $ domainUrl !== '' )) {
92- $ io ->error ('--pick-theme cannot be combined with --theme-name, --theme-id, or --domain-url. ' );
93-
94- return self ::FAILURE ;
95- }
96-
97- if ($ pickThemeOption && !$ canRunThemePicker ) {
98- $ io ->error ('--pick-theme requires an interactive TTY terminal. ' );
68+ if (!$ input ->isInteractive () || !Process::isTtySupported ()) {
69+ $ io ->error ('sidworks:watch-storefront requires an interactive TTY terminal because theme selection is always prompted. ' );
9970
10071 return self ::FAILURE ;
10172 }
@@ -141,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
141112 }
142113 }
143114
144- $ prepExitCode = $ this ->runPrepCommands ($ output , $ input , $ projectRoot, $ themeName , $ themeId , $ domainUrl , $ pickTheme );
115+ $ prepExitCode = $ this ->runPrepCommands ($ output , $ input , $ projectRoot );
145116 if ($ prepExitCode !== 0 ) {
146117 return $ prepExitCode ;
147118 }
@@ -161,31 +132,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
161132 private function runPrepCommands (
162133 OutputInterface $ output ,
163134 InputInterface $ input ,
164- string $ projectRoot ,
165- string $ themeName ,
166- string $ themeId ,
167- string $ domainUrl ,
168- bool $ pickTheme
135+ string $ projectRoot
169136 ): int {
170- $ hasThemeSelection = $ themeName !== '' || $ themeId !== '' || $ domainUrl !== '' || $ pickTheme ;
171- if (is_file ($ projectRoot . '/var/theme-files.json ' ) && !$ hasThemeSelection ) {
172- return 0 ;
173- }
174-
175- $ themeDumpArguments = ['theme:dump ' ];
176- if ($ themeName !== '' ) {
177- $ themeDumpArguments [] = '--theme-name= ' . $ themeName ;
178- }
179-
180- if ($ themeId !== '' ) {
181- $ themeDumpArguments [] = $ themeId ;
182- }
183-
184- if ($ domainUrl !== '' ) {
185- $ themeDumpArguments [] = $ domainUrl ;
186- }
187-
188- return $ this ->runConsoleCommand ($ themeDumpArguments , $ projectRoot , $ output , $ input , !$ pickTheme );
137+ return $ this ->runConsoleCommand (['theme:dump ' ], $ projectRoot , $ output , $ input , false );
189138 }
190139
191140 private function runConsoleCommand (
@@ -724,12 +673,4 @@ private function killPids(array $pids, string $signal): void
724673 $ kill ->run ();
725674 }
726675
727- private function normalizeOptionalString (mixed $ value ): string
728- {
729- if (!\is_string ($ value )) {
730- return '' ;
731- }
732-
733- return trim ($ value );
734- }
735676}
0 commit comments