Skip to content

Commit f550b8f

Browse files
nutrinaGerald Iakobinyi-Pich
andauthored
Ensure no duplicate files are generated by the bundle django command. (#10441)
- have added a check in the command that raises an error if a file with duplicate name is generated - have adjusted all {% bundle ... %} tag usage, and set unique file name Co-authored-by: Gerald Iakobinyi-Pich <gerald@gitcoin.co>
1 parent a89ee31 commit f550b8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+61
-54
lines changed

app/dashboard/management/commands/bundle.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import shutil
44

55
from django.conf import settings
6-
from django.core.management.base import BaseCommand
6+
from django.core.management.base import BaseCommand, CommandError
77
from django.template import Context, Template
88
from django.template.loaders.app_directories import get_app_template_dirs
99

@@ -111,7 +111,14 @@ def handle(self, *args, **options):
111111
block = block.render(bundleContext)
112112

113113
# render the template (producing a bundle file)
114-
rendered[render(block, kind, 'file', name, True)] = True
114+
rendered_tag = render(block, kind, 'file', name, True)
115+
if rendered_tag in rendered:
116+
error = '-- X - duplicate: "%s"\ntemplate: "%s"\nblock:"%s"' % (rendered_tag, template, block)
117+
raise CommandError(error)
118+
119+
rendered[rendered_tag] = True
120+
except CommandError:
121+
raise
115122
except Exception as e:
116123
print('-- X - failed to parse %s: %s' % (template, e))
117124
pass

app/dashboard/templates/bounty/details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ <h3>{{ noscript.keywords }}</h3>
531531

532532
<script src="/dynamic/js/tokens_dynamic.js"></script>
533533

534-
{% bundle merge_js file libs %}
534+
{% bundle merge_js file bounty_details_libs %}
535535
<script src="index.min.js" base-dir="/node_modules/ipfs-api/dist/"></script>
536536
<script src="highlight.min.js" base-dir="/node_modules/@highlightjs/cdn-assets/"></script>
537537
<script src="markdown-it.min.js" base-dir="/node_modules/markdown-it/dist/"></script>

app/dashboard/templates/bounty/details2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ <h3>{{ noscript.keywords }}</h3>
11421142
{% include 'shared/current_profile.html' %}
11431143
</div>
11441144

1145-
{% bundle merge_js file libs %}
1145+
{% bundle merge_js file bounty_details2_libs %}
11461146
<script src="highlight.min.js" base-dir="/node_modules/@highlightjs/cdn-assets/"></script>
11471147
<script src="markdown-it.min.js" base-dir="/node_modules/markdown-it/dist/"></script>
11481148
<script src="daterangepicker.js" base-dir="/node_modules/daterangepicker/"></script>

app/dashboard/templates/bounty/new_bounty.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{% include 'shared/cards.html' %}
2525
<meta name="title" content="Create Funded Issue/Bounty | Gitcoin">
2626
<meta name="description" content="Instructions for creating an issue and posting a bounty to Gitcoin so developers across the world can discover your bounty and start working on your issue.">
27-
{% bundle css file new_bounty %}
27+
{% bundle css file new_bounty_style %}
2828
<link rel="stylesheet" type="text/x-scss" href={% static "v2/scss/quickstart.scss" %} />
2929
<link rel="stylesheet" type="text/x-scss" href={% static "v2/scss/activity_stream.scss" %} />
3030
<link rel="stylesheet" type="text/x-scss" href={% static "v2/scss/tag.scss" %} />
@@ -739,7 +739,7 @@ <h5 class="text-uppercase h3 font-weight-bold mb-0">Total</h5>
739739
]
740740
</script>
741741

742-
{% bundle merge_js file libs %}
742+
{% bundle merge_js file new_bounty_libs %}
743743
<script src="index.min.js" base-dir="/node_modules/ipfs-api/dist/"></script>
744744
<script src="highlight.min.js" base-dir="/node_modules/@highlightjs/cdn-assets/"></script>
745745
<script src="markdown-it.min.js" base-dir="/node_modules/markdown-it/dist/"></script>

app/dashboard/templates/dashboard/hackathon/projects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<head>
2222
{% include 'shared/head.html' %}
2323
{% include 'shared/cards_pic.html' %}
24-
{% bundle css file howitworks %}
24+
{% bundle css file hackathon_projects_howitworks %}
2525
<link rel="stylesheet" type="text/x-scss" href={% static "v2/scss/howitworks.scss" %} />
2626
{% endbundle %}
2727
<style>

app/dashboard/templates/dashboard/index-vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ <h4 class="font-bigger-1 font-weight-bold mb-3">[[hackathon.name]] Wall of Fame<
786786
<slot></slot>
787787
</select>
788788
</script>
789-
{% bundle merge_js file new_bounty %}
789+
{% bundle merge_js file app_dashboard %}
790790
<script src="markdown-it.min.js" base-dir="/node_modules/markdown-it/dist/"></script>
791791
{% endbundle %}
792792
{{orgs|json_script:"sponsor-list"}}

app/dashboard/templates/onepager/send2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{% endblock %}
5151
<!-- Main -->
5252
{% block 'main' %}
53-
{% bundle css file tooltip_hover %}
53+
{% bundle css file tooltip_hover_send2 %}
5454
<link rel="stylesheet" type="text/x-scss" href={% static "v2/scss/tooltip_hover.scss" %} />
5555
{% endbundle %}
5656
<style>

app/dashboard/templates/profiles/profile.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
{% endif %}
139139
</script>
140140

141-
{% bundle merge_js file jitsi %}
141+
{% bundle merge_js file profile_jitsi %}
142142
<script src="external_api.min.js" base-dir="/node_modules/lib-jitsi-meet-dist/dist"></script>
143143
{% endbundle %}
144144

app/dashboard/templates/profiles/tribes-vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ <h1 class="profile-header__handle mb-1">
13041304
<script defer src='https://cdn.jsdelivr.net/npm/quill@1.3.6/dist/quill.min.js'></script>
13051305
<script defer src='https://cdn.jsdelivr.net/npm/vue-quill-editor@3.0.6/dist/vue-quill-editor.js'></script>
13061306
{{currentProfile|json_script:"current-profile"}}
1307-
{% bundle merge_js file jitsi %}
1307+
{% bundle merge_js file jitsi_tribes %}
13081308
<script src="external_api.min.js" base-dir="/node_modules/lib-jitsi-meet-dist/dist"></script>
13091309
{% endbundle %}
13101310
<script src='{% static "v2/js/pages/profile-tribes.js" %}'></script>

app/dataviz/templates/cohort.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<!-- code to include the highcharts and jQuery libraries goes here -->
4949
<!-- load_charts filter takes a comma-separated list of id's where -->
5050
<!-- the charts need to be rendered to -->
51-
{% bundle merge_js file jquery %}
51+
{% bundle merge_js file jquery_cohort %}
5252
<script src="jquery.min.js" base-dir="/node_modules/jquery/dist/"></script>
5353
{% endbundle %}
5454
</head>

0 commit comments

Comments
 (0)