@newskit-render/core 2.44.1-alpha.0 → 2.45.0-alpha.0

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.
Files changed (60) hide show
  1. package/.prettierignore +2 -0
  2. package/assets/fontFamily.ts +204 -0
  3. package/assets/fonts/Graphik-Black-App.ttf +0 -0
  4. package/assets/fonts/Graphik-BlackItalic-App.ttf +0 -0
  5. package/assets/fonts/Graphik-Bold-App.ttf +0 -0
  6. package/assets/fonts/Graphik-BoldItalic-App.ttf +0 -0
  7. package/assets/fonts/Graphik-Extralight-App.ttf +0 -0
  8. package/assets/fonts/Graphik-ExtralightItalic-App.ttf +0 -0
  9. package/assets/fonts/Graphik-Light-App.ttf +0 -0
  10. package/assets/fonts/Graphik-LightItalic-App.ttf +0 -0
  11. package/assets/fonts/Graphik-Medium-App.ttf +0 -0
  12. package/assets/fonts/Graphik-Medium-Web.woff2 +0 -0
  13. package/assets/fonts/Graphik-MediumItalic-App.ttf +0 -0
  14. package/assets/fonts/Graphik-Regular-App.ttf +0 -0
  15. package/assets/fonts/Graphik-Regular-Web.woff2 +0 -0
  16. package/assets/fonts/Graphik-RegularItalic-App.ttf +0 -0
  17. package/assets/fonts/Graphik-Semibold-App.ttf +0 -0
  18. package/assets/fonts/Graphik-Semibold-Web.woff2 +0 -0
  19. package/assets/fonts/Graphik-SemiboldItalic-App.ttf +0 -0
  20. package/assets/fonts/Graphik-Super-App.ttf +0 -0
  21. package/assets/fonts/Graphik-SuperItalic-App.ttf +0 -0
  22. package/assets/fonts/Graphik-Thin-App.ttf +0 -0
  23. package/assets/fonts/Graphik-ThinItalic-App.ttf +0 -0
  24. package/assets/fonts/PublicoHeadline-Black-App.ttf +0 -0
  25. package/assets/fonts/PublicoHeadline-BlackItalic-App.ttf +0 -0
  26. package/assets/fonts/PublicoHeadline-Bold-App.ttf +0 -0
  27. package/assets/fonts/PublicoHeadline-Bold-Web.woff2 +0 -0
  28. package/assets/fonts/PublicoHeadline-BoldItalic-App.ttf +0 -0
  29. package/assets/fonts/PublicoHeadline-Extrabold-App.ttf +0 -0
  30. package/assets/fonts/PublicoHeadline-ExtraboldItalic-App.ttf +0 -0
  31. package/assets/fonts/PublicoHeadline-Italic-App.ttf +0 -0
  32. package/assets/fonts/PublicoHeadline-Light-App.ttf +0 -0
  33. package/assets/fonts/PublicoHeadline-LightItalic-App.ttf +0 -0
  34. package/assets/fonts/PublicoHeadline-Medium-App.ttf +0 -0
  35. package/assets/fonts/PublicoHeadline-MediumItalic-App.ttf +0 -0
  36. package/assets/fonts/PublicoHeadline-Roman-App.ttf +0 -0
  37. package/assets/fonts/PublicoHeadline-Roman-Web.woff2 +0 -0
  38. package/assets/fonts/PublicoText-Bold-App.ttf +0 -0
  39. package/assets/fonts/PublicoText-BoldItalic-App.ttf +0 -0
  40. package/assets/fonts/PublicoText-Italic-App.ttf +0 -0
  41. package/assets/fonts/PublicoText-Italic-Web.woff2 +0 -0
  42. package/assets/fonts/PublicoText-Roman-App.ttf +0 -0
  43. package/assets/fonts/PublicoText-Roman-Web.woff2 +0 -0
  44. package/assets/fonts/PublicoText-Semibold-App.ttf +0 -0
  45. package/assets/fonts/PublicoText-SemiboldItalic-App.ttf +0 -0
  46. package/helpers/__tests__/useThemeDropdownObject.test.ts +6 -0
  47. package/helpers/useThemeDropdownObject.tsx +8 -0
  48. package/infrastructure/terraform-newrelic/dashboards.tf +14 -14
  49. package/infrastructure/terraform-newrelic/dev.tfvars +2 -1
  50. package/infrastructure/terraform-newrelic/lighthouse-script-dev.js +53 -0
  51. package/infrastructure/terraform-newrelic/lighthouse-script-prod.js +48 -40
  52. package/infrastructure/terraform-newrelic/lighthouse-script-stage.js +54 -0
  53. package/infrastructure/terraform-newrelic/monitors.tf +1 -1
  54. package/infrastructure/terraform-newrelic/prod.tfvars +2 -1
  55. package/infrastructure/terraform-newrelic/staging.tfvars +2 -1
  56. package/infrastructure/terraform-newrelic/variables.tf +4 -0
  57. package/package.json +5 -5
  58. package/pages/_app.tsx +6 -0
  59. package/public/assets/tls-logo-white.svg +3 -0
  60. package/infrastructure/terraform-newrelic/lighthouse-script.js +0 -46
