@newskit-render/core 1.9.0 → 1.13.3

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 (84) hide show
  1. package/.eslintignore +1 -0
  2. package/CHANGELOG.md +146 -0
  3. package/README.md +1 -1
  4. package/{context → app-context}/AppContext.test.tsx +3 -2
  5. package/{context → app-context}/AppContext.tsx +3 -3
  6. package/{context → app-context}/__snapshots__/AppContext.test.tsx.snap +0 -0
  7. package/components/header/index.tsx +1 -1
  8. package/infrastructure/.circleci/config.yml +1 -0
  9. package/infrastructure/terraform-newrelic/dashboards.tf +176 -0
  10. package/infrastructure/terraform-newrelic/lighthouse-script-prod.js +46 -0
  11. package/infrastructure/terraform-newrelic/lighthouse-script.js +46 -0
  12. package/infrastructure/terraform-newrelic/monitors.tf +12 -0
  13. package/next-env.d.ts +0 -1
  14. package/next.config.js +37 -32
  15. package/package.json +22 -9
  16. package/pages/_app.tsx +38 -1
  17. package/pages/account/cancellation/index.tsx +6 -5
  18. package/pages/account/edit/[field].tsx +11 -2
  19. package/pages/account/index.tsx +9 -2
  20. package/pages/account/newsletters-and-alerts/index.tsx +10 -1
  21. package/pages/account/payment/index.tsx +8 -1
  22. package/pages/account/subscription-and-billing/index.tsx +14 -1
  23. package/pages/checkout/account-creation/index.tsx +8 -1
  24. package/pages/checkout/payment-details/index.tsx +8 -1
  25. package/public/MyAccount/display-personalDetails-header-sun.svg +55 -0
  26. package/public/MyAccount/display-personalDetails-header-times.svg +90 -0
  27. package/public/MyAccount/display-personalDetails-header-vr.svg +46 -0
  28. package/public/MyAccount/navigationPrimary-brandMark-sun.svg +3 -0
  29. package/public/MyAccount/navigationPrimary-brandMark-times.svg +18 -0
  30. package/public/MyAccount/navigationPrimary-brandMark-vr.svg +10 -0
  31. package/public/fonts/GillSansMTStd-Bold.otf +0 -0
  32. package/public/fonts/GillSansMTStd-BoldCondensed.otf +0 -0
  33. package/public/fonts/GillSansMTStd-BoldItalic.otf +0 -0
  34. package/public/fonts/GillSansMTStd-Book.otf +0 -0
  35. package/public/fonts/GillSansMTStd-BookItalic.otf +0 -0
  36. package/public/fonts/GillSansMTStd-Condensed.otf +0 -0
  37. package/public/fonts/GillSansMTStd-ExtraBold.otf +0 -0
  38. package/public/fonts/GillSansMTStd-Heavy.otf +0 -0
  39. package/public/fonts/GillSansMTStd-HeavyItalic.otf +0 -0
  40. package/public/fonts/GillSansMTStd-Light.otf +0 -0
  41. package/public/fonts/GillSansMTStd-LightItalic.otf +0 -0
  42. package/public/fonts/GillSansMTStd-Medium.otf +0 -0
  43. package/public/fonts/GillSansMTStd-MediumItalic.otf +0 -0
  44. package/public/fonts/GillSansMTStd-UltraBold.otf +0 -0
  45. package/public/fonts/GillSansMTStd-UltraBoldCond.otf +0 -0
  46. package/public/fonts/Montserrat-Black.ttf +0 -0
  47. package/public/fonts/Montserrat-BlackItalic.ttf +0 -0
  48. package/public/fonts/Montserrat-Bold.ttf +0 -0
  49. package/public/fonts/Montserrat-BoldItalic.ttf +0 -0
  50. package/public/fonts/Montserrat-ExtraBold.ttf +0 -0
  51. package/public/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
  52. package/public/fonts/Montserrat-ExtraLight.ttf +0 -0
  53. package/public/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
  54. package/public/fonts/Montserrat-Italic.ttf +0 -0
  55. package/public/fonts/Montserrat-Light.ttf +0 -0
  56. package/public/fonts/Montserrat-LightItalic.ttf +0 -0
  57. package/public/fonts/Montserrat-Medium.ttf +0 -0
  58. package/public/fonts/Montserrat-MediumItalic.ttf +0 -0
  59. package/public/fonts/Montserrat-Regular.ttf +0 -0
  60. package/public/fonts/Montserrat-SemiBold.ttf +0 -0
  61. package/public/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
  62. package/public/fonts/Montserrat-Thin.ttf +0 -0
  63. package/public/fonts/Montserrat-ThinItalic.ttf +0 -0
  64. package/public/fonts/TheSun-Bold.ttf +0 -0
  65. package/public/fonts/TheSun-BoldItalic.ttf +0 -0
  66. package/public/fonts/TheSun-HeavyCondensed.ttf +0 -0
  67. package/public/fonts/TheSun-HeavyNarrow.ttf +0 -0
  68. package/public/fonts/TheSun-Italic.ttf +0 -0
  69. package/public/fonts/TheSun-Medium.ttf +0 -0
  70. package/public/fonts/TheSun-MediumItalic.ttf +0 -0
  71. package/public/fonts/TheSun-Regular.ttf +0 -0
  72. package/public/fonts/TimesDigital-Bold.ttf +0 -0
  73. package/public/fonts/TimesDigital-BoldItalic.ttf +0 -0
  74. package/public/fonts/TimesDigital-BoldSC.ttf +0 -0
  75. package/public/fonts/TimesDigital-Italic.ttf +0 -0
  76. package/public/fonts/TimesDigital-Regular.ttf +0 -0
  77. package/public/fonts/TimesDigital-RegularSC.ttf +0 -0
  78. package/public/fonts/TimesDigitalW04-Bold.ttf +0 -0
  79. package/public/fonts/TimesDigitalW04-BoldItalic.ttf +0 -0
  80. package/public/fonts/TimesDigitalW04-BoldSC.ttf +0 -0
  81. package/public/fonts/TimesDigitalW04-Italic.ttf +0 -0
  82. package/public/fonts/TimesDigitalW04-Regular.ttf +0 -0
  83. package/public/fonts/TimesDigitalW04-RegularSC.ttf +0 -0
  84. package/tsconfig.json +1 -1
