@@ -39,6 +39,10 @@ applyv25patches() {
3939 # # TODO: Update test to not use configuration
4040 patchTestPetClinic
4141 ;;
42+ hilla-quickstart-tutorial)
43+ # # TODO: Update Lumo imports in TypeScript files
44+ patchLumoImports
45+ ;;
4246 esac
4347 # # TODO: document in migration guide to 25
4448 patchImports ' import com.fasterxml.jackson.core.type.TypeReference;' ' import tools.jackson.core.type.TypeReference;'
@@ -301,4 +305,34 @@ class CacheConfiguration {
301305 }
302306}
303307EOF
308+ }
309+
310+ # # Update Lumo imports in TypeScript files for hilla-quickstart-tutorial
311+ # # Replace individual sizing and spacing imports with unified utility.css import
312+ # # TODO: needs to be documented in vaadin migration guide to 25
313+ patchLumoImports () {
314+ local views_dir=" src/main/frontend/views"
315+ [ ! -d " $views_dir " ] && return 0
316+
317+ # Find all TypeScript files in the views directory
318+ local ts_files=$( find " $views_dir " -name " *.ts" -type f)
319+ [ -z " $ts_files " ] && return 0
320+
321+ local file
322+ for file in $ts_files ; do
323+ # Check if file contains @vaadin/vaadin-lumo-styles imports that are not utility.css
324+ local has_other_lumo_imports=$( grep " ^import '@vaadin/vaadin-lumo-styles/" " $file " | grep -v " utility\.css" | wc -l)
325+ if [ " $has_other_lumo_imports " -gt 0 ]; then
326+ [ -z " $TEST " ] && warn " updating Lumo imports in $file " || cmd " ## updating Lumo imports in $file "
327+
328+ # Remove all @vaadin/vaadin-lumo-styles imports except utility.css
329+ perl -pi -e " s|^import '\@vaadin/vaadin-lumo-styles/(?!utility\.css).*';\s*\n||" " $file "
330+
331+ # Add the new unified import if not already present
332+ if ! grep -q " @vaadin/vaadin-lumo-styles/utility.css" " $file " ; then
333+ # Simply add the import at the top of the file using perl
334+ perl -i -pe ' print "import ' \' ' \@vaadin/vaadin-lumo-styles/utility.css' \' ' ;\n" if $. == 1' " $file "
335+ fi
336+ fi
337+ done
304338}
0 commit comments