Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 76bb3ef

Browse files
committed
Merge branch 'master' of https://github.com/binary-com/deriv-com into blog-homepage-video-banner
2 parents 11bb1d1 + c652259 commit 76bb3ef

File tree

117 files changed

+18990
-46481
lines changed

Some content is hidden

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

117 files changed

+18990
-46481
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
}
9393
},
9494
"react": {
95-
"version": "16"
95+
"version": "17"
9696
}
9797
}
9898
}

gatsby-browser.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { isProduction, isLive, isLocalHost } from './src/common/websocket/config
77
import { LocalStore } from './src/common/storage'
88
import { MediaContextProvider } from './src/themes/media'
99
import { DerivProvider } from './src/store'
10+
import { checkLiveChatRedirection } from './src/common/live-chat-redirection-checking.js'
1011
import { getClientInformation, getDomain, getLanguage } from 'common/utility'
1112
import {
1213
application_id,
@@ -77,18 +78,21 @@ const pushwooshInit = (push_woosh) => {
7778
safariWebsitePushID: 'web.com.deriv',
7879
defaultNotificationTitle: 'Deriv.com',
7980
defaultNotificationImage: 'https://deriv.com/favicons/favicon-192x192.png',
80-
autoSubscribe: true,
8181
},
8282
])
8383

8484
push_woosh.push([
8585
'onReady',
8686
function (api) {
87-
push_woosh.isSubscribed().then((is_subscribed) => {
88-
if (!is_subscribed) {
89-
push_woosh.subscribe()
90-
}
91-
})
87+
try {
88+
push_woosh.isSubscribed().then((is_subscribed) => {
89+
if (!is_subscribed) {
90+
push_woosh.subscribe()
91+
}
92+
})
93+
// eslint-disable-next-line no-empty
94+
} catch {}
95+
9296
sendTags(api)
9397
},
9498
])
@@ -168,6 +172,8 @@ export const onClientEntry = () => {
168172
sampleRate: sample_rate,
169173
})
170174
}
175+
176+
checkLiveChatRedirection()
171177
}
172178

173179
export const onPreRouteUpdate = () => {

gatsby-config.js

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ const language_config = require(`./i18n-config.js`)
22

33
module.exports = {
44
// pathPrefix: process.env.PATH_PREFIX || '/deriv-com/', // For non CNAME GH-pages deployment
5+
flags: {
6+
FAST_DEV: true,
7+
PRESERVE_WEBPACK_CACHE: true,
8+
},
59
siteMetadata: {
610
title: 'Deriv',
711
description:
@@ -20,7 +24,17 @@ module.exports = {
2024
},
2125
},
2226
'gatsby-transformer-sharp',
23-
'gatsby-plugin-sharp',
27+
{
28+
resolve: `gatsby-plugin-sharp`,
29+
options: {
30+
failOnError: true,
31+
base64Width: 20,
32+
forceBase64Format: 'webp',
33+
stripMetadata: true,
34+
defaultQuality: 50,
35+
},
36+
},
37+
`gatsby-plugin-image`,
2438
{
2539
resolve: 'gatsby-plugin-sitemap',
2640
options: {
@@ -57,7 +71,7 @@ module.exports = {
5771
],
5872
serialize: ({ site, allSitePage }) =>
5973
allSitePage.edges.map((edge) => {
60-
const ignore_localized_regex = /careers/;
74+
const ignore_localized_regex = /careers/
6175
const path = edge.node.path
6276
let priority = 0.7
6377
const languages = Object.keys(language_config)
@@ -85,12 +99,12 @@ module.exports = {
8599

86100
languages.push('x-default')
87101
languages.splice(languages.indexOf('ach'), 1)
88-
const ignore_localized = current_page.match(ignore_localized_regex);
102+
const ignore_localized = current_page.match(ignore_localized_regex)
89103
const links = languages.map((locale) => {
90104
if (locale !== 'ach' && locale) {
91105
const replaced_locale = locale.replace('_', '-')
92106
const is_default = locale === 'en' || locale === 'x-default'
93-
const href_locale = (is_default) ? '' : `/${replaced_locale}`
107+
const href_locale = is_default ? '' : `/${replaced_locale}`
94108
const href = `${site.siteMetadata.siteUrl}${href_locale}${current_page}`
95109
return { lang: replaced_locale, url: href }
96110
}
@@ -160,14 +174,6 @@ module.exports = {
160174
exclude: ['node_modules', '.cache', 'public'],
161175
},
162176
},
163-
{
164-
resolve: 'gatsby-plugin-stylelint',
165-
options: {
166-
emitErrors: false,
167-
files: ['src/**/*.js'],
168-
lintDirtyModulesOnly: true,
169-
},
170-
},
171177
{
172178
resolve: 'gatsby-plugin-robots-txt',
173179
options: {
@@ -196,21 +202,11 @@ module.exports = {
196202
includeInDevelopment: false,
197203
},
198204
},
199-
'gatsby-plugin-remove-serviceworker',
200205
{
201206
resolve: 'gatsby-plugin-anchor-links',
202207
options: {
203208
offset: -100,
204209
},
205210
},
206-
{
207-
resolve: 'gatsby-plugin-webpack-bundle-analyser-v2',
208-
options: {
209-
production: true,
210-
disable: !process.env.ANALYZE_BUNDLE_SIZE,
211-
generateStatsFile: true,
212-
analyzerMode: 'static',
213-
},
214-
},
215211
],
216212
}

gatsby-node.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable import/order */
12
const language_config = require(`./i18n-config.js`)
23
const path = require('path')
34

@@ -235,10 +236,21 @@ exports.onCreatePage = ({ page, actions }) => {
235236
})
236237
}
237238

238-
exports.onCreateWebpackConfig = ({ actions, getConfig }) => {
239+
const StylelintPlugin = require('stylelint-webpack-plugin')
240+
const TerserPlugin = require('terser-webpack-plugin')
241+
const style_lint_options = {
242+
files: 'src/**/*.js',
243+
emitErrors: false,
244+
lintDirtyModulesOnly: true,
245+
}
246+
247+
exports.onCreateWebpackConfig = ({ actions, getConfig }, { ...options }) => {
239248
const config = getConfig()
240-
if (config.optimization) config.optimization.minimizer[0].options.parallel = 2
249+
if (config.optimization) {
250+
config.optimization.minimizer = [new TerserPlugin()]
251+
}
241252
actions.setWebpackConfig({
253+
plugins: [new StylelintPlugin({ ...style_lint_options, ...options })],
242254
resolve: {
243255
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
244256
},

0 commit comments

Comments
 (0)