package/.eslintignore CHANGED
@@ -13,3 +13,4 @@ next-env.d.ts
13
13
  helpers/setupTests.ts
14
14
  newrelic.js
15
15
  infrastructure/helm/*
16
+ infrastructure/terraform-newrelic/*.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,152 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.13.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.13.2...@newskit-render/core@1.13.3) (2022-01-19)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.13.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.13.1...@newskit-render/core@1.13.2) (2022-01-18)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.13.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.13.0...@newskit-render/core@1.13.1) (2022-01-18)
23
+
24
+ **Note:** Version bump only for package @newskit-render/core
25
+
26
+
27
+
28
+
29
+
30
+ # [1.13.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.12.1...@newskit-render/core@1.13.0) (2022-01-14)
31
+
32
+
33
+ ### Features
34
+
35
+ * **PPDSR-604:** Add husky & commitlint ([#558](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/558)) ([c67fc76](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/c67fc76276c8607f7604ae6ac0d0cae1ecb5b4f0))
36
+
37
+
38
+
39
+
40
+
41
+ ## [1.12.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.12.0...@newskit-render/core@1.12.1) (2022-01-13)
42
+
43
+ **Note:** Version bump only for package @newskit-render/core
44
+
45
+
46
+
47
+
48
+
49
+ # [1.12.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.4...@newskit-render/core@1.12.0) (2022-01-13)
50
+
51
+
52
+ ### Features
53
+
54
+ * **PPDSR-632:** Fix newsletter query ([#559](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/559)) ([38085d1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/38085d1418bb42237a41b4bad0394fc8cabdf2a4))
55
+
56
+
57
+
58
+
59
+
60
+ ## [1.11.4](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.3...@newskit-render/core@1.11.4) (2022-01-13)
61
+
62
+ **Note:** Version bump only for package @newskit-render/core
63
+
64
+
65
+
66
+
67
+
68
+ ## [1.11.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.2...@newskit-render/core@1.11.3) (2022-01-11)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * update release cli version ([#556](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/556)) ([d613fe1](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/d613fe1f5b96fc3f66547f2310a12c0b3810e940))
74
+
75
+
76
+
77
+
78
+
79
+ ## [1.11.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.1...@newskit-render/core@1.11.2) (2022-01-11)
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * bump release-cli to latest to fix pipeline ([#554](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/554)) ([46a0c13](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/46a0c13231f89445360126bc596476ca13716b37))
85
+
86
+
87
+
88
+
89
+
90
+ ## [1.11.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.11.0...@newskit-render/core@1.11.1) (2022-01-07)
91
+
92
+ **Note:** Version bump only for package @newskit-render/core
93
+
94
+
95
+
96
+
97
+
98
+ # [1.11.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.10.1...@newskit-render/core@1.11.0) (2022-01-06)
99
+
100
+
101
+ ### Features
102
+
103
+ * **PPDSR-605:** Move PrimaryNavigation to Shared Components ([#550](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/550)) ([fcc1cda](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/fcc1cda59d4cfcc42b1487ee8ba782c7d5f83bb7))
104
+
105
+
106
+
107
+
108
+
109
+ ## [1.10.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.10.0...@newskit-render/core@1.10.1) (2022-01-05)
110
+
111
+ **Note:** Version bump only for package @newskit-render/core
112
+
113
+
114
+
115
+
116
+
117
+ # [1.10.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.3...@newskit-render/core@1.10.0) (2022-01-05)
118
+
119
+
120
+ ### Features
121
+
122
+ * **PPDSR-594:** Add themes to account package ([#538](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/538)) ([e34a53a](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/e34a53a944ae8d1420c27459f1ef5ca3ba4160d0))
123
+
124
+
125
+
126
+
127
+
128
+ ## [1.9.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.2...@newskit-render/core@1.9.3) (2022-01-05)
129
+
130
+ **Note:** Version bump only for package @newskit-render/core
131
+
132
+
133
+
134
+
135
+
136
+ ## [1.9.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.1...@newskit-render/core@1.9.2) (2022-01-04)
137
+
138
+ **Note:** Version bump only for package @newskit-render/core
139
+
140
+
141
+
142
+
143
+
144
+ ## [1.9.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.9.0...@newskit-render/core@1.9.1) (2022-01-04)
145
+
146
+ **Note:** Version bump only for package @newskit-render/core
147
+
148
+
149
+
150
+
151
+
6
152
  # [1.9.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@1.8.0...@newskit-render/core@1.9.0) (2022-01-04)
7
153
 
8
154
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @newskit-render/core
2
2
 
3
- А website blueprint built with Next.js.
3
+ А template website built using Next.js.
4
4
 
5
5
  This package is used by [@newskit-render/create-render-app](https://www.npmjs.com/package/@newskit-render/create-render-app) as a template structure to scaffold the newly created projects which the users of @newskit-render/create-render-app can use and modify for their purposes.
6
6
 
@@ -1,7 +1,8 @@
1
1
  import React from 'react'
2
2
  import { render } from 'react-dom'
3
3
  import { act } from 'react-dom/test-utils'
4
- import { renderCustomLightTheme, renderCustomDarkTheme } from '../theme'
4
+ import { sharedTheme } from '@newskit-render/shared-components'
5
+ import { renderCustomDarkTheme } from '../theme'
5
6
  import { AppContextProvider, AppContext } from './AppContext'
6
7
 
7
8
  const container = document.createElement('div')
@@ -30,7 +31,7 @@ describe('AppContext tests', () => {
30
31
  container
31
32
  )
32
33
 
33
- expect(container.textContent).toBe(JSON.stringify(renderCustomLightTheme))
34
+ expect(container.textContent).toBe(JSON.stringify(sharedTheme))
34
35
  })
35
36
 
36
37
  it('setTheme should switch the theme', () => {
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react'
2
2
  import { UncompiledTheme } from 'newskit'
3
- import { renderCustomLightTheme } from '../theme'
3
+ import { sharedTheme } from '@newskit-render/shared-components'
4
4
 
5
5
  type AppContextType = {
6
6
  theme: UncompiledTheme
@@ -8,11 +8,11 @@ type AppContextType = {
8
8
  }
9
9
 
10
10
  const AppContext = React.createContext({
11
- theme: renderCustomLightTheme,
11
+ theme: sharedTheme,
12
12
  } as AppContextType)
13
13
 
14
14
  const AppContextProvider = ({ children }: { children: JSX.Element }) => {
15
- const [theme, setTheme] = useState(renderCustomLightTheme)
15
+ const [theme, setTheme] = useState(sharedTheme)
16
16
 
17
17
  return (
18
18
  <AppContext.Provider value={{ theme, setTheme }}>
@@ -21,7 +21,7 @@ import { MainGrid } from '../layout/MainGrid'
21
21
  import NewsKitLogoFull from '../common/NewskitLogo'
22
22
  import NewsKitLogoShort from '../common/NewskitLogoShort'
23
23
  import NavLink from '../common/NavLink'
24
- import { AppContext } from '../../context/AppContext'
24
+ import { AppContext } from '../../app-context/AppContext'
25
25
  import { getKey } from '../../helpers/articleUtil'
26
26
  import { handleEnterKeyPress } from '../../helpers/a11y'
27
27
  import { UserData, VxInstance } from '../../helpers/global-types'
@@ -239,6 +239,7 @@ orbs:
239
239
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set envs.TEALIUM_ENV=${TEALIUM_ENV}"' >> $BASH_ENV
240
240
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.NEW_RELIC_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY}"' >> $BASH_ENV
241
241
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.MAIN_GRAPHQL_URL=${MAIN_GRAPHQL_URL}"' >> $BASH_ENV
242
+ echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.MAIN_COOKIE_NAME=${MAIN_COOKIE_NAME}"' >> $BASH_ENV
242
243
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.MAIN_USER_ID=${MAIN_USER_ID}"' >> $BASH_ENV
243
244
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.MAIN_AUDIENCE=${MAIN_AUDIENCE}"' >> $BASH_ENV
244
245
  echo 'export HELM_OPT_SET="$HELM_OPT_SET --set secret.items.MAIN_OAUTH_TOKEN=${MAIN_OAUTH_TOKEN}"' >> $BASH_ENV
@@ -169,3 +169,179 @@ resource "newrelic_one_dashboard" "frontend_dashboard" {
169
169
  }
170
170
  }
171
171
  }
172
+
173
+ resource "newrelic_one_dashboard" "lighthouse_dashboard" {
174
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Dashboard"
175
+
176
+ page {
177
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Metrics Dashboard"
178
+
179
+ widget_billboard {
180
+ title = "Lighthouse Metrics"
181
+ row = 1
182
+ column = 1
183
+ height = 3
184
+ width = 4
185
+
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'"
188
+ }
189
+ }
190
+
191
+ widget_line {
192
+ title = "Lighthouse Metrics-trending"
193
+ row = 1
194
+ column = 5
195
+ height = 3
196
+ width = 8
197
+
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"
200
+ }
201
+ }
202
+
203
+ widget_bar {
204
+ title = "First Contentful Paint"
205
+ row = 4
206
+ column = 1
207
+ height = 3
208
+ width = 4
209
+
210
+ nrql_query {
211
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url"
212
+ }
213
+ }
214
+
215
+ widget_line {
216
+ title = "First Contentful Paint"
217
+ row = 4
218
+ column = 5
219
+ height = 3
220
+ width = 8
221
+
222
+ nrql_query {
223
+ query = "FROM SyntheticCheck SELECT average(custom.firstContentfulPaint) FACET custom.url TIMESERIES AUTO"
224
+ }
225
+ }
226
+
227
+ widget_bar {
228
+ title = "Largest Contentful Paint"
229
+ row = 7
230
+ column = 1
231
+ height = 3
232
+ width = 4
233
+
234
+ nrql_query {
235
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url"
236
+ }
237
+ }
238
+
239
+ widget_line {
240
+ title = "Largest Contentful Paint"
241
+ row = 7
242
+ column = 5
243
+ height = 3
244
+ width = 8
245
+
246
+ nrql_query {
247
+ query = "FROM SyntheticCheck SELECT average(custom.largestContentfulPaint) FACET custom.url TIMESERIES AUTO"
248
+ }
249
+ }
250
+
251
+ widget_bar {
252
+ title = "TTI"
253
+ row = 10
254
+ column = 1
255
+ height = 3
256
+ width = 4
257
+
258
+ nrql_query {
259
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) as 'TTI' FACET custom.url"
260
+ }
261
+ }
262
+
263
+ widget_line {
264
+ title = "TTI - trending"
265
+ row = 10
266
+ column = 5
267
+ height = 3
268
+ width = 8
269
+
270
+ nrql_query {
271
+ query = "FROM SyntheticCheck SELECT average(custom.interactive) FACET custom.url TIMESERIES AUTO"
272
+ }
273
+ }
274
+
275
+ widget_bar {
276
+ title = "Total Blocking Time (TBT)"
277
+ row = 13
278
+ column = 1
279
+ height = 3
280
+ width = 4
281
+
282
+ nrql_query {
283
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url"
284
+ }
285
+ }
286
+
287
+ widget_line {
288
+ title = "Total Blocking Time (TBT) - trending"
289
+ row = 13
290
+ column = 5
291
+ height = 3
292
+ width = 8
293
+
294
+ nrql_query {
295
+ query = "FROM SyntheticCheck SELECT average(custom.totalBlockingTime) FACET custom.url TIMESERIES AUTO"
296
+ }
297
+ }
298
+
299
+ widget_bar {
300
+ title = "Cumulative Layout Shift (CLS)"
301
+ row = 16
302
+ column = 1
303
+ height = 3
304
+ width = 4
305
+
306
+ nrql_query {
307
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url"
308
+ }
309
+ }
310
+
311
+ widget_line {
312
+ title = "Cumulative Layout Shift (CLS)"
313
+ row = 16
314
+ column = 5
315
+ height = 3
316
+ width = 8
317
+
318
+ nrql_query {
319
+ query = "FROM SyntheticCheck SELECT average(custom.cumulativeLayoutShift) FACET custom.url TIMESERIES AUTO"
320
+ }
321
+ }
322
+
323
+ widget_bar {
324
+ title = "Speed Index"
325
+ row = 19
326
+ column = 1
327
+ height = 3
328
+ width = 4
329
+
330
+ nrql_query {
331
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url"
332
+ }
333
+ }
334
+
335
+ widget_line {
336
+ title = "Speed Index - trading"
337
+ row = 19
338
+ column = 5
339
+ height = 3
340
+ width = 8
341
+
342
+ nrql_query {
343
+ query = "FROM SyntheticCheck SELECT average(custom.speedIndex) FACET custom.url TIMESERIES AUTO"
344
+ }
345
+ }
346
+ }
347
+ }
@@ -0,0 +1,46 @@
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.prod.ceng.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
+ })
@@ -0,0 +1,46 @@
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
+ })
@@ -0,0 +1,12 @@
1
+ resource "newrelic_synthetics_monitor" "lighthouse-monitor" {
2
+ name = "${data.newrelic_entity.render_app.name} Lighthouse Monitor"
3
+ type = "SCRIPT_API"
4
+ frequency = 30
5
+ status = "ENABLED"
6
+ locations = ["AWS_EU_WEST_2"]
7
+ }
8
+
9
+ resource "newrelic_synthetics_monitor_script" "lighthouse-script" {
10
+ monitor_id = newrelic_synthetics_monitor.lighthouse-monitor.id
11
+ text = "${var.environment}" == "prod" ? file("${path.module}/lighthouse-script-prod.js") : file("${path.module}/lighthouse-script.js")
12
+ }
package/next-env.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /// <reference types="next" />
2
- /// <reference types="next/types/global" />
3
2
  /// <reference types="next/image-types/global" />
4
3
 
5
4
  // NOTE: This file should not be edited
package/next.config.js CHANGED
@@ -5,38 +5,43 @@ const withTM = require('next-transpile-modules')([
5
5
  '@newskit-render/my-account',
6
6
  '@newskit-render/validation',
7
7
  ])
8
+ const withBundleAnalyzer = require('@next/bundle-analyzer')({
9
+ enabled: process.env.ANALYZE === 'true',
10
+ })
8
11
 
9
- module.exports = withTM({
10
- webpack: (config, options) => {
11
- if (options.isServer) {
12
- config.externals = ['react', ...config.externals]
13
- }
12
+ module.exports = withBundleAnalyzer(
13
+ withTM({
14
+ webpack: (config, options) => {
15
+ if (options.isServer) {
16
+ config.externals = ['react', ...config.externals]
17
+ }
14
18
 
15
- config.resolve.alias.newskit = path.resolve(
16
- __dirname,
17
- '.',
18
- 'node_modules',
19
- 'newskit'
20
- )
21
- config.resolve.alias.react = path.resolve(
22
- __dirname,
23
- '.',
24
- 'node_modules',
25
- 'react'
26
- )
19
+ config.resolve.alias.newskit = path.resolve(
20
+ __dirname,
21
+ '.',
22
+ 'node_modules',
23
+ 'newskit'
24
+ )
25
+ config.resolve.alias.react = path.resolve(
26
+ __dirname,
27
+ '.',
28
+ 'node_modules',
29
+ 'react'
30
+ )
27
31
 
28
- return config
29
- },
30
- async rewrites() {
31
- return [
32
- {
33
- source: '/sitemap.xml',
34
- destination: '/api/sitemap',
35
- },
36
- {
37
- source: '/news-sitemap.xml',
38
- destination: '/api/news-sitemap',
39
- },
40
- ]
41
- },
42
- })
32
+ return config
33
+ },
34
+ async rewrites() {
35
+ return [
36
+ {
37
+ source: '/sitemap.xml',
38
+ destination: '/api/sitemap',
39
+ },
40
+ {
41
+ source: '/news-sitemap.xml',
42
+ destination: '/api/news-sitemap',
43
+ },
44
+ ]
45
+ },
46
+ })
47
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "1.9.0",
3
+ "version": "1.13.3",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -24,17 +24,20 @@
24
24
  "pact:test": "NEWSKIT_API_ENV_URL='http://localhost:4343' jest --config=jest.config.pact.js",
25
25
  "pact:publish": "pact-broker publish ./__pacts__/pacts --consumer-app-version=$(git describe --match '*core*' --abbrev=0) --tag='dev' --broker-base-url=$PACT_BROKER_URL --broker-token=$PACT_BROKER_TOKEN",
26
26
  "lint": "eslint --ext .js,.jsx,.ts,.tsx . --color && prettier --check './**/*.{js,jsx,ts,tsx,json}'",
