govuk_publishing_components 23.11.0 → 23.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 884556b32a54e514794dba01e0bbac985e9fae36beeea08e458e017ba20bc397
4
- data.tar.gz: 920499e180389d7f7fb34ad3a84b018a3e8d02a69393244c18027a55a0272031
3
+ metadata.gz: bfc403e4ae4e502dac4d0bbc51a5e3c0e454097ea602ef00a1cf0fd3e1ff98fb
4
+ data.tar.gz: 2b19a5969e18d37c3643fc800fb24a549487af3443074e7729d541184e16c315
5
5
  SHA512:
6
- metadata.gz: e7f807097888f485b69167eadc138c279654952b4e67050312d8f12215d439a503471da4af64198201bc99c6c0b967d1203482350037d29eb1900c330c9af7f8
7
- data.tar.gz: c360c8660c5e049177a15289856df34b84ccf25c3132361d8dcd5418a1947289afa76ff7ff0aff9ea103e8c8d8220ea57029fd790f7740169c9e6aa1aa9edf1b
6
+ metadata.gz: 3e9e7ee289c6a1cb4be8fdfba47fe6ca937654ee7fb379c8b1c2b88ff9a2cb890187a9ff7a2b5f850f17ef051f2b6d6e89fc3541acd8317aa7e991f52e6d10a0
7
+ data.tar.gz: e35c4c8554dbac78e610c31423d3b7e97f1bc8bfce31a32d3340ce99424d034694fbe868f0d70358d56b61604bfe5374d7be1d20b911b67539c6c9b93f1038a0
@@ -21,12 +21,15 @@ module GovukPublishingComponents
21
21
  collections-publisher
22
22
  content-data-admin
23
23
  content-publisher
24
+ datagovuk_find
24
25
  email-alert-frontend
25
26
  feedback
26
27
  finder-frontend
27
28
  frontend
28
29
  government-frontend
29
30
  govspeak-preview
31
+ govuk-account-manager-prototype
32
+ govuk-coronavirus-vulnerable-people-form
30
33
  info-frontend
31
34
  licence-finder
32
35
  manuals-frontend
@@ -7,6 +7,7 @@ module GovukPublishingComponents
7
7
  application_found = application_exists(path)
8
8
  components_found = []
9
9
  @gem_style_references = []
10
+ @jquery_references = []
10
11
 
11
12
  if application_found
12
13
  templates = Dir["#{path}/app/views/**/*.erb"]
@@ -65,6 +66,7 @@ module GovukPublishingComponents
65
66
  application_found: application_found,
66
67
  components_found: components_found,
67
68
  gem_style_references: @gem_style_references.flatten.uniq.sort,
69
+ jquery_references: @jquery_references.flatten.uniq.sort,
68
70
  }
69
71
  end
70
72
 
@@ -76,8 +78,14 @@ module GovukPublishingComponents
76
78
  files.each do |file|
77
79
  src = File.read(file)
78
80
  components_found << find_match(find, src, type)
79
- gem_references = find_gem_references(file, src)
80
- @gem_style_references << gem_references if gem_references
81
+
82
+ if type == "javascripts"
83
+ jquery_references = find_code_references(file, src, /\$\(/)
84
+ @jquery_references << jquery_references if jquery_references
85
+ else
86
+ gem_style_references = find_code_references(file, src, /gem-c-[-_a-zA-Z]+/)
87
+ @gem_style_references << gem_style_references if gem_style_references
88
+ end
81
89
  rescue StandardError
82
90
  puts "File #{file} not found"
83
91
  end
@@ -99,11 +107,10 @@ module GovukPublishingComponents
99
107
  all_matches
100
108
  end
101
109
 
102
- def find_gem_references(file, src)
103
- find_gem_classes = /gem-c-[-_a-zA-Z]+/
110
+ def find_code_references(file, src, regex)
104
111
  clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
105
112
 
106
- return file[clean_file_path] if find_gem_classes.match?(src)
113
+ return file[clean_file_path] if regex.match?(src)
107
114
  end
108
115
 
109
116
  def clean_file_name(name)
@@ -37,6 +37,7 @@ module GovukPublishingComponents
37
37
  warnings << warn_about_missing_components(result[:components_found])
38
38
  warnings << warn_about_missing_assets(result[:components_found])
39
39
  warnings << warn_about_style_overrides(result[:gem_style_references])
40
+ warnings << warn_about_jquery_references(result[:jquery_references])
40
41
  warnings = warnings.flatten
41
42
 
42
43
  data << {
@@ -67,6 +68,7 @@ module GovukPublishingComponents
67
68
  warnings: warnings,
68
69
  warning_count: warnings.length,
69
70
  gem_style_references: result[:gem_style_references],
71
+ jquery_references: result[:jquery_references],
70
72
  }
71
73
  else
72
74
  data << {
@@ -163,6 +165,16 @@ module GovukPublishingComponents
163
165
  warnings
164
166
  end
165
167
 
168
+ def warn_about_jquery_references(results)
169
+ warnings = []
170
+
171
+ results.each do |result|
172
+ warnings << create_warning("Possible jQuery", result)
173
+ end
174
+
175
+ warnings
176
+ end
177
+
166
178
  def find_missing(needle, haystack)
167
179
  (haystack - needle).flatten.sort
168
180
  end
@@ -109,6 +109,21 @@
109
109
  <% end %>
110
110
  </ul>
111
111
  <% end %>
112
+
113
+ <% if application[:jquery_references].any? %>
114
+ <%= render "govuk_publishing_components/components/heading", {
115
+ text: "jQuery references",
116
+ font_size: "m",
117
+ margin_bottom: 4,
118
+ heading_level: 3,
119
+ } %>
120
+ <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
121
+ <ul class="govuk-list govuk-list--bullet">
122
+ <% application[:jquery_references].each do |ref| %>
123
+ <li><%= ref %></li>
124
+ <% end %>
125
+ </ul>
126
+ <% end %>
112
127
  <% else %>
113
128
  <p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
114
129
  <% end %>
@@ -12,4 +12,4 @@ cy:
12
12
  transition:
13
13
  title: "Brexit"
14
14
  link_path: "/transition.cy"
15
- link_text: "Darganfyddwch sut mae’r rheolau newydd yn effeithio arnoch chi"
15
+ link_text: "Darganfyddwch sut mae’r rheolau Brexit newydd yn effeithio arnoch chi"
@@ -79,7 +79,7 @@ en:
79
79
  transition:
80
80
  title: "Brexit"
81
81
  link_path: "/transition"
82
- link_text: "Check how the new rules affect you"
82
+ link_text: "Check how the new Brexit rules affect you"
83
83
  related_footer_navigation:
84
84
  collections: "Collections"
85
85
  policies: "Policies"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.11.0".freeze
2
+ VERSION = "23.11.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 23.11.0
4
+ version: 23.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config