Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
chore: resolved issues from master
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-deriv committed Jan 4, 2024
2 parents 522c753 + 638d5b0 commit c227389
Show file tree
Hide file tree
Showing 244 changed files with 12,268 additions and 12,348 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate-preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }}

GATSBY_TRUSTPILOT_API_KEY: ${{ secrets.GATSBY_TRUSTPILOT_API_KEY }}
run: npm run build

- name: Publish to Cloudflare Pages
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/pre-generate-preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@ permissions:
on:
pull_request:
types: [opened, synchronize]

concurrency:
group: cloudflare-pages-verify-${{ github.head_ref }}
group: 'cloudflare-pages-verify-${{ github.head_ref }}'
cancel-in-progress: true

jobs:
verify_pull_request:
runs-on: Ubuntu-latest
steps:
- name: Retrieve PR information
env:
EVENT_NUMBER: ${{ github.event.number }}
EVENT_USERNAME: ${{ github.event.pull_request.user.login }}
HEAD_REF: ${{ github.head_ref }}
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
echo ${{ github.event.pull_request.user.login }} > ./pr/USERNAME
echo ${{ github.head_ref }} > ./pr/BRANCHNAME
echo "$EVENT_NUMBER" > ./pr/NR
echo "$EVENT_USERNAME" > ./pr/USERNAME
echo "$HEAD_REF" > ./pr/BRANCHNAME
- name: Upload PR information to artifact
env:
RUN_ID: ${{ github.run_id }}
uses: actions/upload-artifact@v2
with:
name: 'pr-${{github.run_id}}'
name: 'pr-${{ env.RUN_ID }}'
path: pr/
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }}
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }}
GATSBY_TRUSTPILOT_API_KEY: ${{ secrets.GATSBY_TRUSTPILOT_API_KEY }}

jobs:
release-production:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/smoketests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
if: "!contains(steps.pr_information.outputs.branch_name, 'translation-new-homepage')"
if: "!contains(steps.pr_information.outputs.branch_name, 'quill')"
uses: cypress-io/github-action@v6
with:
# Records to Cypress Cloud
Expand All @@ -71,7 +71,7 @@ jobs:

- name: Set comments message
id: set_msg
if: always() && !contains(steps.pr_information.outputs.branch_name, 'translation-new-homepage')
if: always() && !contains(steps.pr_information.outputs.branch_name, 'quill')
run: |
# Using shell script to conditionally set the message
if [[ "${{ job.status }}" == "success" ]]; then
Expand All @@ -81,7 +81,7 @@ jobs:
fi
- name: Leave comment
if: always() && !contains(steps.pr_information.outputs.branch_name, 'translation-new-homepage')
if: always() && !contains(steps.pr_information.outputs.branch_name, 'quill')
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Smoke tests status update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}
GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID: ${{ secrets.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID }}

GATSBY_TRUSTPILOT_API_KEY: ${{ secrets.GATSBY_TRUSTPILOT_API_KEY }}
jobs:
release-staging:
timeout-minutes: 30
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/translation-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ jobs:
sudo apt install gh
gh auth login --with-token <<< ${{ github.token }}
gh pr close "$branch_name" || true
pr_output=$(gh pr create --base "master" --title "[translations] New strings from crowdin 📚" --head "binary-com:$branch_name" -F ".github/translation_sync_template.md")
echo "PR_URL=$pr_output" >> $GITHUB_ENV
fi
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ static/CNAME

#Webpack
webpack-bundle-report

static/~partytown
246 changes: 178 additions & 68 deletions crowdin/messages.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import {
getLanguage,
updateURLAsPerUserLanguage,
} from 'common/utility'
import './static/css/ibm-plex-sans-var.css'
import './static/css/noto-sans-arabic.css'
import './static/css/ubuntu.css'
import './static/css/global.css'
import '@deriv-com/blocks/style.css'
import '@deriv-com/components/style.css'

const is_browser = typeof window !== 'undefined'

Expand Down Expand Up @@ -91,8 +93,7 @@ export const onClientEntry = () => {
Analytics?.initialise({
growthbookKey: process.env.GATSBY_GROWTHBOOK_CLIENT_KEY,
growthbookDecryptionKey: process.env.GATSBY_GROWTHBOOK_DECRYPTION_KEY,
enableDevMode: window?.location.hostname.includes('localhost'),
rudderstackKey: ['.pages.dev', 'git-fork', 'localhost'].some((condition) =>
rudderstackKey: ['.pages.dev', 'git-fork', 'localhost', 'staging'].some((condition) =>
window.location.hostname.includes(condition),
)
? process.env.GATSBY_RUDDERSTACK_STAGING_KEY
Expand All @@ -104,8 +105,7 @@ export const onClientEntry = () => {
device_language: navigator?.language || ' ',
device_type: isMobile ? 'mobile' : 'desktop',
})
const { tracking } = Analytics.getInstances()
tracking.identifyEvent(Analytics?.getId(), { language: getLanguage() })
Analytics?.identifyEvent()
//datadog
const dd_options = {
clientToken: process.env.GATSBY_DATADOG_CLIENT_TOKEN,
Expand Down
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = {
// // precachePages: [`/`],
// },
// },
'gatsby-plugin-postcss',
{
resolve: 'gatsby-plugin-sass',
options: {
Expand Down
49 changes: 44 additions & 5 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ exports.onPreBuild = async () => {
await copyLibFiles(path.join(__dirname, 'static', '~partytown'))
}
// Based upon https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n
exports.onCreatePage = ({ page, actions }) => {
const { createRedirect, createPage, deletePage } = actions

// First delete the incoming page that was automatically created by Gatsby
// So everything in src/pages/
deletePage(page)
const BuildPage = (page, actions) => {
const { createRedirect, createPage } = actions
const is_responsible_trading = /responsible/g.test(page.path)
const is_contact_us = /contact_us/g.test(page.path)
const is_careers = /careers/g.test(page.path)
Expand Down Expand Up @@ -349,6 +346,48 @@ exports.onCreatePage = ({ page, actions }) => {
return current_page
})
}
exports.onCreatePage = ({ page, actions }) => {
const { deletePage } = actions
const isProduction = process.env.GATSBY_ENV === 'production'
const pagesToBuild = process.env.GATSBY_BUILD_PAGES || 'all'

// First delete the incoming page that was automatically created by Gatsby
// So everything in src/pages/
deletePage(page)

const pagesCategory = {
all: [''],
'no-affiliates': ['signup-affiliates', 'landing', 'ctrader', 'partners'],
'no-help-centre': ['help-centre'],
'no-tools': ['trader-tools'],
fast: [
'signup-affiliates',
'landing',
'ctrader',
'partners',
'help-centre',
'trader-tools',
'careers',
// 'markets',
// 'trade-types' Note: Feel free to adjust pages you want to skip building for faster local development
],
}

const disallowedPages = pagesCategory[pagesToBuild] || []

const regex = new RegExp(`/${disallowedPages.join('|') + '|'}/g`)

const isMatch = regex.test(page.path)

if (isProduction) {
return BuildPage(page, actions)
} else {
if (!isMatch || pagesToBuild === 'all') {
console.log(`\x1b[32mcreating\x1b[0m [${pagesToBuild}] ${page.path}`)

Check warning on line 386 in gatsby-node.js

View workflow job for this annotation

GitHub Actions / ESLint

gatsby-node.js#L386

Unexpected console statement (no-console)
return BuildPage(page, actions)
}
}
}

const StylelintPlugin = require('stylelint-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
Expand Down
Loading

0 comments on commit c227389

Please sign in to comment.