27
- "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'"
27
+ "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'",
28
+ "precommit:lint": "eslint",
29
+ "precommit": "lint-staged",
30
+ "analyze": "ANALYZE=true next build"
28
31
  },
29
32
  "dependencies": {
30
33
  "@apollo/client": "^3.4.16",
31
- "@newskit-render/api": "^0.5.0",
32
- "@newskit-render/auth": "^0.22.2",
33
- "@newskit-render/checkout": "^0.9.0",
34
- "@newskit-render/my-account": "^0.116.1",
35
- "@newskit-render/shared-components": "^0.20.0",
36
- "@newskit-render/sitemap": "^0.25.2",
37
- "@newskit-render/validation": "^0.27.0",
34
+ "@newskit-render/api": "^0.8.0",
35
+ "@newskit-render/auth": "^0.25.0",
36
+ "@newskit-render/checkout": "^0.15.0",
37
+ "@newskit-render/my-account": "^0.123.0",
38
+ "@newskit-render/shared-components": "^0.25.0",
39
+ "@newskit-render/sitemap": "^0.28.0",
40
+ "@newskit-render/validation": "^0.30.0",
38
41
  "cross-fetch": "^3.1.4",
39
42
  "graphql": "^15.6.0",
40
43
  "newrelic": "^7.1.0",
@@ -48,6 +51,7 @@
48
51
  "devDependencies": {
49
52
  "@apollo/react-testing": "^4.0.0",
50
53
  "@emotion/jest": "^11.3.0",
54
+ "@next/bundle-analyzer": "^12.0.8",
51
55
  "@pact-foundation/pact": "^9.12.1",
52
56
  "@testing-library/jest-dom": "^5.11.4",
53
57
  "@testing-library/react": "^11.0.2",
@@ -75,6 +79,7 @@
75
79
  "jest": "^27.2.4",
76
80
  "jest-junit": "^12.0.0",
77
81
  "jest-watch-typeahead": "^0.6.3",
82
+ "lint-staged": "^12.1.7",
78
83
  "next-transpile-modules": "^8.0.0",
79
84
  "prettier": "^2.0.5",
80
85
  "prettier-eslint": "^11.0.0",
@@ -83,6 +88,14 @@
83
88
  "typescript": "^4.4.3",
84
89
  "wait-on": "^5.3.0"
85
90
  },
91
+ "precommit": [
92
+ "precommit"
93
+ ],
94
+ "lint-staged": {
95
+ "**/*.(ts|tsx)": [
96
+ "yarn run precommit:lint"
97
+ ]
98
+ },
86
99
  "publishConfig": {
87
100
  "access": "public"
88
101
  },