Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hirad/Made cfd an independent monorepo #5036

Closed
wants to merge 10 commits into from

Conversation

hirad-deriv
Copy link
Contributor

Changes:

Please include a summary of the change and which issue is fixed below:

  • ...

When you need to add unit test

  • If this change disrupt current flow
  • If this change is adding new flow

When you need to add integration test

  • If components from external libraries are being used to define the flow, e.g. @deriv/components
  • If it relies on a very specific set of props with no default behavior for the current component.

Test coverage checklist (for reviewer)

  • Ensure utility / function has a test case
  • Ensure all the tests are passing

Type of change

  • Bug fix
  • New feature
  • Update feature
  • Refactor code
  • Translation to code
  • Translation to crowdin
  • Script configuration
  • Improve performance
  • Style only
  • Dependency update
  • Documentation update
  • Release

@vercel
Copy link

vercel bot commented Mar 14, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/deriv/deriv-app/HUpuAmoHZPxashLs7fosSXaKVYi1
✅ Preview: https://deriv-app-git-fork-hirad-rewok-cfd-monorepo-package.binary.sx

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2022

A production App ID was automatically generated for this PR. (log)

Click here to copy & paste above information.
- **PR**: [https://github.com/binary-com/deriv-app/pull/5036](https://github.com/binary-com/deriv-app/pull/5036)
- **URLs**:
    - **w/ App ID + Server**: https://deriv-app-git-fork-hirad-rewok-cfd-monorepo-package.binary.sx?qa_server=frontend.binaryws.com&app_id=31359
    - **Original**: https://deriv-app-git-fork-hirad-rewok-cfd-monorepo-package.binary.sx
- **App ID**: `31359`

@balakrishna-deriv
Copy link
Contributor

Please add CFD to CODEOWNERS file

@@ -0,0 +1,11 @@
sudo: false
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't use travis anymore. It's safe to remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


const ALIASES = {
_common: path.resolve(__dirname, '../src/_common'),
Assets: path.resolve(__dirname, '../src/Assets'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Assets folder is not there in cfd/src. I think we should remove it.

declare module '@deriv/bot-web-ui';
declare module '@deriv/cashier';
declare module '@deriv/components';
declare module '@deriv/dashboard';
Copy link
Contributor

Choose a reason for hiding this comment

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

dashboard is changed to appstore. Can you update it here?

@@ -95,6 +95,7 @@
"@deriv/bot-web-ui": "^1.0.0",
"@deriv/cashier": "^1.0.0",
"@deriv/components": "^1.0.0",
"@deriv/cfd": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

you should also add cfd scope to build:travis package command

@@ -1,5 +0,0 @@
import CFDDashboard from './Containers/cfd-dashboard';
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the entire CFD folder in Modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already done but for some reason github shows it differently.

"@deriv/api-types": "1.0.48",
"@deriv/components": "^1.0.0",
"@deriv/deriv-api": "^1.0.8",
"@deriv/deriv-charts": "^0.5.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

@deriv/deriv-charts is not needed in this package

// Components
@import 'app/_common/components/amount';
@import 'app/_common/components/allow-equals';
//@import 'app/_common/components/calendar'; // TODO: [move-to-components] Calendar component should be moved
Copy link
Contributor

Choose a reason for hiding this comment

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

You may remove the TODOs in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

{
path: routes.dxtrade,
component: props => <CFD {...props} platform='dxtrade' />,
// Don't use `Localize` component since native html tag like `option` cannot render them
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove this to decrease duplication..
same for line 59.

Comment on lines 125 to 126
// new HtmlWebPackPlugin(htmlOutputConfig()),
// new HtmlWebpackTagsPlugin(htmlInjectConfig()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to enable these plugins in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. I remove them in the my new commit.

Comment on lines +15 to +17
<div>
<Localize i18n_default_text='Loading...' />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these divs necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since fallback is required in react suspense, we are using plain text to avoid further issues.

>
<Switch>
{getRoutesConfig({ is_dashboard }).map((route, idx) => (
<RouteWithSubRoutes key={idx} {...route} {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<RouteWithSubRoutes key={idx} {...route} {...props} />
<RouteWithSubRoutes key={idx} {...route} {...props} />

The key should not use idx generated by map() can we use something unique from the return of getRoutesConfig

@@ -0,0 +1,15 @@
// import 'babel-polyfill';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need commented import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove it in my last commit.

import { expect } from 'chai';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { RouteWithSubRoutesRender } from '../route-with-sub-routes.jsx';
Copy link
Contributor

Choose a reason for hiding this comment

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

i guess we can don’t use extension .jsx

Suggested change
import { RouteWithSubRoutesRender } from '../route-with-sub-routes.jsx';
import { RouteWithSubRoutesRender } from '../route-with-sub-routes';

import { PlatformContext } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import getRoutesConfig from '../../Constants/routes-config';
import RouteWithSubRoutes from './route-with-sub-routes.jsx';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import RouteWithSubRoutes from './route-with-sub-routes.jsx';
import RouteWithSubRoutes from './route-with-sub-routes';

@@ -1,5 +1,5 @@
import React from 'react';
import SuccessDialog from 'App/Containers/Modals/success-dialog.jsx';
import SuccessDialog from 'Components/success-dialog.jsx';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import SuccessDialog from 'Components/success-dialog.jsx';
import SuccessDialog from 'Components/success-dialog';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the suggested changes.

},
});

const htmlInjectConfig = () => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest removing htmlInjectConfig() because it's not used in packages/cfd/build/constants.js same like I was recommended to do it with trader package in my PR #5063 recently

Copy link
Contributor

@matin-deriv matin-deriv left a comment

Choose a reason for hiding this comment

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

Please help to add the newly created Package to extract-string.js file to make sure we pick up on the newly added strings and translate them.

@sonarcloud
Copy link

sonarcloud bot commented Mar 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 29 Code Smells

No Coverage information No Coverage information
4.8% 4.8% Duplication

Copy link
Contributor

@matin-deriv matin-deriv left a comment

Choose a reason for hiding this comment

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

LGTM, let's wait for more approvals...
Noticed there are conflicts on your PR.

@hirad-deriv hirad-deriv closed this May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants