Deriv.com - An online trading platform that offers a wide selection of derivatives to trade on 24/7.
- Other documents
- Pre-installation
- Quick start
- How to contribute
- PR Formating guideline
- PR without translations
- PR with translations
- Manage releases
- Test link deployment
- FAQ
- General implementation - Contain ways to do development in deriv.com
- Development guidelines - Contain advice for developers working on this project
- Git best practice - Contain git practices and commit guidelines
- File structures
- GTM workflow - Contains Google Tag Manager workflow and additional information
- Translation workflow - Contains general workflow and commands required for our translation process
- Typescript guidelines - Contains Typescript guidelines and conventions for this project
Before running or contribute to this project, you need to have the setup of the following packages in your environment
- node >=18.12.1
- npm >=8.19.2
- git (for
contribution
) - gatsby-cli (npm install -g gatsby-cli) (for using commands that aren't listed in scripts)
Moreover, having these extensions will help you to speed up the development process and adhere to the best practices
- Prettier: setup in your editor https://prettier.io/ (or you can run
npm run format
. Installation guide for VS Code - https://www.codementor.io/@myogeshchavan97/how-to-automatically-format-code-in-visual-studio-code-using-prettier-1nebhfbxak WebStorm - https://www.jetbrains.com/help/webstorm/prettier.html#prettier_before_you_start - Stylelint: setup in your editor https://stylelint.io/ (or you can run
npm run stylelint
) - Eslint: setup in your editor https://eslint.org/ (or you can run
npm run eslint
)
-
Fork the project
In order to work on your own version of the Deriv application, please fork the project to your own repo.
-
Clone using SSH
git clone [email protected]:your-github-username/deriv-com.git
-
Enter project directory
cd deriv-com
-
Install your dependencies:
npm ci
-
Add env variables:
Create two files
.env.development
and.env.production
inside your project root directory.Then check your lastpass you'll see a shared item named Deriv-com Env Variables copy the variables, they look like this:
And paste them into the files.
-
To start developing:
npm start
-
Open the source code and start editing!
Your site is now running at
http://localhost:8000
!Note: You'll also see a second link:
http://localhost:8000/___graphql
. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.
To contribute in the project, we need to create PRs to master. We have two types of PRs (Pull request):
- Use the
{Developer}/{Clickup Card ID}/{Description}
format for PR titles. (e.g.:[Dev's Name]/COJ-247/Align next-button on mt5 modal
). - Start the description with a verb in an imperative declaration for clarity and conciseness. For example, "Fix issue with..." or "Implement feature to...".
- Add screenshots of change for easier reviewing (whenever applicable) and brief description
- Use Draft PRs if you don't mean to request for reviews yet. Read more here.
PR will be based on the master branch if the commits are not having text changes
-
Create branch from the latest master branch
git checkout master git pull upstream master git checkout -b [_your_branch_name]
-
Make your changes
-
Make pull request following PR formatting guidelines.
-
Push your changes to your origin , add
-u
flag for the first time pushgit push -u origin [_your_branch_name]
-
Click on the autogenerated link from the terminal to open the PR
-
Make sure to change the PR base to
master
branch
-
Pre-requisite:
-
Install crowdin-cli
brew tap crowdin/crowdin brew install crowdin
-
Set up your Crowdin API KEY in your .bash_profile or .zshrc
-
-
Creating Branch
npm run branch:create
Proceed by choosing Normal Translation
-
Download Translations
npm run translation:pull
This command will trigger the workflow to pull latest translation from the specific branch and automatically add the commit to that PR.
-
Push the changes in the PR
-
Conflicts on message.json file
Don't worry it's easy to resolve, you can either resolve it using your changes or their changes doesn't matter because after you commit, it will again generate an updated messages.json file based on your current code, as long as you have all the changes from the master you are good to go.
Pulled the translations but strings are still not translated First you need to check if you have all the translations in your codebase. Search for the string and copy the corresponding hashed value for the string, can be found on messages.json
Now search the whole codebase using the hash, if json files for each languages appeared on your search results then you check if the values are not in English. Once the translations are proven to be there, you need to check where the strings are used Usually if your are using localize function when not in the react component it is failing to translate strings properly, you can convert them to instead
There are 2 types of releases:
- Release to staging:
Merging to master (squash and merge) will automatically release the last commit to the staging server https://staging.deriv.com
- Release to production:
Releasing to production requires a tag using the following format:
production_VYYYYMMDD_${Integer}
--- Integer is the release version
Example of release steps
-
Create the tag following today's date
git tag production_V20200806_0 -m 'release to production'
-
Push the tag to the main repository
git push upstream production_V20200806_0
Upon creating PR, Vercel and Cloudflare will auto-generate two test links inside the PR. you can use that to preview the test link for the changes you have made.