Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added webpack template tags to bootstrap migration tool #35391

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions corehq/apps/hqwebapp/utils/bootstrap/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,16 @@ def check_bootstrap3_references_in_template(line, spec):
"It should also use requirejs_main_b5 instead of requirejs_main.")
if tag == "requirejs_main_b5":
issues.append("This template references a bootstrap 3 requirejs file.")
if tag == "js_entry_b3":
issues.append("This template references a bootstrap 3 webpack entry point. "
"It should also use js_entry instead of js_entry_b3.")
if tag == "js_entry":
issues.append("This template references a bootstrap 3 webpack entry point.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js_entry is BS5, right? Is this message correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, webpack uses js_entry for B5 and js_entry_b3 for B3, whereas requirejs uses requirejs_main for B3 and requirejs_main_b5 for B5

elif re.search(tag_only_regex, line):
if tag == "requirejs_main":
issues.append("This template should use requirejs_main_b5 instead of requirejs_main.")
if tag == "js_entry_b3":
issues.append("This template should use js_entry instead of js_entry_b3.")
regex = r"(=[\"\'][\w\/]+)(\/bootstrap3\/)"
if re.search(regex, line):
issues.append("This template references a bootstrap 3 file.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"col-xs-offset-<num>": "offset-sm-<num>"
},
"template_tag_renames": {
"requirejs_main": "requirejs_main_b5"
"requirejs_main": "requirejs_main_b5",
"js_entry_b3": "js_entry"
},
"data_attribute_renames": {
"data-toggle": "data-bs-toggle",
Expand Down Expand Up @@ -113,6 +114,8 @@
],
"template_tags_with_dependencies": [
"extends",
"js_entry",
"js_entry_b3",
"requirejs_main",
"requirejs_main_b5",
"static",
Expand Down
Loading