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

Commit

Permalink
rebase strapi to master (#5626)
Browse files Browse the repository at this point in the history
* rebase strapi to master

* build issues

* fix

* check is data change from strapi

* fix

* fix

* fix

* fix

* fix

* test data

* test data

* test data

* chore: empty commit

* triger

* fix

* added secrets on ymls

* message.json

* message.json

* fix

---------

Co-authored-by: Eduard Hrachou <[email protected]>
  • Loading branch information
eduard-deriv and Eduard Hrachou authored Sep 21, 2023
1 parent 0ba2376 commit 9a1a9f9
Show file tree
Hide file tree
Showing 59 changed files with 1,262 additions and 1,378 deletions.
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }}
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
GATSBY_RUDDERSTACK_URL: ${{ secrets.GATSBY_RUDDERSTACK_URL }}
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}

jobs:
release-production:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
GATSBY_RUDDERSTACK_STAGING_KEY: ${{ secrets.GATSBY_RUDDERSTACK_STAGING_KEY }}
GATSBY_RUDDERSTACK_PRODUCTION_KEY: ${{ secrets.GATSBY_RUDDERSTACK_PRODUCTION_KEY }}
GATSBY_RUDDERSTACK_URL: ${{ secrets.GATSBY_RUDDERSTACK_URL }}
GATSBY_STRAPI_TOKEN: ${{ secrets.GATSBY_STRAPI_TOKEN }}

jobs:
release-staging:
Expand Down
23 changes: 23 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ const href = isBrowser && window.location.href
const site_url =
origin === 'https://deriv.com' || origin === 'https://eu.deriv.com' ? href : 'https://deriv.com'

const strapi_preview_param = {
publicationState: 'live',
}

const strapi_config = [
{
singularName: 'who-we-are-page',
queryParams: strapi_preview_param,
},
{
singularName: 'cfd-warning-banner',
queryParams: strapi_preview_param,
},
]

module.exports = {
// pathPrefix: process.env.PATH_PREFIX || '/deriv-com/', // For non CNAME GH-pages deployment
flags: {
Expand Down Expand Up @@ -352,6 +367,14 @@ module.exports = {
generateStatsFile: process.env.GENERATE_JSON_STATS === 'true',
},
},
{
resolve: 'gatsby-source-strapi',
options: {
apiURL: 'https://chief-skinny-instrument.strapiapp.com',
accessToken: process.env.GATSBY_STRAPI_TOKEN,
collectionTypes: strapi_config,
},
},
{
resolve: 'gatsby-plugin-env-variables',
options: {
Expand Down
65 changes: 62 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"gatsby-plugin-svgr": "^3.0.0-beta.0",
"gatsby-plugin-use-query-params": "^1.0.1",
"gatsby-source-filesystem": "^5.11.0",
"gatsby-source-strapi": "^3.3.1",
"gatsby-transformer-sharp": "^5.11.0",
"i18next": "^21.6.5",
"install": "^0.13.0",
Expand Down
17 changes: 14 additions & 3 deletions scripts/extract-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const fs = require('fs')
const glob = require('glob')
const translated_keys = require('../src/translations/ach.json')
const DISABLE_TRANSLATION = 'disable-translation'
const strap_data = require('../public/page-data/404/page-data.json')



Expand Down Expand Up @@ -72,11 +73,17 @@ const new_find_keys = (file) => {
*/
extractTranslations();

function getStrapiStrings(strapi_obj_data) {
return strapi_obj_data instanceof Array ? strapi_obj_data.map((array) => getStrapiStrings(array)).flat() :
strapi_obj_data instanceof Object ? Object.values(strapi_obj_data).map((object) => getStrapiStrings(object)).flat() :
strapi_obj_data;
}

function extractTranslations() {
(async () => {
try {
const file_paths = [];
const messages = [];
const pre_messages = [];
const messages_json = {};

// Find all file types listed in `globs`
Expand All @@ -94,13 +101,17 @@ function extractTranslations() {
try {
const file = fs.readFileSync(file_paths[i], 'utf8');
if (!file.includes(DISABLE_TRANSLATION)) {
messages.push(...old_find_keys(file));
messages.push(...new_find_keys(file))
pre_messages.push(...old_find_keys(file));
pre_messages.push(...new_find_keys(file))
}
} catch (e) {
console.log(e);
}
}

const data_from_strapi = getStrapiStrings(strap_data.result.data.strapiWhoWeArePage)
const messages = new Array(...pre_messages, ...data_from_strapi)

const untranslated = []
// Hash the messages and set the key-value pair for json
for (let i = 0; i < messages.length; i++) {
Expand Down
2 changes: 0 additions & 2 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ export const live_chat_key = 'live_chat_redirection'
export const reddit_url = 'https://www.reddit.com/user/Deriv_official/'
export const telegram_url = 'https://t.me/derivdotcomofficial'
export const youtube_url = 'https://www.youtube.com/@deriv'
export const loss_percent = 72

export const contact_us_form_post_data = 'https://formkeep.com/f/7f4b8b55f10f'

export const cookie_key = 'browser_update_alert_modal_shown'
Expand Down
Loading

1 comment on commit 9a1a9f9

@vercel
Copy link

@vercel vercel bot commented on 9a1a9f9 Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-com – ./

deriv-com-git-master.binary.sx
deriv-com.binary.sx

Please sign in to comment.