This repository contains the various platforms of the Deriv application.
In this document:
Before running or contribute to this project, you need to have the setup of the following package in your environment.
contribution
)Fork the project
In order to work on your own version of the Deriv application, please fork the project to your own repository.
Clone using SSH
git clone [email protected]:deriv-com/deriv-app.git
Internal: NX and Lerna integration
- Find and copy nx-cloud accessToken
- Make a copy of
nx-cloud.env.example
from root directory of the project and name itnx-cloud.env
and replace thewith provided token.
Enter project directory
cd deriv-app
Install your dependencies:
npm run bootstrap
Build packages:
npm run build:all
Package name | Docs | Version |
---|---|---|
Account |
- | - |
Appstore |
- | |
Bot-skeleton |
- | |
Bot-web-ui |
- | |
Cashier |
- | |
Cfd |
- | |
Components |
- | |
Core |
- | |
Indicators |
- | |
P2P |
||
Publisher |
- | |
Shared |
- | |
Trader |
- | |
Translations |
- |
All packages must contain the following scripts to perform the stated actions:
Package param | Command | Description |
---|---|---|
✅ | start |
Runs complete test and build suite and starts the dev server. |
✅ | serve |
Runs build suite and starts the dev server. When serving core , takes optional open value as argument to open specific page. (e.g: npm run serve core --open=bot ) |
✅ | build:one |
Runs build suite and outputs the result into dist for the passed package name. |
✅ | build:all |
Runs build suites for all of the packages and outputs the result into dist . |
✅ | test |
Runs the test suite with eslint, stylelint and jest. |
✅ | test:jest |
Runs only the jest test suite. |
✅ | test:qa |
Runs the e2e test suite. |
✅ | test:performance |
Runs the performance test suite. |
Note: Please follow the README of each package you intend to work with on how to get set up and their custom scripts. However, the above scripts can be run from the root directory in the following manner.
Each package is named with the @deriv/
prefix, however for the scripts above, you do not need to add the @deriv/
prefix as the scripts already prefix the 1st argument of the script with @deriv/
. However, if you do use the lerna
CLI directly, then you will need to use the full package name including the @deriv/
prefix.
You can find the names of packages by first navigating to the packages
folder. Each sub-folder is a package and contains a package.json
file. The value of the name
key in package.json
is the package name.
If you wish to work on Core, simply run npm run serve core
.
But for working on any of the other packages (such as Trader, Bot, P2P), perform the following:
npm run serve {package name}
in the first one. e.g.: npm run serve translations
, npm run serve bot
, etc.npm run serve core
in the second one.If you intend to remove node_modules
folder(s) from the projects, please run npm run clean
from the root of the project.
This runs lerna clean && rm -rf $(git rev-parse --show-toplevel)/node_modules
under the hood.
You can read more on the various lerna commands (and the clean
command) over at the Lerna docs.
Note: In case of facing permission denied error, please simply run sudo chown -R $(whoami) .
from the root of the project.
npm cache clean -f
✅ core
is required to run any of the other packages such as if you want to run the bot-web-ui the core must be instantiated before.
npm run serve core
If a script supports the "Package param", you can supply a {package name}
for it to run the script in. At the moment, only 1 package name can be given to a script, if you wish to run in multiple, please use the lerna
command that's used under the hood as per its docs.
✅ In order to run the bot
package, simply run:
npm run serve bot-web-ui
✅ Likewise for trader
(or any other package) with a different script:
npm run test:stylelint trader
There are 2 types of release:
git tag staging_v20191205 -m 'release staging'
# the tag needs to follow the RegExp format /^staging.*/
git push origin staging_v20191205
git tag production_v20191205 -m 'release production'
git push origin production_v20191205
There is a 4th type of release: releasing npm registry packages (currently @deriv/p2p
). This a WIP, but the current method is:
@deriv
npm organization namespace.@deriv/p2p
).npm run publish:p2p
. The command publishes all bumped packages. However, right now the name includes the word p2p
to signal the WIP status and that P2P is the only published package under this repo.[{Project Code}] {Developer}/{Clickup Card ID}/{Description}
format for PR titles. (e.g.: [COJ] evgeniy/COJ-247/Align next-button on mt5 modal
), where [COJ] is a clickup project code.There are two types of test link deployment preview:
Upon creating PR, Vercel will auto-generate a test link inside the PR. you can use that to preview the test link for the changes you have made.
If preferable to use manual deployment, you can use gh-pages functionality to create a test link. here are ways to do it:
gh-pages
branch with: npm run deploy
.br_
folders and clear root) your gh-pages
branch and deploy to root in a single command with npm run deploy:clean
gh-pages
branch in order to separate from root app deployment and other folder deployments with: npm run deploy:folder br_test_folder
(folder name must be prefixed with br_
))How do I install an npm package in one of our packages?
A. You can simply cd
into the package you wish to install to, then run npm i package-name
as usual. Or simply run a lerna exec
like lerna exec --scope=local-package -- npm i npm-package-name
, e.g.: lerna exec --scope=@deriv/translations -- npm i i18next
. Please note that for direct lerna
CLI use, you need the full package name including the @deriv/
prefix.
How do I uninstall an npm package from one of our packages?
A. Just as installing, except the npm
command you'd run would be npm uninstall
(shortened to npm un
). e.g.: lerna exec --scope=@deriv/translations -- npm un i18next
.
How do I run npm ci
or equivalent to add dependencies based on package-lock.json
?
A. You have two options:
lerna exec
with the --scope
argument as the package you want to run the command on, as such lerna exec --scope=trader -- npm ci
.cd
into packages/PACKAGE-NAME
and run npm ci
, as such cd packages/trader && npm ci
My build(s) fail and I can see it related to Node Sass (node-sass
), what do I do?
A. This issue happens when your node-sass
has its binding.node
set to a version of node different from the current projects' one. Please try the following in order:
npx lerna exec -- npm rebuild node-sass
and try building your packages again.npm cache clean --force
, followed by npm run clean
, and then npm run bootstrap
.How can I regenerate package-lock.json
file?
We have added bootstrap:dev
to scripts. If you are updating or adding a package and you want to regenerate package-lock.json
file, you should run this command
npm run bootstrap:dev