Skip to content

Commit

Permalink
Merge pull request #675 from mahdipourziaei-binary/project-updates
Browse files Browse the repository at this point in the history
msamprz/project_updates
  • Loading branch information
negarn committed Jan 3, 2020
2 parents ffa7738 + de41702 commit 35829a7
Show file tree
Hide file tree
Showing 577 changed files with 6,391 additions and 7,010 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
18 changes: 9 additions & 9 deletions .github/workflows/label.yml
Expand Up @@ -2,12 +2,12 @@ name: Labeler
on:
schedule:
- cron: '0 3,8 */1 * *'
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: paulfantom/periodic-labeler@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
LABEL_MAPPINGS_FILE: .github/labeler.yml
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: paulfantom/periodic-labeler@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
LABEL_MAPPINGS_FILE: .github/labeler.yml
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 --ci --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

0 comments on commit 35829a7

Please sign in to comment.