Skip to content

Commit

Permalink
Rename refactor all package name prefix from deriv- to @deriv/
Browse files Browse the repository at this point in the history
  • Loading branch information
msamprz committed Jan 2, 2020
1 parent ae04cbf commit 6d1b5d5
Show file tree
Hide file tree
Showing 576 changed files with 980 additions and 980 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Expand Up @@ -11,8 +11,8 @@ commands:
- source-v1-{{ .Branch }}-{{ .Revision }}
- source-v1-{{ .Branch }}-
- source-v1-
- run:
name: Fetch git tags
- run:
name: Fetch git tags
command: |
mkdir -p ~/.ssh
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== ' >> ~/.ssh/known_hosts
Expand All @@ -23,7 +23,7 @@ commands:
fi
- checkout
- run:
name: Compress git objects
name: Compress git objects
command: git gc
- save_cache:
name: Git save cache
Expand All @@ -45,17 +45,17 @@ commands:
command: npm run build:local
- run:
name: "build core"
command: node_modules/lerna/cli.js exec --scope deriv-core -- npm run build
command: node_modules/lerna/cli.js exec --scope @deriv/core -- npm run build

docker:
description: "Build and Push image to docker hub"
steps:
- setup_remote_docker
- run:
- run:
name: Building docker image
command: |
docker build -t ${DOCKHUB_ORGANISATION}/deriv-app:${CIRCLE_TAG} .
- run:
- run:
name: Pushing Image to docker hub
command: |
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
Expand All @@ -64,7 +64,7 @@ commands:
description: "Deploy to k8s cluster"
steps:
- k8s/install-kubectl
- run:
- run:
name: Deploying to k8s cluster for service deriv-app
command: |
echo $CA_CRT | base64 --decode > ca.crt
Expand All @@ -74,7 +74,7 @@ commands:
description: "Deploy to k8s cluster"
steps:
- k8s/install-kubectl
- run:
- run:
name: Deploying to k8s cluster for service deriv-app
command: |
echo $CA_CRT | base64 --decode > ca.crt
Expand All @@ -91,7 +91,7 @@ jobs:
- build
- docker
- k8s_deploy_staging

release_production:
docker:
- image: circleci/node:11.15.0-stretch
Expand All @@ -101,7 +101,7 @@ jobs:
- build
- docker
- k8s_deploy_production

workflows:
release_staging:
jobs:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -64,7 +64,7 @@ All packages must contain the following scripts to perform the stated actions:
**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.

### Package names
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.
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 subfolder is a package, and contains a `package.json` file. The value of the `name` key in `package.json` is the package name.

