From 8942b2cb198b1cc097830ccee8280817e199d454 Mon Sep 17 00:00:00 2001 From: prince-deriv <82309725+prince-deriv@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:37:06 +0400 Subject: [PATCH] chore: remove trustpilot fetch (#7818) --- crowdin/messages.json | 2 +- themes/gatsby-theme-deriv/gatsby-node.js | 59 +++++++++--------------- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/crowdin/messages.json b/crowdin/messages.json index 240fc5c1d99..15e15df7f21 100644 --- a/crowdin/messages.json +++ b/crowdin/messages.json @@ -4304,7 +4304,7 @@ "-204765990": "Terms of use", "-26610045": "Add an affiliate account", "-435672026": "Wrong email", - "-37998160": "Please enter 3-20 Latin characters, numbers.", + "-1631852396": "Please enter 3-30 Latin characters, numbers.", "-1458676679": "You should enter 2-50 characters.", "-442533603": "Incorrect company name", "-859572487": "You should enter 2-20 characters.", diff --git a/themes/gatsby-theme-deriv/gatsby-node.js b/themes/gatsby-theme-deriv/gatsby-node.js index 4c563623f05..9c5ce53d66c 100644 --- a/themes/gatsby-theme-deriv/gatsby-node.js +++ b/themes/gatsby-theme-deriv/gatsby-node.js @@ -5,8 +5,8 @@ const path = require('path') const { exec } = require('child_process') const StylelintPlugin = require('stylelint-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') -const minify = require('html-minifier').minify; -const fs = require('fs'); +const minify = require('html-minifier').minify +const fs = require('fs') const translations_cache = {} @@ -23,20 +23,6 @@ function OSFunction() { } } -const fetchTrustpilotData = () => { - // Trustpilot on-build data fetching - const os = new OSFunction() - - os.execCommand('node scripts/trustpilot.js', (returnvalue) => { - console.log(returnvalue) - }) -} - -exports.onPreInit = () => { - // Update truspilot.json file with latest data - fetchTrustpilotData() -} - // Based upon https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n const BuildPage = (page, actions, region) => { @@ -377,7 +363,7 @@ const BuildPage = (page, actions, region) => { } exports.onCreatePage = ({ page, actions }, options) => { const { deletePage } = actions - const {region} = options; + const { region } = options const isProduction = process.env.GATSBY_ENV === 'production' const pagesToBuild = process.env.GATSBY_BUILD_PAGES if (pagesToBuild) { @@ -494,32 +480,29 @@ const minificationOptions = { useShortDoctype: true, } -exports.onPostBuild = (_, {buildDirPath}) => { +exports.onPostBuild = (_, { buildDirPath }) => { return new Promise((resolve, reject) => { // do async work - console.log('=== HMTL minification started ==='); + console.log('=== HMTL minification started ===') - console.log('full path', buildDirPath); + console.log('full path', buildDirPath) fs.readFile(buildDirPath, 'utf8', (err, inp) => { if (err) { - reject(); - throw err; + reject() + throw err } - var result = minify(inp, minificationOptions); - var reducedPercentage = ( - ((inp.length - result.length) / inp.length) * - 100 - ).toFixed(2); - console.log(`We have reduced index.html by ${reducedPercentage}%`); - - fs.writeFile(buildDirPath, result, err2 => { + var result = minify(inp, minificationOptions) + var reducedPercentage = (((inp.length - result.length) / inp.length) * 100).toFixed(2) + console.log(`We have reduced index.html by ${reducedPercentage}%`) + + fs.writeFile(buildDirPath, result, (err2) => { if (err2) { - reject(); - throw err; + reject() + throw err } - console.log('index.html has been saved!'); - resolve(); - }); - }); - }); -}; + console.log('index.html has been saved!') + resolve() + }) + }) + }) +}