package/.prettierignore CHANGED
@@ -15,3 +15,5 @@ cypress/plugins
15
15
  cypress/support
16
16
  public/*
17
17
  infrastructure/helm/*
18
+ infrastructure/terraform-newrelic/*.js
19
+ terraform-newrelic/*.js
@@ -188,6 +188,207 @@ const montserrat = localFont({
188
188
  display: 'swap',
189
189
  })
190
190
 
191
+ const publicoHeadline = localFont({
192
+ src: [
193
+ {
194
+ path: './fonts/PublicoHeadline-Extrabold-App.ttf',
195
+ weight: '800',
196
+ style: 'normal',
197
+ },
198
+ {
199
+ path: './fonts/PublicoHeadline-ExtraboldItalic-App.ttf',
200
+ weight: '800',
201
+ style: 'italic',
202
+ },
203
+ {
204
+ path: './fonts/PublicoHeadline-Bold-Web.woff2',
205
+ weight: '700',
206
+ style: 'normal',
207
+ },
208
+ {
209
+ path: './fonts/PublicoHeadline-BoldItalic-App.ttf',
210
+ weight: '700',
211
+ style: 'italic',
212
+ },
213
+ {
214
+ path: './fonts/PublicoHeadline-Black-App.ttf',
215
+ weight: '600',
216
+ style: 'normal',
217
+ },
218
+ {
219
+ path: './fonts/PublicoHeadline-BlackItalic-App.ttf',
220
+ weight: '600',
221
+ style: 'italic',
222
+ },
223
+ {
224
+ path: './fonts/PublicoHeadline-Medium-App.ttf',
225
+ weight: '500',
226
+ style: 'normal',
227
+ },
228
+ {
229
+ path: './fonts/PublicoHeadline-MediumItalic-App.ttf',
230
+ weight: '500',
231
+ style: 'italic',
232
+ },
233
+ {
234
+ path: './fonts/PublicoHeadline-Roman-Web.woff2',
235
+ weight: '400',
236
+ style: 'normal',
237
+ },
238
+ {
239
+ path: './fonts/PublicoHeadline-Italic-App.ttf',
240
+ weight: '400',
241
+ style: 'italic',
242
+ },
243
+ {
244
+ path: './fonts/PublicoHeadline-Light-App.ttf',
245
+ weight: '300',
246
+ style: 'normal',
247
+ },
248
+ {
249
+ path: './fonts/PublicoHeadline-LightItalic-App.ttf',
250
+ weight: '300',
251
+ style: 'italic',
252
+ },
253
+ ],
254
+ fallback: ['sans-serif'],
255
+ display: 'swap',
256
+ })
257
+
258
+ const publicoText = localFont({
259
+ src: [
260
+ {
261
+ path: './fonts/PublicoText-Roman-Web.woff2',
262
+ weight: '400',
263
+ style: 'normal',
264
+ },
265
+ {
266
+ path: './fonts/PublicoText-Italic-Web.woff2',
267
+ weight: '400',
268
+ style: 'italic',
269
+ },
270
+ {
271
+ path: './fonts/PublicoText-Semibold-App.ttf',
272
+ weight: '500',
273
+ style: 'normal',
274
+ },
275
+ {
276
+ path: './fonts/PublicoText-SemiboldItalic-App.ttf',
277
+ weight: '500',
278
+ style: 'italic',
279
+ },
280
+ {
281
+ path: './fonts/PublicoText-Bold-App.ttf',
282
+ weight: '700',
283
+ style: 'normal',
284
+ },
285
+ {
286
+ path: './fonts/PublicoText-BoldItalic-App.ttf',
287
+ weight: '700',
288
+ style: 'italic',
289
+ },
290
+ ],
291
+ fallback: ['sans-serif'],
292
+ display: 'swap',
293
+ })
294
+
295
+ const graphik = localFont({
296
+ src: [
297
+ {
298
+ path: './fonts/Graphik-Super-App.ttf',
299
+ weight: '900',
300
+ style: 'normal',
301
+ },
302
+ {
303
+ path: './fonts/Graphik-SuperItalic-App.ttf',
304
+ weight: '900',
305
+ style: 'italic',
306
+ },
307
+ {
308
+ path: './fonts/Graphik-Black-App.ttf',
309
+ weight: '800',
310
+ style: 'normal',
311
+ },
312
+ {
313
+ path: './fonts/Graphik-BlackItalic-App.ttf',
314
+ weight: '800',
315
+ style: 'italic',
316
+ },
317
+ {
318
+ path: './fonts/Graphik-Bold-App.ttf',
319
+ weight: '700',
320
+ style: 'normal',
321
+ },
322
+ {
323
+ path: './fonts/Graphik-BoldItalic-App.ttf',
324
+ weight: '700',
325
+ style: 'italic',
326
+ },
327
+ {
328
+ path: './fonts/Graphik-Semibold-Web.woff2',
329
+ weight: '600',
330
+ style: 'normal',
331
+ },
332
+ {
333
+ path: './fonts/Graphik-SemiboldItalic-App.ttf',
334
+ weight: '600',
335
+ style: 'italic',
336
+ },
337
+ {
338
+ path: './fonts/Graphik-Medium-Web.woff2',
339
+ weight: '500',
340
+ style: 'normal',
341
+ },
342
+ {
343
+ path: './fonts/Graphik-MediumItalic-App.ttf',
344
+ weight: '500',
345
+ style: 'italic',
346
+ },
347
+ {
348
+ path: './fonts/Graphik-Regular-Web.woff2',
349
+ weight: '400',
350
+ style: 'normal',
351
+ },
352
+ {
353
+ path: './fonts/Graphik-RegularItalic-App.ttf',
354
+ weight: '400',
355
+ style: 'italic',
356
+ },
357
+ {
358
+ path: './fonts/Graphik-Light-App.ttf',
359
+ weight: '300',
360
+ style: 'normal',
361
+ },
362
+ {
363
+ path: './fonts/Graphik-LightItalic-App.ttf',
364
+ weight: '300',
365
+ style: 'italic',
366
+ },
367
+ {
368
+ path: './fonts/Graphik-Extralight-App.ttf',
369
+ weight: '200',
370
+ style: 'normal',
371
+ },
372
+ {
373
+ path: './fonts/Graphik-ExtralightItalic-App.ttf',
374
+ weight: '200',
375
+ style: 'italic',
376
+ },
377
+ {
378
+ path: './fonts/Graphik-Thin-App.ttf',
379
+ weight: '100',
380
+ style: 'normal',
381
+ },
382
+ {
383
+ path: './fonts/Graphik-ThinItalic-App.ttf',
384
+ weight: '100',
385
+ style: 'italic',
386
+ },
387
+ ],
388
+ fallback: ['serif'],
389
+ display: 'swap',
390
+ })
391
+
191
392
  export {
192
393
  bitter,
193
394
  poppins,
@@ -197,4 +398,7 @@ export {
197
398
  timesModern,
198
399
  timesDigital,
199
400
  montserrat,
401
+ publicoHeadline,
402
+ publicoText,
403
+ graphik,
200
404
  }
@@ -34,6 +34,12 @@ describe('createThemeDropdownObject', () => {
34
34
  height: '40px',
35
35
  top: '0',
36
36
  },
37
+ TLS: {
38
+ height: '40px',
39
+ src: '/assets/tls-logo-white.svg',
40
+ top: '0',
41
+ width: '150px',
42
+ },
37
43
  },
38
44
  options: expect.any(Object),
39
45
  themeDropdownOpen: false,
@@ -6,6 +6,7 @@ import {
6
6
  timesTheme,
7
7
  virginRadioTheme,
8
8
  theSunTheme,
9
+ tlsTheme,
9
10
  ThemeDropdownObject,
10
11
  ThemeDropdown,
11
12
  } from '@newskit-render/shared-components'
@@ -35,6 +36,12 @@ const clientNavigationLogos = {
35
36
  height: '40px',
36
37
  top: '0',
37
38
  },
39
+ TLS: {
40
+ src: '/assets/tls-logo-white.svg',
41
+ width: '150px',
42
+ height: '40px',
43
+ top: '0',
44
+ },
38
45
  }
39
46
 
40
47
  export const useThemeDropdownObject = (
@@ -49,6 +56,7 @@ export const useThemeDropdownObject = (
49
56
  sharedTheme,
50
57
  sharedThemeDark,
51
58
  timesTheme,
59
+ tlsTheme,
52
60
  virginRadioTheme,
53
61
  theSunTheme,
54
62
  },
@@ -184,7 +184,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
184
184
  width = 4
185
185
 
186
186
  nrql_query {
187
- query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index'"
187
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index' WHERE custom.url = '${var.lighthouseUrl}'"
188
188
  }
189
189
  }
190
190
 
@@ -196,7 +196,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
196
196
  width = 8
197
197
 
198
198
  nrql_query {
199
- query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index' TIMESERIES AUTO"
199
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) as 'FCP', average(custom.largestContentfulPaint) as 'LCP', average(custom.interactive) as 'TTI', average(custom.totalBlockingTime) as 'TBT', average(custom.cumulativeLayoutShift) as 'CLS', average(custom.speedIndex) as 'Speed Index' TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
200
200
  }
201
201
  }
202
202
 
@@ -208,7 +208,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
208
208
  width = 4
209
209
 
210
210
  nrql_query {
211
- query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url"
211
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
212
212
  }
213
213
  }
214
214
 
@@ -220,7 +220,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
220
220
  width = 8
221
221
 
222
222
  nrql_query {
223
- query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url TIMESERIES AUTO"
223
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
224
224
  }
225
225
  }
226
226
 
@@ -232,7 +232,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
232
232
  width = 4
233
233
 
234
234
  nrql_query {
235
- query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url"
235
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
236
236
  }
237
237
  }
238
238
 
@@ -244,7 +244,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
244
244
  width = 8
245
245
 
246
246
  nrql_query {
247
- query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url TIMESERIES AUTO"
247
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
248
248
  }
249
249
  }
250
250
 
@@ -256,7 +256,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
256
256
  width = 4
257
257
 
258
258
  nrql_query {
259
- query = "FROM SyntheticCheck SELECT average(custom.interactive) as 'TTI' FACET custom.url"
259
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) as 'TTI' FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
260
260
  }
261
261
  }
262
262
 
@@ -268,7 +268,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
268
268
  width = 8
269
269
 
270
270
  nrql_query {
271
- query = "FROM SyntheticCheck SELECT average(custom.interactive) FACET custom.url TIMESERIES AUTO"
271
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
272
272
  }
273
273
  }
274
274
 
@@ -280,7 +280,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
280
280
  width = 4
281
281
 
282
282
  nrql_query {
283
- query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url"
283
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
284
284
  }
285
285
  }
286
286
 
@@ -292,7 +292,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
292
292
  width = 8
293
293
 
294
294
  nrql_query {
295
- query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url TIMESERIES AUTO"
295
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
296
296
  }
297
297
  }
298
298
 
@@ -304,7 +304,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
304
304
  width = 4
305
305
 
306
306
  nrql_query {
307
- query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url"
307
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
308
308
  }
309
309
  }
310
310
 
@@ -316,7 +316,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
316
316
  width = 8
317
317
 
318
318
  nrql_query {
319
- query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url TIMESERIES AUTO"
319
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
320
320
  }
321
321
  }
322
322
 
@@ -328,7 +328,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
328
328
  width = 4
329
329
 
330
330
  nrql_query {
331
- query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url"
331
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url WHERE custom.url = '${var.lighthouseUrl}'"
332
332
  }
333
333
  }
334
334
 
@@ -340,7 +340,7 @@ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
340
340
  width = 8
341
341
 
342
342
  nrql_query {
343
- query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url TIMESERIES AUTO"
343
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url TIMESERIES AUTO WHERE custom.url = '${var.lighthouseUrl}'"
344
344
  }
345
345
  }
346
346
  }
@@ -1,2 +1,3 @@
1
1
  environment = "dev"
2
- namespace = "<% PROJECT_NAME >-dev"
2
+ namespace = "<% PROJECT_NAME >-dev"
3
+ lighthouseUrl = "https://<% PROJECT_NAME >.ceng-dev.newsuk.tech/"
@@ -0,0 +1,53 @@
1
+ /* To get Google Page Speed API Key - https://developers.google.com/speed/docs/insights/v5/get-started */
2
+
3
+ got = require('got');
4
+
5
+ let categories = ['SEO', 'ACCESSIBILITY', 'BEST_PRACTICES', 'PERFORMANCE', 'PWA'];
6
+ let endpoint = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?key='+ $secure.<% PROJECT_NAME >_PAGESPEED_INSIGHTS_API_KEY + '&';
7
+ const strategy = "desktop";
8
+ let settings = {'url': 'https://<% PROJECT_NAME >.ceng-dev.newsuk.tech/', 'strategy': strategy};
9
+ const options = {
10
+ method: 'GET',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ }
14
+ };
15
+ categories.forEach((item, i) => {
16
+ endpoint += `category=${item}&`;
17
+ });
18
+ endpoint += `url=${settings.url}&`;
19
+ endpoint += `strategy=${strategy}`;
20
+
21
+
22
+ const getData = async () => {
23
+ try {
24
+ const body = await got.get(endpoint, options)
25
+ .json();
26
+ let lighthouseMetrics = body.lighthouseResult.audits.metrics.details.items[0];
27
+ console.log(body.lighthouseResult.configSettings.onlyCategories);
28
+ $util.insights.set('url', settings.url);
29
+ $util.insights.set('deviceType', settings.strategy);
30
+ $util.insights.set('performanceScore', body.lighthouseResult.categories.performance.score * 100);
31
+ $util.insights.set('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
32
+ console.log('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
33
+ $util.insights.set('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
34
+ console.log('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
35
+ $util.insights.set('seoScore', body.lighthouseResult.categories.seo.score * 100);
36
+ console.log('seoScore', body.lighthouseResult.categories.seo.score * 100);
37
+ $util.insights.set('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
38
+ console.log('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
39
+
40
+ for (let attributeName in lighthouseMetrics) {
41
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
42
+ if (!attributeName.includes('Ts')) {
43
+ console.log(attributeName + ": " + lighthouseMetrics[attributeName]);
44
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName]);
45
+ }
46
+ }
47
+ }
48
+ } catch (err) {
49
+ console.error("Error:", err);
50
+
51
+ }
52
+ };
53
+ getData();
@@ -1,46 +1,54 @@
1
- /** API SETUP - remove this section to run in New Relic Synthetics **/
2
- // if ($http == null) { var $http = require('request'); }
3
- /** API SETUP - remove this section to run in New Relic Synthetics **/
1
+ /* To get Google Page Speed API Key - https://developers.google.com/speed/docs/insights/v5/get-started */
4
2
 
5
- var settings = {
6
- url: 'https://newskit-render.prod.ceng.newsuk.tech/',
7
- category: 'performance',
8
- strategy: 'desktop',
9
- }
3
+ got = require('got');
4
+
5
+ let categories = ['SEO', 'ACCESSIBILITY', 'BEST_PRACTICES', 'PERFORMANCE', 'PWA'];
6
+ let endpoint = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?key='+ $secure.<% PROJECT_NAME >_PAGESPEED_INSIGHTS_API_KEY + '&';
7
+ const strategy = "desktop";
8
+ let settings = {'url': 'https://<% PROJECT_NAME >.prod.ceng.newsuk.tech/', 'strategy': strategy};
9
+ const options = {
10
+ method: 'GET',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ }
14
+ };
15
+ categories.forEach((item, i) => {
16
+ endpoint += `category=${item}&`;
17
+ });
18
+ endpoint += `url=${settings.url}&`;
19
+ endpoint += `strategy=${strategy}`;
10
20
 
11
- var options = {
12
- method: 'GET',
13
- url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
- headers: null,
15
- qs: settings,
16
- json: true,
17
- }
18
21
 
19
- $http(options, function (error, response, body) {
20
- if (!error && response.statusCode == 200) {
21
- if (response.statusCode == 200) {
22
- var lighthouseMetrics =
23
- body.lighthouseResult.audits.metrics.details.items[0]
24
- $util.insights.set('url', settings.url)
25
- $util.insights.set('deviceType', settings.strategy)
26
- $util.insights.set(
27
- 'performanceScore',
28
- body.lighthouseResult.categories.performance.score
29
- )
22
+ const getData = async () => {
23
+ try {
24
+ const body = await got.get(endpoint, options)
25
+ .json();
26
+ let lighthouseMetrics = body.lighthouseResult.audits.metrics.details.items[0];
27
+ console.log(body.lighthouseResult.configSettings.onlyCategories);
28
+ $util.insights.set('url', settings.url);
29
+ $util.insights.set('deviceType', settings.strategy);
30
+ $util.insights.set('performanceScore', body.lighthouseResult.categories.performance.score * 100);
31
+ $util.insights.set('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
32
+ console.log('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
33
+ $util.insights.set('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
34
+ console.log('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
35
+ $util.insights.set('seoScore', body.lighthouseResult.categories.seo.score * 100);
36
+ console.log('seoScore', body.lighthouseResult.categories.seo.score * 100);
37
+ $util.insights.set('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
38
+ console.log('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
30
39
 
31
- for (var attributeName in lighthouseMetrics) {
32
- if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
- if (!attributeName.includes('Ts')) {
34
- console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
- $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
- }
40
+ for (let attributeName in lighthouseMetrics) {
41
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
42
+ if (!attributeName.includes('Ts')) {
43
+ console.log(attributeName + ": " + lighthouseMetrics[attributeName]);
44
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName]);
45
+ }
46
+ }
37
47
  }
38
- }
39
- } else {
40
- console.log('Non-200 HTTP response: ' + response.statusCode)
48
+ } catch (err) {
49
+ console.error("Error:", err);
50
+
41
51
  }
42
- } else {
43
- console.log('rsp code: ' + response.statusCode)
44
- console.log(error)
45
- }
46
- })
52
+ };
53
+ getData();
54
+
@@ -0,0 +1,54 @@
1
+ /* To get Google Page Speed API Key - https://developers.google.com/speed/docs/insights/v5/get-started */
2
+
3
+ got = require('got');
4
+
5
+ let categories = ['SEO', 'ACCESSIBILITY', 'BEST_PRACTICES', 'PERFORMANCE', 'PWA'];
6
+ let endpoint = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?key='+ $secure.<% PROJECT_NAME >_PAGESPEED_INSIGHTS_API_KEY + '&';
7
+ const strategy = "desktop";
8
+ let settings = {'url': 'https://<% PROJECT_NAME >.staging.ceng.newsuk.tech/', 'strategy': strategy};
9
+ const options = {
10
+ method: 'GET',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ }
14
+ };
15
+ categories.forEach((item, i) => {
16
+ endpoint += `category=${item}&`;
17
+ });
18
+ endpoint += `url=${settings.url}&`;
19
+ endpoint += `strategy=${strategy}`;
20
+
21
+
22
+ const getData = async () => {
23
+ try {
24
+ const body = await got.get(endpoint, options)
25
+ .json();
26
+ let lighthouseMetrics = body.lighthouseResult.audits.metrics.details.items[0];
27
+ console.log(body.lighthouseResult.configSettings.onlyCategories);
28
+ $util.insights.set('url', settings.url);
29
+ $util.insights.set('deviceType', settings.strategy);
30
+ $util.insights.set('performanceScore', body.lighthouseResult.categories.performance.score * 100);
31
+ $util.insights.set('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
32
+ console.log('accessibilityScore', body.lighthouseResult.categories.accessibility.score * 100);
33
+ $util.insights.set('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
34
+ console.log('bestPracticesScore', body.lighthouseResult.categories['best-practices'].score * 100);
35
+ $util.insights.set('seoScore', body.lighthouseResult.categories.seo.score * 100);
36
+ console.log('seoScore', body.lighthouseResult.categories.seo.score * 100);
37
+ $util.insights.set('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
38
+ console.log('pwaScore', body.lighthouseResult.categories.pwa.score * 100);
39
+
40
+ for (let attributeName in lighthouseMetrics) {
41
+ if (lighthouseMetrics.hasOwnProperty(attributeName)) {
42
+ if (!attributeName.includes('Ts')) {
43
+ console.log(attributeName + ": " + lighthouseMetrics[attributeName]);
44
+ $util.insights.set(attributeName, lighthouseMetrics[attributeName]);
45
+ }
46
+ }
47
+ }
48
+ } catch (err) {
49
+ console.error("Error:", err);
50
+
51
+ }
52
+ };
53
+ getData();
54
+
@@ -4,7 +4,7 @@ resource "newrelic_synthetics_script_monitor" "lighthouse-monitor" {
4
4
  locations_public = ["EU_WEST_2"]
5
5
  period = "EVERY_30_MINUTES"
6
6
  status = "ENABLED"
7
- script = var.environment == "prod" ? file("${path.module}/lighthouse-script-prod.js") : file("${path.module}/lighthouse-script.js")
7
+ script = var.environment == "prod" ? file("${path.module}/lighthouse-script-prod.js") : var.environment == "dev" ? file("${path.module}/lighthouse-script-dev.js") : file("${path.module}/lighthouse-script-stage.js")
8
8
  script_language = "JAVASCRIPT"
9
9
  runtime_type = "NODE_API"
10
10
  runtime_type_version = "16.10"
@@ -1,2 +1,3 @@
1
1
  environment = "prod"
2
- namespace = "<% PROJECT_NAME >-prod"
2
+ namespace = "<% PROJECT_NAME >-prod"
3
+ lighthouseUrl = "https://<% PROJECT_NAME >.prod.ceng.newsuk.tech/"
@@ -1,2 +1,3 @@
1
1
  environment = "staging"
2
- namespace = "<% PROJECT_NAME >-staging"
2
+ namespace = "<% PROJECT_NAME >-staging"
3
+ lighthouseUrl = "https://<% PROJECT_NAME >.staging.ceng.newsuk.tech/"
@@ -27,3 +27,7 @@ variable "project_name" {
27
27
  description = "The Project name"
28
28
  default = "<% PROJECT_NAME >"
29
29
  }
30
+
31
+ variable "lighthouseUrl" {
32
+ description = "url to be analyzed by Lighthouse"
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "2.44.1-alpha.0",
3
+ "version": "2.45.0-alpha.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -41,12 +41,12 @@
41
41
  "@emotion/styled": "11.9.3",
42
42
  "@newskit-render/api": "^1.6.6-alpha.0",
43
43
  "@newskit-render/auth": "^1.3.10-alpha.0",
44
- "@newskit-render/checkout": "^2.5.1-alpha.0",
44
+ "@newskit-render/checkout": "^2.5.1-alpha.1",
45
45
  "@newskit-render/feature-flags": "^1.4.11-alpha.0",
46
46
  "@newskit-render/feed": "^1.4.16-alpha.0",
47
- "@newskit-render/my-account": "^4.4.1-alpha.0",
48
- "@newskit-render/shared-components": "^2.4.2-alpha.0",
49
- "@newskit-render/standalone-components": "^2.5.2-alpha.0",
47
+ "@newskit-render/my-account": "^4.4.1-alpha.1",
48
+ "@newskit-render/shared-components": "^2.5.0-alpha.0",
49
+ "@newskit-render/standalone-components": "^2.5.2-alpha.1",
50
50
  "@newskit-render/validation": "^1.5.12-alpha.0",
51
51
  "@next/font": "13.1.6",
52
52
  "cross-fetch": "3.1.5",
package/pages/_app.tsx CHANGED
@@ -18,6 +18,9 @@ import {
18
18
  timesModern,
19
19
  timesDigital,
20
20
  montserrat,
21
+ publicoHeadline,
22
+ publicoText,
23
+ graphik,
21
24
  } from '../assets/fontFamily'
22
25
 
23
26
  if (!process.browser) {
@@ -50,6 +53,9 @@ function MyApp({ Component, pageProps, tenant }: MyAppProps) {
50
53
  --times-modern: ${timesModern.style.fontFamily};
51
54
  --times-digital: ${timesDigital.style.fontFamily};
52
55
  --montserrat: ${montserrat.style.fontFamily};
56
+ --publico-headline: ${publicoHeadline.style.fontFamily};
57
+ --publico-text: ${publicoText.style.fontFamily};
58
+ --graphik: ${graphik.style.fontFamily};
53
59
  }
54
60
  `}</style>
55
61
  <Head>
@@ -0,0 +1,3 @@
1
+ <svg width="70" height="48" viewBox="0 0 70 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M0 0.999428V7.00949H6.07407V46.9999H13.0041V7.00349H19.0002V0.999428H0ZM69.9908 32.9848C69.9578 31.5048 69.6008 30.0707 68.8808 28.7787C68.8608 28.7407 68.7118 28.4807 68.6608 28.3967C67.6408 26.6507 66.4267 25.0407 65.1737 23.4567C63.8757 21.8157 62.5577 20.1866 61.2727 18.5386C60.5717 17.6356 59.9227 16.6946 59.3897 15.6886C59.1097 15.1636 58.8897 14.6246 58.8897 14.0146C58.8897 12.1266 58.8837 10.2375 58.8967 8.35551C58.9027 7.8755 58.9547 7.3955 59.0267 6.92149C59.1237 6.30449 59.4477 5.85048 60.0647 5.65548C60.5733 5.49797 61.1131 5.46911 61.6357 5.57148C62.4017 5.71448 62.8557 6.17449 62.9727 6.93449C63.0507 7.4345 63.1027 7.9465 63.1027 8.44651C63.1157 11.1855 63.1097 14.9106 63.1097 14.9106H69.9898C69.9898 14.9106 69.9968 10.8285 69.9838 7.9075C69.9838 7.4015 69.9578 6.88849 69.8938 6.38949C69.5818 3.93546 68.2768 2.17744 66.1017 1.04143C65.0377 0.483422 63.8817 0.236419 62.7007 0.100418C61.2914 -0.065199 59.8656 -0.0257893 58.4676 0.217419C57.3376 0.411421 56.2606 0.736425 55.2876 1.35943C53.8916 2.24944 52.9176 3.47546 52.3976 5.04547C52.0996 5.94748 52.0156 6.88249 52.0156 7.8295C52.0156 9.99753 52.0086 12.1656 52.0216 14.3326C52.0216 14.8196 52.0676 15.3126 52.1386 15.7996C52.3006 16.9486 52.7616 17.9926 53.2936 19.0116C54.1116 20.5696 55.1316 21.9917 56.2346 23.3537C57.2736 24.6387 58.3506 25.8977 59.3967 27.1757C60.4807 28.5057 61.4797 29.8957 62.2587 31.4338C62.7917 32.4918 63.1157 33.6008 63.1157 34.7958C63.1157 36.4108 63.1227 38.0268 63.1097 39.6499C63.1027 40.1299 63.0577 40.6099 62.9797 41.0839C62.8567 41.8369 62.4087 42.3109 61.6427 42.4279C61.2727 42.4859 60.8897 42.4919 60.5127 42.4539C59.6557 42.3629 59.1687 41.9079 59.0197 41.0579C58.9375 40.5623 58.894 40.0611 58.8897 39.5589C58.8767 36.5218 58.8837 32.1798 58.8837 32.1798H52.0026C52.0026 32.1798 51.9956 36.9178 52.0086 40.1759C52.0086 40.7989 52.0546 41.4349 52.1706 42.0449C52.5996 44.3489 53.9176 45.9899 55.9876 47.0349C57.0336 47.5609 58.1626 47.7749 59.3117 47.9049C60.7717 48.0739 62.2267 48.0149 63.6747 47.7489C65.0507 47.4959 66.3227 46.9959 67.4197 46.1069C68.415 45.3119 69.1626 44.2492 69.5748 43.0439C69.8928 42.1229 69.9848 41.1689 69.9848 40.2019C69.9848 37.8388 70.0098 35.9568 69.9968 33.6918C69.9968 33.4718 69.9908 33.2318 69.9908 32.9848ZM28.0003 0.999428H35.0264V41.0029H44.0005V46.9999H28.0003" fill="white"/>
3
+ </svg>
@@ -1,46 +0,0 @@
1
- /** API SETUP - remove this section to run in New Relic Synthetics **/
2
- // if ($http == null) { var $http = require('request'); }
3
- /** API SETUP - remove this section to run in New Relic Synthetics **/
4
-
5
- var settings = {
6
- url: 'https://newskit-render.ceng-dev.newsuk.tech/',
7
- category: 'performance',
8
- strategy: 'desktop',
9
- }
10
-
11
- var options = {
12
- method: 'GET',
13
- url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
14
- headers: null,
15
- qs: settings,
16
- json: true,
17
- }
18
-
19
- $http(options, function (error, response, body) {
20
- if (!error && response.statusCode == 200) {
21
- if (response.statusCode == 200) {
22
- var lighthouseMetrics =
23
- body.lighthouseResult.audits.metrics.details.items[0]
24
- $util.insights.set('url', settings.url)
25
- $util.insights.set('deviceType', settings.strategy)
26
- $util.insights.set(
27
- 'performanceScore',
28
- body.lighthouseResult.categories.performance.score
29
- )
30
-
31
- for (var attributeName in lighthouseMetrics) {
32
- if (lighthouseMetrics.hasOwnProperty(attributeName)) {
33
- if (!attributeName.includes('Ts')) {
34
- console.log(attributeName + ': ' + lighthouseMetrics[attributeName])
35
- $util.insights.set(attributeName, lighthouseMetrics[attributeName])
36
- }
37
- }
38
- }
39
- } else {
40
- console.log('Non-200 HTTP response: ' + response.statusCode)
41
- }
42
- } else {
43
- console.log('rsp code: ' + response.statusCode)
44
- console.log(error)
45
- }
46
- })