Expand Down Expand Up @@ -130,11 +130,11 @@ There is a 4th type of release: releasing npm registry packages (currently `@der
## FAQ
1. 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._
**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._

2. 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`.
**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`.

3. How do I run `npm ci` or equivalent (to add dependencies based on `package-lock.json`?

Expand Down
2 changes: 1 addition & 1 deletion docs/Modules/README.md
Expand Up @@ -2,7 +2,7 @@

In order to create and add a new package to this project/repo, please follow the guideline below:

1. Make sure your new package name is prefixed with `deriv-`.
1. Make sure your new package name is prefixed with `@deriv/`.
2. Make sure the Webpack config has `IS_RELEASE` flag, as well as conditional source-maps based on "if IS_RELEASE".

...WIP
8 changes: 4 additions & 4 deletions docs/README.md
@@ -1,16 +1,16 @@
# Architecture and general philosophy of the project

## Brief
This project contains different dependency libraries and different packages used by the Core package (`deriv-core`).
This project contains different dependency libraries and different packages used by the Core package (`@deriv/core`).

Each package in the `packages` folder is a dependency that eventually up to Core (the main app).

There are 2 types of dependencies:

1. Reusable code/libraries - These are packages that are meant to be loaded anywhere for use, and they enhance the application and/or development. At the time of writing, this includes: `deriv-components`, `deriv-shared`, `@deriv/p2p`, `deriv-translations`.
2. Platforms/Modules/Apps - These can be viewed as applications of their own. According to business logic, these are different domains/sections, and most likely have their own route. At the time of writing, this includes: `deriv-bot`, `deriv-trader`.
1. Reusable code/libraries - These are packages that are meant to be loaded anywhere for use, and they enhance the application and/or development. At the time of writing, this includes: `@deriv/components`, `@deriv/shared`, `@deriv/p2p`, `@deriv/translations`.
2. Platforms/Modules/Apps - These can be viewed as applications of their own. According to business logic, these are different domains/sections, and most likely have their own route. At the time of writing, this includes: `@deriv/bot`, `@deriv/trader`.

The `deriv-core` package is the "app instance". It contains singleton services (such as the WS, and base/common stores), as well as singleton UI components (header, footer, modals management, cashier).
The `@deriv/core` package is the "app instance". It contains singleton services (such as the WS, and base/common stores), as well as singleton UI components (header, footer, modals management, cashier).

_Hint: In order to simply build (without tests) type 1 dependencies, use the command `npm run build:travis` from the root of the package. In order to build type 2 dependencies, in the same manner, use `npm run build:local`._

Expand Down
28 changes: 14 additions & 14 deletions package.json
Expand Up @@ -6,22 +6,22 @@
"lerna": "^3.15.0"
},
"scripts": {
"bootstrap": "f () { npm ci && lerna link && lerna bootstrap --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} && lerna link && npm run build:travis ;}; f",
"build": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run build $2 ;}; f",
"build:local": "f () { lerna exec --scope deriv-trader --scope deriv-bot --parallel -- npm run build $1 ;}; f",
"build:travis": "lerna exec --scope deriv-shared --scope deriv-components --scope deriv-translations --scope @deriv/p2p -- npm run build:travis",
"bootstrap": "f () { npm ci && lerna link && lerna bootstrap --scope=@deriv/${1:-'*'} && lerna link && npm run build:travis ;}; f",
"build": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run build $2 ;}; f",
"build:local": "f () { lerna exec --scope @deriv/trader --scope @deriv/bot --parallel -- npm run build $1 ;}; f",
"build:travis": "lerna exec --scope @deriv/shared --scope @deriv/components --scope @deriv/translations --scope @deriv/p2p -- npm run build:travis",
"clean": "echo \"Remove $(git rev-parse --show-toplevel)/node_modules\" && lerna clean && rm -rf \"$(git rev-parse --show-toplevel)/node_modules\"",
"deploy": "f () { npm run build:travis && npm run build:local && lerna exec --scope deriv-core -- npm run deploy $@ ;}; f",
"deploy:clean": "f () { npm run build:travis && npm run build:local && lerna exec --scope deriv-core -- npm run deploy:clean $@ ;}; f",
"deploy:folder": "f () { npm run build:travis && npm run build:local $1 && lerna exec --scope deriv-core -- npm run deploy:folder $@ ;}; f",
"deploy": "f () { npm run build:travis && npm run build:local && lerna exec --scope @deriv/core -- npm run deploy $@ ;}; f",
"deploy:clean": "f () { npm run build:travis && npm run build:local && lerna exec --scope @deriv/core -- npm run deploy:clean $@ ;}; f",
"deploy:folder": "f () { npm run build:travis && npm run build:local $1 && lerna exec --scope @deriv/core -- npm run deploy:folder $@ ;}; f",
"publish:p2p": "f () { lerna publish from-package ;}; f",
"serve": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run serve ;}; f",
"start": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run start ;}; f",
"test": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} --parallel -- npm run test ;}; f",
"test:eslint": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run test:eslint ;}; f",
"test:mocha": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run test:mocha ;}; f",
"test:stylelint": "f () { lerna exec --scope deriv-${1:-'*'} --scope=@deriv/${1:-'p2p'} -- npm run test:stylelint ;}; f",
"translate": "f () { lerna exec --scope deriv-translations -- npm run translate ;}; f"
"serve": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run serve ;}; f",
"start": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run start ;}; f",
"test": "f () { lerna exec --scope=@deriv/${1:-'*'} --parallel -- npm run test ;}; f",
"test:eslint": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run test:eslint ;}; f",
"test:mocha": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run test:mocha ;}; f",
"test:stylelint": "f () { lerna exec --scope=@deriv/${1:-'*'} -- npm run test:stylelint ;}; f",
"translate": "f () { lerna exec --scope @deriv/translations -- npm run translate ;}; f"
},
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/.eslintrc.js
Expand Up @@ -23,7 +23,7 @@ module.exports = {
semi : ['error', 'always'],
'array-callback-return' : 0,
'brace-style' : ['error', '1tbs', { allowSingleLine: true }],
'class-methods-use-this' : ["error", { 'exceptMethods': ['render', 'getInitialState', 'getDefaultProps', 'getChildContext', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps', 'shouldComponentUpdate', 'componentWillUpdate', 'componentDidUpdate', 'componentWillUnmount'] }],
'class-methods-use-this' : ["error", { 'exceptMethods': ['render', 'getInitialState', 'getDefaultProps', 'getChildContext', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps', 'shouldComponentUpdate', 'componentWillUpdate', 'componentDidUpdate', 'componentWillUnmount'] }],
'eol-last' : ['error', 'always'],
'func-names' : ['error', 'never'],
'keyword-spacing' : ['error', { after: true , before: true }],
Expand All @@ -50,7 +50,7 @@ module.exports = {
'import/order' : ['error', { groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'], 'newlines-between': 'ignore' }],
'import/prefer-default-export' : 0,
'import/extensions' : ['error', 'never', { 'jsx': 'always', 'json': 'always' }],
"import/no-unresolved" : [2, { ignore: ['deriv-components' , 'deriv-shared'] }],
"import/no-unresolved" : [2, { ignore: ['@deriv/components' , '@deriv/shared'] }],

// react rules
'jsx-quotes' : ['error', 'prefer-single'],
Expand Down
14 changes: 7 additions & 7 deletions packages/bot/package-lock.json

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

8 changes: 4 additions & 4 deletions packages/bot/package.json
@@ -1,6 +1,6 @@
{
"version": "1.0.0",
"name": "deriv-bot",
"name": "@deriv/bot",
"description": "Visual automation for deriv.app",
"main": "dist/bot.main.js",
"private": true,
Expand Down Expand Up @@ -98,9 +98,9 @@
"commander": "^2.20.0",
"concat-stream": "^2.0.0",
"core-js": "^2.6.5",
"deriv-components": "^1.0.0",
"deriv-shared": "^1.0.0",
"deriv-translations": "^1.0.0",
"@deriv/components": "^1.0.0",
"@deriv/shared": "^1.0.0",
"@deriv/translations": "^1.0.0",
"firebase": "7.2.3",
"formik": "^1.5.8",
"gh-pages": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/assets/sass/app.scss
@@ -1,5 +1,5 @@
// Fonts
@import 'deriv-shared/src/styles/google-fonts.scss';
@import '@deriv/shared/src/styles/google-fonts.scss';

.bot {
--bot-content-height: calc(100vh - 140px);
Expand Down
6 changes: 3 additions & 3 deletions packages/bot/src/components/contract-card.jsx
@@ -1,11 +1,11 @@
import classNames from 'classnames';
import {
Icon,
Money } from 'deriv-components';
Money } from '@deriv/components';
import React from 'react';
import PropTypes from 'prop-types';
import CurrencyUtils from 'deriv-shared/utils/currency';
import { localize } from 'deriv-translations';
import CurrencyUtils from '@deriv/shared/utils/currency';
import { localize } from '@deriv/translations';
import ContractCardLoader from './contract-card-loading.jsx';
import ContractResultOverlay from './contract-result-overlay.jsx';
import IconTradeType from './icon-trade-types.jsx';
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components/contract-result-overlay.jsx
@@ -1,8 +1,8 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { Icon } from 'deriv-components';
import { localize } from 'deriv-translations';
import { Icon } from '@deriv/components';
import { localize } from '@deriv/translations';
import '../assets/sass/contract-result-overlay.scss';

const ContractResultOverlay = (props) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components/dialog.jsx
@@ -1,8 +1,8 @@

import { Button, Modal } from 'deriv-components';
import { Button, Modal } from '@deriv/components';
import PropTypes from 'prop-types';
import React from 'react';
import { localize } from 'deriv-translations';
import { localize } from '@deriv/translations';
import '../assets/sass/dialog.scss';

const Dialog = ({
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components/flyout-block-group.jsx
@@ -1,8 +1,8 @@

import { Button } from 'deriv-components';
import { Button } from '@deriv/components';
import React from 'react';
import { PropTypes } from 'prop-types';
import { localize } from 'deriv-translations';
import { localize } from '@deriv/translations';
import FlyoutBlock from './flyout-block.jsx';

const FlyoutBlockGroup = ({
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components/flyout.jsx
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import { localize } from 'deriv-translations';
import { localize } from '@deriv/translations';
import FlyoutBlockGroup from './flyout-block-group.jsx';
import HelpBase from '../scratch/help-content/flyout-help-base.jsx';
import { config } from '../scratch/help-content/help-content.config';
Expand Down Expand Up @@ -29,7 +29,7 @@ class Flyout extends React.PureComponent {
setHelpContent } = this.props;
const total_result = Object.keys(flyout_content).length;
const is_empty = total_result === 0;

if (is_visible && is_search_flyout) pushDataLayer({ event: 'dbot_search_results', value: true });

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/components/footer-extension.jsx
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { localize } from 'deriv-translations';
import { localize } from '@deriv/translations';
import { tabs_title } from '../constants/bot-contents';
import { connect } from '../stores/connect';
import '../assets/sass/footer-extensions.scss';
Expand Down
2 changes: 1 addition & 1 deletion packages/bot/src/components/icon-trade-types.jsx
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Icon } from 'deriv-components';
import { Icon } from '@deriv/components';

const IconTradeType = ({ type, className, ...props }) => {
switch (type.toLowerCase()) {
Expand Down
4 changes: 2 additions & 2 deletions packages/bot/src/components/journal.jsx
@@ -1,8 +1,8 @@
import classnames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import { ThemedScrollbars } from 'deriv-components';
import { localize } from 'deriv-translations';
import { ThemedScrollbars } from '@deriv/components';
import { localize } from '@deriv/translations';
import { message_types } from '../constants/messages';
import { connect } from '../stores/connect';
import '../assets/sass/journal.scss';
Expand Down

0 comments on commit 6d1b5d5

Please sign in to comment.